java连不上mysql 在线等!!!!!!
public class ConnTest {
public static void main(String[] args) {
try {
String driver = "com.mysql.jdbc.Driver ";
String url = "jdbc:myql://localhost:3306/test ";
String user = "root ";
String password = "root ";
Connection conn = null;
ResultSet rs = null;
Statement stmt = null;
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url, user,password);
stmt = conn.createStatement();
rs = stmt.executeQuery( "select * from login_table ");
while (rs.next()) {
String name = rs.getString( "name ");
System.out.println( "name: "+name);
}
rs.close();
conn.close();
}
catch (Exception e) {