Re: how to connect Java Application to MySQL
Hi
I have tried the following statements to connect java with MySQL
try
{
String userName = "root";
String password = "root";
// by default MySQL runs on localhost
String url = "jdbc:mysql://localhost//"+database;
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection (url, userName, password);
System.out.println ("Database connection established");
}
catch(Exception e)
{
e.printStackTrace();
}
it is working for me without any error.
Thanks
Sella
Subject
Written By
Posted
December 22, 2005 07:40PM
December 22, 2005 08:35PM
Re: how to connect Java Application to MySQL
December 27, 2005 04:26AM
December 22, 2007 05:52AM
December 25, 2005 11:40AM
December 30, 2005 02:31AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.