यह Website Computer Science के Students के लिए बनाई गई है इस Website पर आपको computer science से Related Subject के video Tutorial और Notes हिंदी में मिलेगे


Prv Next

Programing in java 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);
                                                }
                }
}

 


.

Subscribe Our Website For Get Notification For New Update

Enter Name :
Enter E-Mail
Enter Mobile No
Enter City Name :