Sybase JDBC LookUp Sample
(with ISAPI on MS Internet Server)
This sample will connect to a SQL Anywhere database, look up and display customer information for a customer
whose id number is 101.
Click here for installation instructions.
To run this sample on your machine, you will need to install the following components:
- Microsoft Internet Information Server or Microsoft Personal Web Server
- Microsoft Java VM
- SQL Anywhere (and a SQL Anywhere database)
- Open Server Gateway components from SQL Anywhere
To configure the Microsoft Internet Information Server
(this assumes that you have installed the Microsoft Internet Information Server with the default directory setups on your
machine)
- Copy the file '%Starbuck%\system\javaisapi.dll' into your \Inetpub\scripts directory, where %Starbuck% is the
directory where you installed Starbuck
- Copy this html file into your \Inetpub\wwwroot directory
To configure the Microsoft Personal Web Server
(this assumes that you have installed the Microsoft Personal Web Server with the default directory setups on your
machine)
- Copy the file '%Starbuck%\system\javaisapi.dll' into your \WebShare\scripts directory
- Copy this html file into your \WebShare\wwwroot directory
To configure the Open Server Gateway for a SQL Anywhere Database
- When installing your SQL Anywhere Server, you must intall the Open Server Gateway components.
Therefore, make sure that you install the 'SQL Anywhere Open Server Gateway' and 'Sybase Open Server
components'.
- Make sure that your SYBASE environment variable is set to point to the directory where you've installed the
Open Server Gateway components.
- Run 'sqledit.exe' (which should be located under the \sybase directory). This program provides an Open Server
Gateway name for your SQL Anywhere database and to configure its connection profile.
- Add an Open Server Gateway name for your SQL Anywhere database under 'Input Server Name'. The
convention is to give it the same name as your SQL Anywhere database. Then click 'Add'.
For example: "sademo"
- Add a Query Service. From the 'Service Type' list, select 'query'.
- From the 'Platform' list, select the appropriate platform (NT, dos, or win3).
- From the 'Net-Library Driver' list, select 'NLWNSCK'. This is the WinSock network-library driver.
- In the 'Connection Information/Network Address' field, enter the machine name where the SQL Anywhere
database is located. This typically is the name of the computer that you're currently working on. Following the
computer name, enter a comma followed by the port number where client programs can access this SQL
Anywhere database. Here, you can typically choose any unused port number.
For example: "MNGUYEN, 8000"
- Click 'Add Service' to add this query service.
- Add a Master Service by clicking 'master' on 'Service Type:' under 'Connection Service Entry'.
- Repeat Steps 6, 7 and 8.
- Under the 'File' menu, click 'Save' to save your 'sql.ini' file.
To run this sample
- Start the SQL Anywhere database by clicking on your 'Start Button' and 'Run' and typing in the following, or by
simply typing in the following at the command line (in a DOS box):
"dbeng50 db_name", where db_name is the name of your SQL Anywhere database (with path)
For example: "dbeng50 d:\sqlany50\sademo.db"
- Start the Open Server Gateway for NT by typing in the following at the command line (in a DOS box):
"dbos50 -v server_name", where server_name is the Open Server Gateway name for your SQL Anywhere
database
For example: "dbos50 -v sademo"
- Start the Microsoft Internet Information Server or the Microsoft Personal Web Server
- From your browser and type in the following URL:
"http://localhost/IJDBC_LookUp.html"
- For the 'classpath', type in a dollar sign ($) followed immediately by the path to your Starbuck Java class files.
Then type a comma and the path to the class files for the 'IJDBC_LookUp' project. The Java class files are in
the \Debug directory of the project.
For example: "$d:\starbuck20\java\lib;d:\starbuck20\samples\IJDBC_LookUp\debug"
- For the 'host', please note that you will have to enter the host name of your computer (where the SQL
Anywhere database resides), not the Open Server Gateway name for the SQL Anywhere database.
For example: "host = mnguyen"
- For the 'port', type in the port number to connect to the SQL Anywhere database
For example: "port = 8000"
- Click 'Submit' to send the form contents to the server
- Stop the Open Server Gateway for NT by typing in the following at the command line (in a DOS box):
"dbosstop -S server_name -U userID -P password -x thx1138", where server_name is the Open Server
Gateway name for your SQL Anywhere database, userID is the user Id and password the password for the
SQL Anywhere database.
For example: "dbosstop -S sademo -U dba -P sql -x thx1138"