找不到main方法?
为什么找不到main方法
为什么找不到main方法
2019-04-17
package com.test.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class DButil {
private static final String url="jdbc:mysql://localhost:3306/WMS";
private static final String user="root";
private static final String password="000000";
public static void main(String[] args) throws Exception{
//加载驱动
Class.forName("com.mysql.jdbc.Driver");
//获得数据库连接
Connection conn = DriverManager.getConnection(url, user, password);
//操作
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery("select name,password from user");
while(rs.next()){
System.out.println(rs.getString("name")+","+rs.getInt("password"));
}
}
}
举报