2013-03-22 79 views
0

當我使用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。

+0

Sybase錯誤。我已經打開了一個案例@ Sybase! :) – 2013-04-17 10:22:26

回答

0

Sybase錯誤消息不是特定的,但問題與數據包大小有關。 在ASE中,它是8192,IQ中只有2048.

它在數據包超過2k時產生錯誤。

+0

這不提供問題的答案。要批評或要求作者澄清,請在其帖子下方留言。 – 2013-04-17 10:09:25

+0

羅傑那!我會發布更多的信息,並在案件解決時回覆 – 2013-04-17 10:21:20

+0

@RomanC回答現在是正確的,我希望.. – 2013-05-21 11:16:54