File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes JDBC/ODBC Not Closing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC/ODBC Not Closing" Watch "JDBC/ODBC Not Closing" New topic
Author

JDBC/ODBC Not Closing

Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38
Hello,

I apologize for the vagueness of the error, but I wrote the using pure JDBC and it worked, fine. I changed the driver to JDBC/ODBC(needed to ) and created the necessary datasource. I am able to connect, query, get what I need accomplished, but then it just hangs on the Statement close. I have


The output that I coded in for testing looks like this:

Connecting...
Connected.
Creating query...
Running query...
Creating File...
Done Creating File.
Closing connections...
Rset Closing connections...
Rset Closed.
sql_stmt Closing connections...

For some reason I cannot close the Statement. I also tried not closing the Statement and closing the Connection with the standard con.close(); . This just hangs as well. I am not sure why the rset closes, but nothing else. Any ideas? The DB is Oracle RDB on VAX connecting from Windows XP Pro, using the oracle RDB datasource driver provided from oracle, oh and Java 1.4.2_08.

Thanks all,

Joe
[ December 27, 2005: Message edited by: Joe Schider ]

SCJP, SCJD(In Progress)<br /> <br />"They whom make no mistakes usually make nothing at all."
Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38
Sorry to bug you all with this problem, but I think this may be an issue with our DB. I ran simple queries with no problem. (Simple being, select * from one where one.a=3 As soon as I make a query which returns several (over 1000) rows the connection doesn't seem to close. I am wondering if this has something to do with the commit/rollback settings? Or, if I skip the close will the connections be closed when the app terminates? I believe they should, but not sure.

Thanks again,

Joe
[ December 27, 2005: Message edited by: Joe Schider ]
Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38
Hello,

Hopefully this helps someone out there and I'm not just talking to myself, but I set the Connection to con.setAutoCommit(false); and that seemed to allow for the large queries. Then I had to do a con.rollback(); just before closing the Connection and things seemed to work. That is just for reading, now on to writing .

Thanks,
Joe
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30068
    
149

Originally posted by Joe Schider:
I set the Connection to con.setAutoCommit(false); and that seemed to allow for the large queries.

Interesting!

Thanks for posting the solution for others who come across this.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
Originally posted by Joe Schider:
Hello,

Hopefully this helps someone out there and I'm not just talking to myself, but I set the Connection to con.setAutoCommit(false); and that seemed to allow for the large queries. Then I had to do a con.rollback(); just before closing the Connection and things seemed to work. That is just for reading, now on to writing .

Thanks,
Joe


That is very very very unnatural behavior; I've been using Oracle and the thin driver for 5 years and never had any problems at all like that. It's almost certainly some sort of incompatibility with the JDBC-ODBC bridge (which I suspect is not supported by Oracle).

By the way, I'm assuming it was some sort of political/business issue that forced you to use the brodge; I can't think of ANY good technical reason for it, though I won't clain to know everything...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC/ODBC Not Closing
 
Similar Threads
strange checkbox problem
newbie to both java and oracle.. how do i ...
JDBC Connection Pooling in Websphere
oracle statement caching in connection pool
Connecting To Database