Using JDBC to Create Database Objects
By James W. Cooper2003-05-24
Types of JDBC Drivers
There are actually four ways for a Java program to connect to a database:
- JDBC-ODBC bridge and an ODBC driver -- In this case, it is a local solution, since the ODBC driver and the bridge code must be present on each user's machine. This is fundamentally an interim solution.
- Native code plus Java driver -- This replaces ODBC and the bridge with another local solution: native code for that platform that can be called by Java.
- JDBC-Net pure Java driver -- The Java driver-translated JDBC calls into an independent protocol that is passed to a server. The server can then connect to any of a number of databases. This method allows you to call a server from an applet on your client machine and return the results to your applet. In this case, middleware software providers can provide the server.
- Native protocol Java driver -- The Java driver translates directly to the protocol for that database and makes the calls. This method also can be used over a network and can then display results in a Web browser applet. In this case, each database vendor would supply the driver.
If you want to write code to manipulate a PC client database like dBase, Foxbase, or Access, you will probably use method 1 and have all the code on the user's machine. Larger client-server database products, like IBM's DB2, already provide level 3 drivers for you.
Tutorial Pages:
» What is a Database?
» Getting Data out of Databases
» Kinds of Databases
» ODBC
» What Is JDBC?
» Installing and Using JDBC
» Types of JDBC Drivers
» Two-Tier and Three-Tier Models
» Writing JDBC Code to Access Databases
» Registering Your Database with ODBC
» Connecting to a Database
» Accessing the Database
» The ResultSet
» ResultSetMetaData
» DatabaseMetaData
» Getting Information on Tables
» Executing SQL Queries, Printing out ResultSets, A Simple JDBC Program
» Building Higher Level JDBC Objects
» Building a Database Object, A Visual Database Program
» Executing a Query
» The Query Result Dialog
» Example Files
» Summary
First published by IBM DeveloperWorks
