JDBC Quick Start | ![]() |
The built-in JDBC API in J2SE 1.4 is JDBC 3.0. The built-in JDBC API for J2SE 1.3 and 1.2 is JDBC 2.1, while the older JDK 1.1 has JDBC 1.0. IDS JDBC Driver supports all of these J2SE and JDK releases. Developers can select among six different versions of this driver base on their deployment requirements. There are essentially two types of deployment: 1) stand-alone Java applications, servlets and Web Start applications; 2) Java applets. The following table shows how to select an IDS JDBC Driver that is right for you. All driver archives are installed in directory "IDSServer\classes".
Target Environment |
Driver Archive |
|
jdk14drv.jar |
|
jdk13drv.jar |
|
jdk11drv.jar |
|
jdk13drv-v4browser.jar |
|
jdk12drv-v3browser.zip (3) |
|
jdk11drv-v3browser.zip (3) |
|
IDS JDBC Driver consists of several Java packages. Driver archive jdk14drv.jar, jdk13drv.jar and jdk11drv.jar contains package ids.sql that implements the standard java.sql package of the JDBC API. These the first two also contains package ids.jdbc that implements the javax.sql package of JDBC 3.0 and 2.1 API
Driver archive jdk13drv-v4browser.jar contains package java2.sql that
implements the JDBC 2.1 API for Web browsers with a JDK 1.1 compatible Java VM
(Internet Explorer 4.0 to 6.x and Netscape Communicator 4.x).
jdk12drv-v3browser.zip and jdk11drv-3browser.zip contains package j102.sql that
implements the JDBC API for Web browsers with a JDK 1.02 compatible Java VM
(Internet Explorer 3.x and Netscape Navigator 3.x).
Three steps are required to use the IDS JDBC Driver in a Java program: 1) Composing a Connection URL, 2) Initialize the driver, 3) Making a connection. A typical Connection URL for looks like this:
"jdbc:ids://ip_address:12/conn?dsn='MyDB'&uid='MyName'&pwd='sECreT'"
where ip_address:12
is the address and
port number of the IDS Server. The default port number is 12, but
it can be changed in the "idss.ini" file. 'MyDB'
is the ODBC data source name (or Oracle server alias, see next
topic). 'MyName'
is the user ID of the target
database. 'sECreT'
is the password of the
database user ID. For a complete reference on the syntax of the
Connection URL, please refer to Section 4.4 and 4.5 of the IDS
Server User's Guide.
There are several ways to initialize the driver and make a connection. If you like to use the DriverManager.getConnection() method, you can use the following:
Class.forName("ids.sql.IDSDriver").newInstance(); Connection conn = DriverManager.getConnection(url,"scott", "tiger");
If you like to use the Driver.connect() method, you can create a JDBC Connection instance like this:
Driver drv = (Driver) Class.forName("ids.sql.IDSDriver").newInstance(); Connection conn = drv.connect(url, prop);
There is a much simpler alternative looks like the following.
The only drawback is that this requires you to include the "IDS_Server_directory
\classes
"
directory in the CLASSPATH environment before compiling.
Driver drv = new ids.sql.IDSDriver(); Connection conn = drv.connect(url, prop);
This driver is for applets using JDBC 2.1 features runing in Version 4 browsers. When writing applets using this driver, first import the java2.sql.* package instead of java.sql.*. Then initialize the driver class java2.sql.IDSDriver instead of ids.sql.IDSDriver. The syntax of the Connection URL remains the same. For example,
import java2.sql.*; // Instead of import java.sql.*; ... Driver drv = new java2.sql.IDSDriver(); Connection conn = drv.connect(url, prop);
You must add archive "IDS_Server\classes\jdk13drv-v4browsers.jar" to the CLASSPATH environment variable before compiling your applet.
This driver is for applets using JDBC 2.1 features runing in Version 3 browsers. When writing applets using this driver, first import the j102.sql.* package instead of java.sql.*. Then initialize the driver class j102.sql.IDSDriver instead of ids.sql.IDSDriver. The syntax of the Connection URL remains the same. For example,
import j102.sql.*; // Instead of import java.sql.*; ... Driver drv = new j102.sql.IDSDriver(); Connection conn = drv.connect(url, prop);
You must add archive "IDS_Server\classes\jdk12drv-v3browsers.zip" to the CLASSPATH environment variable before compiling your applet.
This example demonstrates how to write a simple Java applet
that uses the IDS JDBC Driver to connect to the IDS Server,
submit database queries and print out the query results. Click here to run this applet. To see
another JDBC application example that runs using command line
JDK, refer to the "IDS JDBC Test" icon in the
IDS Server menu (Windows) or the command file runtest
in the IDS Server directory.