Mail Archive Home | enhydra List | April 2005 Index
| <-- Date Index --> | <-- Thread Index --> |
Hi Mike,
yes, i can successfully perform SQL queries. Here's the code:
Class.forName("com.sap.dbtech.jdbc.DriverSapDB");
String url = "jdbc:sapdb://pchrz-trinity/HRZSHOP";
Connection con = DriverManager.getConnection(url, user, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT COUNT(*) ANZAHL FROM BENUTZER");
while (rs.next()) {
int anzahl = rs.getInt("ANZAHL");
java.lang.System.out.println("*** ANZAHL: " + anzahl + " ***");
}
System.out.println(con.isClosed());
But, when first check the connection, like this:
Class.forName("com.sap.dbtech.jdbc.DriverSapDB");
String url = "jdbc:sapdb://pchrz-trinity/HRZSHOP";
Connection con = DriverManager.getConnection(url, user, password);
System.out.println(con.isClosed());
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT COUNT(*) ANZAHL FROM BENUTZER");
while (rs.next()) {
int anzahl = rs.getInt("ANZAHL");
java.lang.System.out.println("*** ANZAHL: " + anzahl + " ***");
}
an exception is thrown.
com.sap.dbtech.jdbc.exceptions.ObjectIsClosedException: SAP DBTech JDBC:
Object is closed.
at
com.sap.dbtech.jdbc.ConnectionSapDB.assertOpen(ConnectionSapDB.java:106)
at
com.sap.dbtech.jdbc.ConnectionSapDB.createStatement(ConnectionSapDB.java:192)
seems to be a driver problem.
Thomas
yes, i can successfully perform SQL queries, when I check
Am Donnerstag, 14. April 2005 20:37 schrieben Sie:
> Hi Thomas,
> It definitely looks like something's going wrong in the driver - the
> connection should not be returning true from isClosed() unless the
> connection isn't open. Are you sure that the connection is actually open?
> Most drivers throw an exception if the connect attempt fails, but maybe
> that particular driver isn't doing that in some cases (it could be that the
> connection is getting opened and then getting immediately closed). Can you
> actually perform SQL queries in your test code, even though the Connection
> object is returning true from isClosed()? I expect you it would get an
> error of some kind, one that might give a clue to the cause of the problem.
>
> Mike.
>
> ----- Original Message -----
> From: "Thomas Schwarzpaul" <Thomas.Schwarzpaul@xxxxxxxxxxxxxxxxxxx>
> To: <enhydra@xxxxxxxxxxxxx>
> Sent: Thursday, April 14, 2005 5:19 AM
> Subject: Re: [enhydra] database connection problem
>
>
> Hi Mike,
>
> thanks for your answer.
>
> > What does the Connection object returned from your JDBC driver return
> > from the isClosed() method?
>
> The Connection object returns "true".
>
> > From a quick glance at the DODS source, the
> > "Inactiv connection closed due allocate() operation. Geting new one."
> > debug
> > message only appears if an existing connection returns true from
> > isClosed() - which is intended to detect a connection that the database
> > has
> > closed (e.g. due to a maximum idle time enforced for a connection).
>
> Didn't think about that.
>
> > Since
> > you're presumably getting this all the time, and I don't recognize your
> > JDBC driver, so I'm wondering if the driver hasn't implemented the
> > isClosed() method properly, and might be unconditionally returning true
> > from the isClosed() method.
>
> I'm using SAPDB with their latest version of the JDBC driver.
>
> Best regards,
> Thomas
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------------
>-----
>
> > --
> > You receive this message as a subscriber of the enhydra@xxxxxxxxxxxxx
> > mailing list.
> > To unsubscribe: mailto:enhydra-unsubscribe@xxxxxxxxxxxxx
> > For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
> > ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.