What i cannot connect to mysql from my jsp?
<p>i cannot connect to database from my jsp. Code is below</p>

<pre><code>  &lt;% 
        try {
        /* Create string of connection url within specified format with machine name, 
        port number and database name. Here machine name id localhost and 
        database name is usermaster. */ 
        String connectionURL = "jdbc:mysql://localhost:3306/test"; 

        // declare a connection by using Connection interface 
        Connection connection = null; 

        // Load JBBC driver "com.mysql.jdbc.Driver" 
        Class.forName("com.mysql.jdbc.Driver").newInstance(); 

        /* Create a connection by using getConnection() method that takes parameters of 
        string type connection url, user name and password to connect to database. */ 
        connection = DriverManager.getConnection(connectionURL, "root", "pass");

        // check weather connection is established or not by isClosed() method 
        if(!connection.isClosed())
        %&gt;
        &lt;font size="+3" color="green"&gt;&lt;/b&gt;
        &lt;% 
        out.println("Successfully connected to " + "MySQL server using TCP/IP...");
        connection.close();
        }
        catch(Exception ex){
        %&gt;
        &lt;/font&gt;
        &lt;font size="+3" color="red"&gt;&lt;/b&gt;
        &lt;%
        out.println("Unable to connect to database.");
        }
        %&gt;
</code></pre>

<p>I connected to database and event search queries what might be the problem? I simply c/p from a source and put my jsp. Password and username is true.</p>
