JDBC driver for Oracle 10G XE

2019-05-04 18:30发布

问题:

I have installed Oracle 10G XE. I want to connect to it using JDBC . Which driver should i use for it and from where can i download it ?

Thank You.

回答1:

On the machine you have installed the server, Oracle JDBC drivers are in ORACLE_HOME/jdbc/lib. Just put ojdbc14.jar on your classpath (ojdbc14_g.jar is the same as ojdbc14.jar, except that classes were compiled with "javac -g" and contain some tracing information).

EDIT: According to Oracle Database 10g Release 2 (10.2.0.4) JDBC Drivers, ojdbc14.jar contains classes for use with JDK 1.4 and 1.5 (and I don't see why it wouldn't work with a JDK 6, some features of JDBC 4.0 won't just be available).

Some newer drivers are available at Oracle Database 11g Release 2 JDBC Drivers but I don't really see the difference between ojdbc14.jar and ojdbc15.jar (except that ojdbc15.jar requires a JDK 5+): they are both JDBC 3.0 driver so I think it's just a matter of end of life support for ojbdc14.jar. If you want JDBC 4.0 support, you'll need ojdbc16.jar though. Have a look at the Oracle JDBC FAQ if you want more details.



回答2:

http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html

You generally want the latest JDBC drivers, they will work with older versions of the database as well. Or, to be on the safe side, match the JDBC version with your DB.



回答3:

According to this getting started guide you need the Oracle Express client which can be found here



回答4:

You want to choose a JDBC driver that matches both your version of Oracle and the JDK you're using. ojdbc14.jar is for JDK 1.4; there are newer versions for at least JDK 5 that I know of. I'm not sure if there's a JDBC driver for JDK 6. Use the best match to your situation that Oracle makes available.



标签: java oracle jdbc