Hello
Use following code(2) connect to mysql,and I have get excepted
date,but there is an error(1),can anybody tell me why?thank you.
(1)error
[ERROR] Line 30: The method forName(String) is undefined for the type Class
(2)connection code
public static Connection getConnection()
{
System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "Test";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "pwdpwd";
try
{
Class.forName(driver).newInstance();
conn = DriverManager
.getConnection(url + dbName, userName, password);
System.out.println("Connected to the database");
// conn.close();
// System.out.println("Disconnected from database");
} catch (Exception e)
{
e.printStackTrace();
}
return conn;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---