我想連接遠程Oracle數據庫,但我有異常。請幫幫我。 我能做什麼?從Java連接到Oracle ...異常
我試過,但它不工作:
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection(
"jdbc:oracle:thin:@*****:1521/******", "*********",
"********");
Statement st = con.createStatement();
con.close();
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
四處錯誤:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at oracle.sql.converter.CharacterSetMetaData$JdbcCharacterSetMetaData.isFixedWidth(CharacterSetMetaData.java:1292)
at oracle.sql.converter.CharacterSetMetaData.getRatio(CharacterSetMetaData.java:1230)
at oracle.jdbc.driver.DBConversion.init(DBConversion.java:159)
at oracle.jdbc.driver.DBConversion.<init>(DBConversion.java:112)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1075)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
嘗試發佈您的所有代碼 – Abdelhak
Connection con = DriverManager.getConnection( 「jdbc:oracle:thin:@ *****:1521:******」,「******* **「, 」********「); ................刪除「/」並放入「:」 –
您正在使用哪種版本的Oracle JDBC驅動程序,以及您連接的是哪個版本的Oracle? –