Quote:
Originally Posted by ruzdi
Hi Friends,
Can you please tell me the procedure of java and mysql connection using jdbc driver . Please help me.
|
Hi,ruzdi
this code will definately help you,
import="java.sql.*"
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabase?","root","root");
Statement st=conn.createStatement();
// your code goes here...
//close try block
conn.close();
}catch(Exception e){
System.out.println("error"+e);
}
//3306 is default portnumber of mysql
//mydatabase is databasename in mysql
//root is username
//root is password
It will work 100%
Try it..
All the best..