O'Reilly logo

Java Programming with Oracle JDBC by Donald Bales

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required