Installing and Using a JDBC Driver

   

The installation of a JDBC driver varies according to the type of driver that is being used. Oracle8i Lite provides a Type II driver. It uses an ODBC datasource setup to locate and communicate with the database. Although this TYPE II driver uses an ODBC configuration, it is different from the JDBC-ODBC Bridge of the type I.

After all the pieces are installed, it's a good idea to test the database connection outside of your Java applications to be sure everything is correct. Oracle8i Lite provides a utility called SQL*Plus that can get a connection to an Oracle8i Lite database and issue SQL commands. The utility will prompt you for three input fields; username, password, and host string. For username, you can use SYSTEM. The password can be any string, and for host string, use ODBC:POLITE. If everything is set up correctly, you should see the screen shown in Figure 26.5.

Figure 26.5. A SQL Plus connection is successful when you are presented with the SQL command prompt.

graphics/26fig05.gif

You can issue SQL commands and see the results. For example, to select all the rows in the EMP table, type select * from EMP; and press Enter. The results should match those seen in Figure 26.6.

Figure 26.6. SQL returns results from the query in a tabular format.

graphics/26fig06.gif

Note

If you are using another database, your sample data will probably not match these results.


There are several JAR files included in the Oracle8i Lite installation. You will want to add OLITE40.JAR to your system CLASSPATH before attempting to connect to the databases. This jar file can be found in the <DRIVE>:\orawin95\LITE\CLASSES directory.

Note

The default login for Oracle8i Lite is either SYSTEM with no password or you can also use SCOTT as the username and TIGER as the password. The username and password of SCOTT and TIGER are the defaults for the Oracle demo database.


For any programs with installation of the database and/or driver JAR file, check the user documentation that came with the installations or the newsgroups.

   


Special Edition Using Java 2 Standard Edition
Special Edition Using Java 2, Standard Edition (Special Edition Using...)
ISBN: 0789724685
EAN: 2147483647
Year: 1999
Pages: 353

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net