0

I create a mysql connection with the following lines successfully

Factory Session Code

val session = Session.create(
                  DriverManager.getConnection(url, user, pass),
                  new CustomMySqlAdapter
              )

I am using Intellij Ultimate IDEA's Tomcat server. The build configuration creates a war and deploys to my local tomcat perfectly. After a certain amount of time, about 10 minutes, the connection drops and never recovers. As I debug, this line craps out and throws

Exception Thrown

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 5 times. Giving up.

It seems to be DriverManager.getConnection(url, user, pass) even though those variables haven't changed since the last successful connection. How can I trouble shoot this? Is this a space issue? Even after this error is thrown the server is still running without successfully connecting to the database. It is simply barfing this line again and again.

I can still connect locally to mysql via command line. I killed all the open connection with not avail. While running a memory profile tool, it seems that PermGen is maxing out.

PermGen Stats

Size: 70,844,416 B
Used: 70,674,400 B
Max: 1,073,741,824 B

Can I up PermGem in intellij to solve this? If so, how?

Victor 'Chris' Cabral
  • 2,135
  • 1
  • 16
  • 33
  • Please post the full stack trace. PermGen usage does not seem to be the issue. Once the JVM allocates PermGen it never releases it, so it tries to be conservative about what it uses. The `Size` value is what the JVM is currently using but the `Max` value indicates that more PermGen can be allocated if necessary. – Dave Whittaker Nov 26 '13 at 22:32

3 Answers3

0

May it be that a connection limit to the database was reached?

VasiliNovikov
  • 9,681
  • 4
  • 44
  • 62
0

I don't know why you would get that specific message, but given that you can initially connect, and the amount of time that goes by before you experience the problem, your MySQL connection may be timing out. Try appending ?autoReconnect=true to your JDBC URL and see if that resolves the issue.

Dave Whittaker
  • 3,102
  • 13
  • 14
0

Despite where the evidence pointed, the issue was a hard drive space issue.

I backed up my database. Stopped mysql. I deleted ibdata1 file. Restarted my computer. Reimporting my database.

Hope this helps someone else.

Victor 'Chris' Cabral
  • 2,135
  • 1
  • 16
  • 33