jdbc·¾¶ÉèÖÃÎÊÌ⣬ÄÇλÀÏ´ó°ï°ï棡
ÔÚlinuxÔÚÉèÖÃjdbcµÄ·¾¶£¬jdbcÊÇoracleµÄ£¬ORACLE_JDBC=/home/oracle/9i/jdbc/lib
export ORACLE_JDBC
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$ORACLE_JDBC/classes12.jar:$ORACLE_JDBC/nls_charset12.jar
²»ÖªµÀÕâÑù¶Ô²»¶Ô£¿ÎÒÔÚwindowÏÂÃæµÄÒ»¸öjava³ÌÐòÄÜÖ´ÐУ¬µ«Êǵ½ÁËLINUXϾͲ»ÄÜÖ´ÐÐÁË£¿
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:346)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at CreateCoffees.main(CreateCoffees.java:33)
´íÎóÊÇÕâ¸ö£¿ÄÇλºÃÐĵÄÀÏ´ó°ïÎÒ¿´Ò»Ï£¬Ð¡µÜÔÚÕâÀïлÁË£¡ ÔΣ¬Ã»ÓÐÈËÀ´¿´¿´£¡Ò»¸öÒ²²»»áÂ𣿠I haven't worked with Oracle.
From the exception message, oracle jdbc driver need a native library to finish the work, but jvm can't load it(also can't find it). The name of this native library may be "libocijdbc9.so" (from here, no "ocijdbc9" in java.library.path). If you find this file (it may in $ORACLE_JDBC), try to add the directory containing the library into "LD_LIBRARY_PATH" (export LD_LIBRARY_PATH=some_path) or add this option to "java" command line "-Djava.library.path=some_path".
Good Luck :) ÀÏ´ó£¬ÄãÊÇÑóÈË£¿À´ÁËÕâôһ¶ÎÓ¢ÎÄ£¿ ллÕâ¸öλÀÏ´óµÄÌáÐÑ£¬ÎÒÍüÒ»¸ö»ù±¾µÄÎÊÌ⣬ÓÃJDBCÊÇÒªÔÚÄÜÓÃSQLPLUSÃüÁîµÄÓû§ÏÂÃæÖ´Ðеģ¬Ò²¾ÍÊÇÒªORACLE¿Í»§¶ËµÄ¡£ÏÖÔÚÖ´Ðгɹ¦ÀºÇºÇ¡£ I'm real Chinese :) Just lazy to switch into Chinese input mode that time and now. You have really run it . but it don't run as you like, Äã¿´Çå³þÁËûÓÐ?????????????
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)
at oracle.jdbc.driver.OracleConnection.(OracleConnection.java:346)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
at CreateCoffees.main(CreateCoffees.java:33)
Õâ¶ÎÊÇʲôÒâ˼¡£?????????
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
ÕâÊÇ˵£¬ÔËÐиóÌÐòʱ£¬³öÏÖÁËÒì³£¡£ ²é¿´ÄãµÄÊý¾Ý¿âÉèÖá£ÎÒÖªµÀµÄ¾ÍÔõô¶à¡£ÎÒûÓÐÔÚLinuxÏÂÍæ¹ýÊý¾Ý¿â¡£
Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
(ÔÚÖ´ÐÐmainʱ£¬³öÏÖδָ¶¨Á´½ÓµÄ´íÎó: ÔÚJava.library.pathûÓÐ ocijdbc9==ÔÚÖ¸¶¨µÄ·¾¶Ï£¬ÕÒ²»µ½ocijdbc9)
¿ÉÄÜÊÇÄãµÄÊý¾Ý·¾¶Ã»ÓÐÉèÖú᣻òÕßÊÇ£¬Java³ÌÐòÁ´½ÓÓï¾äÔÚLinuxûÓÐ×öÏàÓ¦µÄ¸ü¸Ä¡£ Ó¢ÓҲÊǺÜÖØÒªµÄ¡£ºÇºÇ
Ò³:
[1]