| Ron Mihu 2006-01-26, 4:53 pm |
| Ok,
I am really new at this and am having some issues and not sure where to
start. Here is what I am seeing.
I connect to sql server 2005 just fine.
So I try and load some tables. If the database is empty, it loads.
If there is already a row there, I catch the exception (Violation of PRIMARY
KEY constraint 'PK_tte_summary_inde
x'. Cannot insert duplicate key in object
'dbo. tte_summary_index'),
try and reuse the same connection to run a stored
proc to delete the record. When I do this I get:
com.microsoft.sqlserver.jdbc.SQLServerException: Server failed to resume the
transaction, desc: 3a00000001. I went ahead and used logger to catch all
the events.
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
<date>2006-01-25T08:42:48</date>
<millis>1138203768776</millis>
<sequence>0</sequence>
<logger>com.microsoft.sqlserver.jdbc.SQLServerStatement</logger>
<level>FINE</level>
<class>com.microsoft.sqlserver.jdbc.SQLServerStatement</class>
<method><init></method>
<thread>10</thread>
<message>Statement properties ID:0 Connection:1 Result type:1003 (2003)
Concurrency:1007 Fetchsize:128 bIsClosed:false
tdsVersion:com.microsoft.sqlserver.jdbc.TDSVersion@1f33675 bCp1252:false
lastUpdateCount:fals
e isServerSideCursor:f
alse</message>
</record>
<record>
<date>2006-01-25T08:42:48</date>
<millis>1138203768974</millis>
<sequence>1</sequence>
<logger>com.microsoft.sqlserver.jdbc.SQLServerException</logger>
<level>FINE</level>
<class>com.microsoft.sqlserver.jdbc.SQLServerException</class>
<method>logException</method>
<thread>10</thread>
<message>*** SQLException:[Thread[main,5,main], IO:f5897, Dbc:162d5]
com.microsoft.sqlserver.jdbc.SQLServerException: Violation of PRIMARY KEY
constraint 'PK_tte_summary_inde
x'. Cannot insert duplicate key in object
'dbo.tte_summary_index'. Msg 2627, Level 14, State 1, Violation of PRIMARY
KEY constraint 'PK_tte_summary_inde
x'. Cannot insert duplicate key in object
'dbo.tte_summary_index'.</message>
</record>
<record>
<date>2006-01-25T08:42:48</date>
<millis>1138203768976</millis>
<sequence>2</sequence>
<logger>com.microsoft.sqlserver.jdbc.SQLServerException</logger>
<level>FINE</level>
<class>com.microsoft.sqlserver.jdbc.SQLServerException</class>
<method>logException</method>
<thread>10</thread>
<message>*** SQLException:[Thread[main,5,main], IO:fb549, Dbc:162d5]
com.microsoft.sqlserver.jdbc.SQLServerException: Server failed to resume the
transaction, desc: 3a00000001. Msg 3971, Level 16, State 1, Server failed to
resume the transaction, desc: 3a00000001.</message>
</record>
</log>
What do I need to do to reuse the connection? If I close the connection, it
works, but to me that is a VERY Expensive price to pay to keep working. This
would work using the 2000 driver if I added 'SelectMethod=Cursor
' to the
connection string. I found where the name had changed to
'selectMethod-cursor' in the 2005 driver, but it doesn't work the same.
I Googled this problem without any luck. Isn't there anyone else having
this problem? Or, am I really missing the boat here?
Thanks,
Ron Mihu
public void loadCommonTables( Summary summary ) throws SQLException {
Connection con = ConnectionSingleton. getConnectionInstanc
e();
con. setAutoCommit(false)
;
/* Load the Index Table */
try {
TTESummaryIndex.store( summary );
} catch (SQLException reload) {
if ( reload.getMessage().contains("Violation of PRIMARY KEY
constraint 'PK_tte_summary_inde
x'. Cannot insert duplicate key in object
'dbo.tte_summary_index'")) {
System.out.println("Record already exists. Will reload due
to Violation of PRIMARY KEY constraint 'PK_tte_summary_inde
x'.");
// con.rollback();
// con.close();
remove();
System.out.println("Reset Complete: Retry Insert of Record.");
if ( con.isClosed()) {
System.out.println("The connection is Closed.");
}
TTESummaryIndex.store( summary );
} else {
System.out.println("Database Error: " + reload.getMessage());
System.out.println("Record already exists. Will reload.");
remove();
con.commit();
System.out.println("Reset Complete: Retry Insert of Record.");
TTESummaryIndex.store( summary );
}
}
/* Load the Product Table */
TTESummaryProduct.store( summary );
/* Load the Product2 Table */
TTESummaryProduct2.store( summary );
/* Load the Reticle Table */
TTESummaryReticle.store( summary );
/* Load the Fab Special Work Request Table */
TTESummaryFabSpecial
WorkRequest.store( summary );
/* Load the Verticle Table */
TTESummaryVerticle.store( summary );
/* Load the Output Lot Reference Table */
TTESummaryOutputLotR
ef.store( summary );
/* Load the Excursion Table */
TTESummaryExcursion.store( summary );
}
|