cancel
Showing results for 
Search instead for 
Did you mean: 

ObjectIsClosedException: SAP DBTech JDBC: Object is closed

Former Member
0 Kudos

Hi everybody,

i try to insert data via jdbc in a loop (a Thread) with a PreparedStatement.

the first insertion is successful - but all following inserts are not because of

ObjectIsClosedException (see jdbc-traces)

I do not close the PrepearedStatement or the Connection.

What is the cause of the "[T166].close()" (see trace #2) ???

the Problem is with a call DBROC ({call INSERTEVENTENTRY(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}, too!!

Thanks for your help!

Matthias

(MaxDB is running on SuSE Linux 11.1)

JDBC-Trace: #1

===========================

ClassLoader: sun.misc.Launcher$AppClassLoader at 1a16869

package com.sap.dbtech.jdbc, MaxDB JDBC Driver, SAP AG, 7.6.06 Build 002-000-008-537 (Make-Version: 7.7.06 Build 009-121-202-944) on Java 1.6.0_10

-

-


Thread a8c488 main Timestamp: 2009-05-15 13:06:58.792

new Connection 'jdbc:sapdb://xxxxxxxxxxEVENTDB'

user=eventhist

password=***

connectiontrace=/home/ighjhgj/workspace/EventLogger/jd...

Reject GSS Authentication - password is not empty

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000]

-

-


Thread 1431340 Thread-3 Timestamp: 2009-05-15 13:07:41.02

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setTimestamp (1, 2009-05-15 12:39:12.175)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setShort (2, 2)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setShort (3, 0)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setShort (4, -1)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (5, Biologie 2)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (6, 01GD61)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (7, aus)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (8, Nährstoffpumpe Gaswäsche)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (9, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (10, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (11, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (12, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (13, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].setString (14, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[T141][ParseID 000002440000090154000000].executeUpdate ()

new RTEException: -708 Timeout

whereAmIjava.lang.Throwable

at com.sap.dbtech.util.Tracer.whereAmI(Tracer.java:328)

at com.sap.dbtech.rte.comm.RTEException. 0

com.sap.dbtech.jdbc.ConnectionSapDB at 166aa18[T142].commit ()

com.sap.dbtech.jdbc.ConnectionSapDB at 166aa18[T142].close ()

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setTimestamp (1, 2009-05-15 13:07:35.886)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setShort (2, 1)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setShort (3, 1)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setShort (4, 1)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setString (5, Biologie 2)

<-!

Timestamp: 2009-05-15 13:07:41.111com.sap.dbtech.jdbc.exceptions.ObjectIsClosedException: SAP DBTech JDBC: Object is closed.

at com.sap.dbtech.jdbc.ConnectionItem.assertOpen(ConnectionItem.java:53)

at com.sap.dbtech.jdbc.CallableStatementSapDB.setString(CallableStatementSapDB.java:2191)

at com.sap.dbtech.jdbc.trace.log.PreparedStatement.setString(PreparedStatement.java:704)

at com.sap.dbtech.jdbc.trace.PreparedStatement.setString(PreparedStatement.java:336)

at de.pkv.eventlogger.handler.EventLogEntryDAO.insertEventLogEntry(EventLogEntryDAO.java:141)

at de.pkv.eventlogger.handler.DBhistoryOutputHandler.run(DBhistoryOutputHandler.java:50)

at java.lang.Thread.run(Thread.java:619)

com.sap.dbtech.jdbc.ConnectionSapDB at 166aa18.close ()

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setTimestamp (1, 2009-05-15 13:07:36.046)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setShort (2, 2)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setShort (3, 0)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setShort (4, -1)

com.sap.dbtech.jdbc.CallableStatementSapDB at 17ce4e7[closed][ParseID 000002450000060154000000].setString (5, Biologie 2)

<-!

Timestamp: 2009-05-15 13:07:41.119com.sap.dbtech.jdbc.exceptions.ObjectIsClosedException: SAP DBTech JDBC: Object is closed.

at com.sap.dbtech.jdbc.ConnectionItem.assertOpen(ConnectionItem.java:53)

at com.sap.dbtech.jdbc.CallableStatementSapDB.setString(CallableStatementSapDB.java:2191)

at com.sap.dbtech.jdbc.trace.log.PreparedStatement.setString(PreparedStatement.java:704)

at com.sap.dbtech.jdbc.trace.PreparedStatement.setString(PreparedStatement.java:336)

at de.pkv.eventlogger.handler.EventLogEntryDAO.insertEventLogEntry(EventLogEntryDAO.java:141)

at de.pkv.eventlogger.handler.DBhistoryOutputHandler.run(DBhistoryOutputHandler.java:50)

at java.lang.Thread.run(Thread.java:619)

JDBC-Trace: #2

===========================

ClassLoader: sun.misc.Launcher$AppClassLoader at 1a16869

package com.sap.dbtech.jdbc, MaxDB JDBC Driver, SAP AG, 7.6.06 Build 002-000-008-537 (Make-Version: 7.7.06 Build 009-121-202-944) on Java 1.6.0_10

-

-


Thread a8c488 main Timestamp: 2009-05-15 22:48:58.594

new Connection 'jdbc:sapdb://xxxxxxx/EVENTDB'

user=eventhist

password=***

connectiontrace=/home/mlbbl/workspace/EventLogger/jd...

Reject GSS Authentication - password is not empty

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00]

-

-


Thread e45076 Thread-3 Timestamp: 2009-05-15 22:49:15.555

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setTimestamp (1, 2009-05-15 22:48:26.031)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setShort (2, 6)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setShort (3, 0)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setShort (4, -1)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (5, KM2 Konstt)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (6, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (7, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (8, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (9, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (10, KM2)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (11, DCT1_XDC8:0)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (12, S24VD20.ACK)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (13, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].setString (14, null)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[T166][ParseID 0000026800000a0212003c00].execute ()

=> false

com.sap.dbtech.jdbc.ConnectionSapDB at 166aa18[T166].close ()

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[closed][ParseID 0000026800000a0212003c00].setTimestamp (1, 2009-05-15 22:48:26.021)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[closed][ParseID 0000026800000a0212003c00].setShort (2, 1)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[closed][ParseID 0000026800000a0212003c00].setShort (3, 1)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[closed][ParseID 0000026800000a0212003c00].setShort (4, 1)

com.sap.dbtech.jdbc.CallableStatementSapDB at 1c0e45a[closed][ParseID 0000026800000a0212003c00].setString (5, KM2 Konstt)

<-!

Timestamp: 2009-05-15 22:49:15.692com.sap.dbtech.jdbc.exceptions.ObjectIsClosedException: SAP DBTech JDBC: Object is closed.

at com.sap.dbtech.jdbc.ConnectionItem.assertOpen(ConnectionItem.java:53)

at com.sap.dbtech.jdbc.CallableStatementSapDB.setString(CallableStatementSapDB.java:2191)

at com.sap.dbtech.jdbc.trace.log.CallableStatement.setString(CallableStatement.java:2888)

at com.sap.dbtech.jdbc.trace.CallableStatement.setString(CallableStatement.java:1050)

at de.pkv.eventlogger.handler.EventLogEntryDAO.callInsertEventLogEntry(EventLogEntryDAO.java:150)

at de.pkv.eventlogger.handler.DBhistoryOutputHandler.run(DBhistoryOutputHandler.java:52)

at java.lang.Thread.run(Thread.java:619)

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

Hi Matthias,

just a guess for now ... have you connected to the database with a session where autocommit is enabled?

regards,

Lars

Former Member
0 Kudos

Hi Lars,

autocommit is ON, because the first insert is successful - but the second, third is not.

and there is no commit() done in the program.

from the docs, autocommit is ON by default. Do i have it to switch on in DatabaseURL?

What could be the cause of [T166].close() in the CallableStatement?

best regards

Matthias

Former Member
0 Kudos

found the cause in my program-logic.

thank you for help and sorry wasting your time.

Matthias

lbreddemann
Active Contributor
0 Kudos

Hi Matthias,

glad to hear you fixed it.

Maybe you want to share the problem and your solution so that others can learn from that?

regards,

Lars

Former Member
0 Kudos

it was the wrong place for a finally-statement in run()-Method:

-


public void run() {

while (true) { // do forever

try {

entry = this.theQueue.take(); // wait, if empty

if (DEBUG) System.out.println(name + ": try to take from queue: " + entry);

if (DEBUG) System.out.println(name + ": EventLogEntry: " + entry.toString());

// do the work: insert into Database:

success = dao.insertEventLogEntry(entry); // insert new Entry (Prep.Statement)

//success = dao.callInsertEventLogEntry(entry); // insert new Entry (call db_proc)

if (DEBUG) System.out.println(name + ": Insert new LogEntry. Success: " + success);

// Thread.sleep(10);

//Thread.yield();

} catch (InterruptedException e) {

System.err.println(name + ": Error in Thread.sleep()");

e.printStackTrace();

} catch (Exception e) {

System.err.println(name + ": Error: " + e.getMessage());

} // catch

// finally {

// if (con != null) {

// try {

// con.close();

// } catch (SQLException e) {

// // TODO Auto-generated catch block

// e.printStackTrace();

// }

// } // if con

// } // finally

} // while

} // run

-


regards

Matthias