文档详情

oralce与jdbc的连接.doc

发布:2017-08-11约8.4千字共5页下载文档
文本预览下载声明
Setting up Oracle JDBC Authors: Lichu Dang, Lixin Yu The steps to enable your Java program to talk to Oracle database: Install Oracle and make sure it is running ok. (ie. you can connect to Oracle by sqlplus) Download the JDBC driver from Oracle at the following url. /software/tech/java/sqlj_jdbc/content.html Typically, the JDBC driver file you should download is named class12.zip. If you want to know the details of the JDBC drivers on the Oracle site. Here is some info. JDBC drivers can be classified into 4 types, ranging from pure Java driver to thin Java/heavy native driver. The class12.zip driver we chosen is the pure Java type. And for different type, there are different drivers for different Oracle versions and JDK versions. Pick the one that match your environment. I assume we are using Java 2, so we should use the class12.zip driver. Put this class12.zip file to your Java classpath. You should know how to do this. If not, follow the steps: For Windows 2000 (Windows 9x or XP should be similar): save class12.zip to C:\sjsu\cs157a\jdbc right click My Computer, choose Properties, click Advanced tab, click Environment Variables button, choose the variable CLASSPATH in the User variables table, click Edit button in the variable value text field, append ;C:\sjsu\cs157a\jdbc\classes12.zip if CLASSPATH is not present in the table, click Add button and type CLASSPATH in the variable name and type C:\sjsu\cs157a\jdbc\classes12.zip in the variable value box. For Unix or Linux: save class12.zip to /usr/jdbc add the line setenv CLASSPATH $CLASSPATH:/usr/jdbc to your .login file. relogin to your shell Do a short simple test by issuing command in DOS or a shell: java oracle.jdbc.driver.OracleDriver You will get an error, but dont panic. If your error said: Exception in thread main java.lang.NoSuchMethodError: main Congradulation, you have setup JDBC driver correctly, despite what the error said. But if your error said: Exception in thread main j
显示全部
相似文档