This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
IllegalArgumentException when closing PreparedStatement
Joe Kidd
Greenhorn
Joined: Apr 12, 2009
Posts: 6
posted
0
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
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
Joined: Apr 12, 2009
Posts: 6
posted
0
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:
I hope this helps anyone who ran into a similar problem.
TestConfig testConfig
Greenhorn
Joined: Feb 16, 2012
Posts: 3
posted
0
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.