Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm using a jdbc connection to connect a vaadin application to a MySQL database. It works fine, but after a couple of uses it gets really slow, and even freezes the application to a point I have to restart the server.

Everything works fine in my local environment. It fails when I try to use it in an EC2 Linux server

This is the code I use to connect:

connectionProperties = new Properties();
    connectionProperties.put("user", "root");
    connectionProperties.put("password", dbPassword);
    try {   
        connectionPool = new SimpleJDBCConnectionPool(
                "com.mysql.jdbc.Driver",
                "jdbc:mysql://localhost:3306/" + dbName, "root", dbPassword, 2, 50);
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/" + dbName, connectionProperties);
        statement = connection.createStatement();

    } catch (SQLException e1) {
        e1.printStackTrace();
    }
    dbContainers = new DataBaseContainers();

Thanks in advance for any help you can give me!!!

share|improve this question

migrated from stackoverflow.com Jan 31 at 19:24

This question came from our site for professional and enthusiast programmers.

1  
Can you run SHOW FULL PROCESSLIST and see if any connections are sleeping, and how many connections are still open –  h . Jan 31 at 16:25
    
Thanks for your answer, but I'm still kinda lost here...Is there a Linux command to check the maximum Connections and change that number if needed? Is there a SQL command to clean up open connections that are not been used? –  user3258041 Jan 31 at 18:23
    
Sorry for the late reply. If you grab the process id, you can run KILL <processid> to kill/end it. To set the maximum connections see here. It may be worth while to clean your system and close connections after you're done with them - or set a persistent connection. –  hd. Feb 3 at 10:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.