4/30/09

Type 4 Connection in MySQL

Connection Class for My SQL ( With Type 4 Connection )
---------------------------------------------------------


public class Conn {

java.sql.Connection con;

public Conn()
{
try{


Class.forName("com.mysql.jdbc.Driver");

String connectionUrl="jdbc:mysql://localhost/[database name]?user=root&password=123";

con=java.sql.DriverManager.getConnection(connectionUrl);

}
catch(Exception ex){javax.swing.JOptionPane.showMessageDialog(null, ex.toString());}
}

No comments:

Post a Comment