Hello List.
In my example (TestStatement) i have two columns (ID FIXED PRIMARY KEY, XXX
TIMESTAMP).
The table TEST contains 20000 rows.
One of our productive table contains 18000 rows but the TABLE have six
Fixed(13,0),
three TIMESTAMP,one DATE, two Varchar(32) ASCII, four Float and one Fixed
(2,0) fields and
five foreign keys.
If i run the example (TestStatment), it works fine, but
if i run the example with our prductive table, following exception was
thrown.
com.sap.dbtech.jdbc.exceptions.DatabaseException: [-3102]: Error
at
com.sap.dbtech.jdbc.packet.ReplyPacket.createException(ReplyPacket.java:69)
at
com.sap.dbtech.jdbc.ConnectionSapDB.throwSQLError(ConnectionSapDB.java:758)
at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:424)
at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:318)
at
com.sap.dbtech.jdbc.CallableStatementSapDB.execute(CallableStatementSapDB.ja
va:382)
at
com.sap.dbtech.jdbc.CallableStatementSapDB.execute(CallableStatementSapDB.ja
va:291)
at
com.sap.dbtech.jdbc.CallableStatementSapDB.executeUpdate(CallableStatementSa
pDB.java:697)
at TestStatement.main(TestStatement.java:68)
Can you explain me the behavior in both identical operations?
In both tests, i want only set a timestamp to null.
I use Driver version: package com.sap.dbtech.jdbc, SAP DB JDBC Driver, SAP
AG, 7.4.4 Build 001-000-156-754.
<----schnipp---->
public class TestStatement {
static String server = "xxxx.xxxxxxx.de";
static String db = "DB";
static String user = "USER";
static String password = "PASSWORD";
public static void main(String[] args) {
String url = "jdbc:sapdb://" + server + "/"+ db;
try {
Class.forName("com.sap.dbtech.jdbc.DriverSapDB");
Connection conn = DriverManager.getConnection(url, user, password);
conn.setAutoCommit(false);
// Driver information
DatabaseMetaData meta = conn.getMetaData();
System.out.println("Driver version: " + meta.getDriverVersion());
Timestamp timestamp = new
Timestamp(Calendar.getInstance().getTime().getTime());
int counter = 0;
PreparedStatement stmt = conn.prepareStatement("SELECT ID FROM TEST");
ResultSet result = stmt.executeQuery();
System.out.println("SELECT ALL ROWS FROM TEST\n");
Vector keys = new Vector();
while(result.next()){
keys.addElement(result.getObject(1));
}
stmt.close();
conn.commit();
counter = 0;
System.out.println("SELECT AND LOCK ALL ROWS");
stmt = conn.prepareStatement("SELECT * FROM TEST WHERE ID = ? WITH
LOCK (NOWAIT) EXCLUSIVE ISOLATION LEVEL 1");
for(int i = 0; i < keys.size(); i++){
BigDecimal key = (BigDecimal)keys.elementAt(i);
stmt.setInt(1, key.intValue());
stmt.execute();
counter++;
// if (counter % 5000 == 0)
// System.out.println("LOCKED ROWS: " + counter);
}
System.out.println("LOCKED ROWS: " + counter);
stmt.close();
counter = 0;
System.out.println("\nUPDATE ALL LOCKED ROWS");
stmt = conn.prepareStatement("UPDATE TEST SET XXX = NULL WHERE ID =
?");
for(int i = 0; i < keys.size(); i++){
BigDecimal key = (BigDecimal)keys.elementAt(i);
stmt.setInt(1, key.intValue());
stmt.executeUpdate();
counter++;
// if (counter % 5000 == 0)
// System.out.println("UPDATED ROWS: " + counter);
}
System.out.println("UPDATED ROWS: " + counter);
stmt.close();
conn.commit();
} catch (Throwable t){
t.printStackTrace();
}
}
}
<----schnapp---->
Best regards
Carsten Sprenger
____________________________________
MediaTransfer AG
Netresearch & Consulting
Rothenbaumchaussee 38, 20148 Hamburg
Tel: (040) 669 625 16
Fax: (040) 669 625 29
URL: http://b2b.mediatransfer.de
____________________________________
This email is printed with 100% recycled electrons.
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general