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.


 

This form will submit using the POST method

class = IJDBC_LookUp

classpath =

host =

port =


 

This form will submit using the GET method

class = IJDBC_LookUp

classpath =

host =

port =



 

Installation Instructions

To run this sample on your machine, you will need to install the following components:

 

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)

  1. Copy the file '%Starbuck%\system\javaisapi.dll' into your \Inetpub\scripts directory, where %Starbuck% is the directory where you installed Starbuck
  2. 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)

  1. Copy the file '%Starbuck%\system\javaisapi.dll' into your \WebShare\scripts directory
  2. Copy this html file into your \WebShare\wwwroot directory

To configure the Open Server Gateway for a SQL Anywhere Database

  1. 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'.
  2. Make sure that your SYBASE environment variable is set to point to the directory where you've installed the Open Server Gateway components.
  3. 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.
  4. 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"
  5. Add a Query Service. From the 'Service Type' list, select 'query'.
  6. From the 'Platform' list, select the appropriate platform (NT, dos, or win3).
  7. From the 'Net-Library Driver' list, select 'NLWNSCK'. This is the WinSock network-library driver.
  8. 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"
  9. Click 'Add Service' to add this query service.
  10. Add a Master Service by clicking 'master' on 'Service Type:' under 'Connection Service Entry'.
  11. Repeat Steps 6, 7 and 8.
  12. Under the 'File' menu, click 'Save' to save your 'sql.ini' file.

 

To run this sample

  1. 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"
  2. 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"
  3. Start the Microsoft Internet Information Server or the Microsoft Personal Web Server
  4. From your browser and type in the following URL:
    "http://localhost/IJDBC_LookUp.html"
  5. 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"
  6. 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"
  7. For the 'port', type in the port number to connect to the SQL Anywhere database
    For example: "port = 8000"
  8. Click 'Submit' to send the form contents to the server
  9. 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"