|
|||||||||||||||||
Home |
How to Select A DriverThe built-in JDBC API in J2SE 1.4 is JDBC 3.0. The built-in JDBC API of 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".
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). How to Use the DriverThree 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 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 " Driver drv = new ids.sql.IDSDriver(); Connection conn = drv.connect(url, prop); Using java2.sql.IDSDriverThis driver is for applets using JDBC 2.1 features runing in Version 4 browsers (see 4A.(1)). 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. Using j102.sql.IDSDriverWhen using the driver for JDK 1.0.2 compatible browsers, you need to do two things differently. First is to import the j102.sql.* package instead of java.sql.* in your Java program. Second is to initialize driver class j102.sql.IDSDriver instead of ids.sql.IDSDriver. There is difference in the syntax of the Connection URL. 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. |
||||||||||||||||
Copyright c 1997-2006 IDS Software. All rights reserved. |