JDBC is a set of Java classes that provide an ODBC-like interface to SQL databases. Like ODBC, JDBC uses a driver manager to automatically l...
JDBC is a set of Java classes that provide an ODBC-like interface to SQL databases. Like ODBC, JDBC uses a driver manager to automatically load the right JDBC driver to talk to a given database.
Unlike ODBC, JDBC must pay close attention to mobile code issues. For example, a JDBC driver must prevent an untrusted applet from accessing databases outside its home machine- meaning the machine from which the applet originates. Likewise, a driver that is downloaded as an applet can only be allowed to access its home database. Of course, applets and drivers can get around these limitations by convincing the Java loader that they are trustworthy;
URL based naming scheme: jdbc:<subprotocol><domainname>. For example, the URL to access “MyJavaDB” via a JDBC-to-ODBC bridge might look like this:
Jdbc:odbc://www.bob.com/MyJavaDB
In this example, the subprotocol is “odbc” and the hostname is www.bob.com”. You can also use this scheme to provide a level of indirection in database names. You do this specifying a naming service as the subprotocol. Here’s an example of a URL that does this:
Jdbc:dcenaming:MyJavaDB
Unlike ODBC, JDBC must pay close attention to mobile code issues. For example, a JDBC driver must prevent an untrusted applet from accessing databases outside its home machine- meaning the machine from which the applet originates. Likewise, a driver that is downloaded as an applet can only be allowed to access its home database. Of course, applets and drivers can get around these limitations by convincing the Java loader that they are trustworthy;
URL based naming scheme: jdbc:<subprotocol><domainname>. For example, the URL to access “MyJavaDB” via a JDBC-to-ODBC bridge might look like this:
Jdbc:odbc://www.bob.com/MyJavaDB
In this example, the subprotocol is “odbc” and the hostname is www.bob.com”. You can also use this scheme to provide a level of indirection in database names. You do this specifying a naming service as the subprotocol. Here’s an example of a URL that does this:
Jdbc:dcenaming:MyJavaDB
In this example, the URL specifies that the DCE naming service is used to resolve the database name “MyJavaDB” into a global name that connects to the database. JDBC recommends that you provide a psuedo-driver that looks up names via a networked name server. It then uses the information to locate the real driver and pass it the connection information.