I’m writing a database accessor in Java. The database is in Oracle 11g, of which I am absolutely not familiar, and I have JDK 1.6.
- Will ojdbc4.jar do for my program? We’re not allowed to connect to the Internet in the office and I can’t download ojdbc6.jar, which I’ve read is more compatible with my setup.
- What strings should I put in the Class.forName(String driver) and DriverManager.getConnection(String connectionURL)? I don’t know the driver string and the connection URL since they (naturally) look very different from the ones for MS SQL Server.
Oracle bundle the Jar with the Oracle client or server installation and can be found in
$ORACLE_HOME/jdbc/lib/ojdbc6.jar. I always use that one.The Driver classname is
oracle.jdbc.OracleDriverand the URL isjdbc:oracle:thin:@//[HOST][:PORT]/SERVICE.Here’s an example (taken from here):