當我使用jConnect它給了我下面的錯誤做一個插在一個偏僻的tabke:錯誤插入使用jConnect
Unexpected exception : java.sql.SQLException: This transaction has been rolled back, rather than only the current statement.
, sqlstate = ZZZZZjava.sql.SQLException: This transaction has been rolled back, rather than only the current statement.
at com.sybase.jdbc4.jdbc.SybConnection.getAllExceptions(SybConnection.java:2780)
at com.sybase.jdbc4.jdbc.SybStatement.handleSQLE(SybStatement.java:2665)
at com.sybase.jdbc4.jdbc.SybStatement.nextResult(SybStatement.java:295)
at com.sybase.jdbc4.jdbc.SybStatement.nextResult(SybStatement.java:272)
at com.sybase.jdbc4.jdbc.SybStatement.updateLoop(SybStatement.java:2515)
at com.sybase.jdbc4.jdbc.SybStatement.executeUpdate(SybStatement.java:2499)
at com.sybase.jdbc4.jdbc.SybStatement.executeUpdate(SybStatement.java:577)
at connectSybase.main(connectSybase.java:48)
你知道這可能是什麼?
這裏是我的全碼:
import java.io.*;
import java.sql.*;
public class connectSybase {
public static void main(String args[])
{
try
{
// jconn3 <-- do pessoal do OMS
//Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
// jconn4 <-- do servidor de OMS1_PAR_DEV_SQL
Class.forName("com.sybase.jdbc4.jdbc.SybDriver");
}
catch (ClassNotFoundException cnfe)
{
System.out.println("BUM!");
}
try
{
System.out.println("Any of the following may throw an SQLException.");
System.out.println("Opening a connection.");
Connection con = java.sql.DriverManager.getConnection
("----------------------------");
// more code to use connection ...
System.out.println("Creating a statement object.");
Statement stmt = con.createStatement();
System.out.println("Executing the query.");
ResultSet rs = stmt.executeQuery("Select top 10 * from OMS_DEV..SCRIBE_AR");
System.out.println("Process the result set.");
while (rs.next())
{
System.out.println("Fetched value " + rs.getString(1));
}
System.out.println("Executing the query.");
int result = stmt.executeUpdate("---------------");
System.out.println("Process the result set: " + result);
}
catch (SQLException sqe)
{
sqe.printStackTrace();
System.out.println("Unexpected exception : " +
sqe.toString() + ", sqlstate = " +
sqe.getSQLState());
System.exit(1);
}
System.exit(0);
}
}
我省略了插件和連接,但兩者的工作,因爲我得到的第一選擇(只插入失敗)的結果和插入也是正確的,因爲它使用isql或dbartisan。
Sybase錯誤。我已經打開了一個案例@ Sybase! :) – 2013-04-17 10:22:26