|
|
|
|
If you wish to implement Enterprise solutions, you have to be able to work with databases, so it's natural that we would like Java to talk to any and all of the major SQL databases available from a number of major vendors. Java is intended to be portable, and to allow the same program to run anywhere. This includes downloading Java programs (applets, etc.) from various sources, including the web. When Sun Microsystems decided to add to Java the necessary support for database access, they naturally wanted to be able to access those databases from whatever platform the Java program might be running on. In addition, they wanted to allow Java programmers to be able to write programs that could access any database and still function correctly. This was no mean feat, because database vendors have implemented many different proprietary versions of "standard" SQL, and those versions differed significantly in many ways. Furthermore, most vendors' databases are implemented as a client/server architecture, where the client might be on a PC or a Mac, and the server (where the actual database is running) might be on a UNIX server, or some such high-powered machine. Clearly, the desire was to allow Java programs to run on any client and access any of the major databases running on whatever server was desired. One model that already existed was that of Microsoft's ODBC (Open Database Connectivity), which was based on XOpen's model of database access. ODBC provided a standard API, and a standard subset of the SQL language (with escapes for vendor-specific functionality), ODBC introduced the concept of ODBC drivers, which could be plugged into the ODBC framework in a transparent way. ODBC drivers provided the standard API, and hid the details of the vendor's implementation from the user of ODBC. So, Sun, in collaboration with many database vendors and customers, came up with JDBC (which Sun claims does not stand for Java Database Connectivity!). It does not emulate the exact interface of ODBC because ODBC was designed primarily for C programs, while the desire was that Java's interface to databases would be more object-oriented. JDBC DriversA JDBC driver isolates the JDBC programmer from the implementation details of the vendor's database. It sits between the JDBC client and the database:
and hides the details from the JDBC client program. You can select which JDBC driver you wish to use using the JDBC DriverManager class. JDBC Driver TypesThe types of JDBC driver specified by Sun are:
To find a list of supported drivers, see JDBC Data Access API: Drivers. JDBC Access from AppletsIt is important to note that database access from Java applets is restricted in two ways:
|
| The page was last updated February 19, 2008 |