• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IllegalArgumentException when closing PreparedStatement

 
Joe Kidd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following method is from a User bean. The method is used to verify login information by comparing information entered by a user against a MySQL database.


Why would closing a PreparedStatement cause an exception to be thrown? The program runs fine if stmt.close(); is commented out... So, closing the ResultSet is fine, as is closing the Connection, but not the PreparedStatement

Here's the exception:
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Driver bug? I don't know what else could cause that - it's very odd.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google the stacktrace. You'll land at a MySQL bug page.
 
Joe Kidd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bauke Scholtz wrote:Google the stacktrace. You'll land at a MySQL bug page.

I have, I searched for a while before I posted. The reason I ended up posting the question is because the MySQL bug you mentioned (http://bugs.mysql.com/bug.php?id=37645) was submitted back in 2008 (I just installed Netbeans 6.5.1 with Glassfish 2.1). There's another: http://bugs.mysql.com/bug.php?id=38699 that says there is a working fix. I just wanted to see if I was doing something wrong in my code, which I guess isn't the case.
Any idea how I could use the new version of MySQL Connector in Glassfish 2.1? Where should I put the .jar file and how do I make the server use it?
 
Joe Kidd
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I figured out how to "fix" this problem. The idea is to setup the connection pool and the resource through NetBeans (I'm using 6.5.1) as opposed to through the Glassfish (2.1) admin console. There's a very nice tutorial that explains how to do this on the NetBeans website:

http://www.netbeans.org/kb/60/web/mysql-webapp.html#settingUpConnPool

I hope this helps anyone who ran into a similar problem.
 
TestConfig testConfig
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I know this is a old post,I was also getting the above exception while closing the PreparedStatement.
Inorder to fix that problem I updated latest Mysql jar in the Glassfish server.
As said by Jeanne Boyarsky.

Hope this helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic