Tuesday, 5 April 2011

Oracle JDBC Connection Properties

There are several things to remember when configuring an Oracle JDBC driver connection. Firstly, you need to specify the driver. The driver class is oracle.jdbc.driver.OracleDriver located in ojdbc14.jar or ojdbc14_g.jar (the debug version) archive files.

You also need to configure an appropriate Oracle url. This has the format:

jdbc:oracle:thin:@<hostname>:<port number>:<schema name>

for example:


In order for your Java application to connect to your Oracle database you need some code which’ll look a bit like this:

      try {
        con = DriverManager.getConnection
(url, userName, password);
} catch (SQLException e) {

No comments: