Using the Server-Side Internal Driver

As with the client-side drivers, when using the server-side internal driver you need to formulate an appropriate database URL for use with the DriverManager.getConnection( ) method. With the server-side internal driver you have two choices for a URL:

jdbc:oracle:kprb:
jdbc:default:connection:

Warning

The last colon characters on these URLs are necessary only if you want them to work. I say this because I spent several nights unsuccessfully trying to make either of these URLs work. The documentation I was reading showed them used without and with the colon. My preference was to leave off the colon, hence my troubles. When I finally broke down and used the colon on the end, the URLs worked. So, as I say: the last colons on these URLs are necessary only if you want them to work.

I recommend you use jdbc:oracle:kprb: as the database URL when connecting through the server-side internal driver. It has the same basic format as the rest of the URLs we’ve used so far, and you can use it with any form of the getConnection( ) method.

When you invoke getConnection( ) to connect through the server-side internal driver, any unneeded parameters will be ignored. For example, if you pass a username and password, they are simply ignored, because you are using a default connection. This default connection was created when you connected to the database to invoke your stored Java program. This means you can take a Java program you’ve written to load data into Oracle, ...

Get Java Programming with Oracle JDBC now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.