Go to Connector Page
And put the jar file inside this directory "jre/lib/ext". Should be around your java installation folder.
And with a help of this simple java snippet,
Connection conn = null;
try
{
String url = "jdbc:mysql://localhost/databasename?user=username&password=yourpassword";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection (url);
}
catch (SQLException se)
{
System.out.println(se);
}
catch (Exception ex)
{
System.out.println(ex);
}
Your java applications can now connect to MySQL servers.
No comments:
Post a Comment