}

Sing Up

Java Tutorial e-Book In Hindi

Online e-Libreary C Language

How To Connnect java To Mysql Database

import java.sql.*;
class Database
{
       public static void main(String d[])
       {
             Connection con;
             PreparedStatement pst;
             ResultSet rs;
             try{
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
                   con=DriverManager.getConnection("jdbc:mysql://localhost/college","root","");
                   if(!con.isClosed())
                   {
                         System.out.println("Connect");
                   }
                   else
                   {
                         System.out.println("Not Connnect");
                   }
             }
             catch(Exception e)
             {
                   System.out.println(e);
             }
       }
}



Next Next