package test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.text.StyleContext.SmallAttributeSet;
import com.mysql.*;
public class jdb {
private static final String URL="jdbc:mysql://127.0.0.1:3306/test";
private static final String USER="root";
private static final String PASSWORD="root";
public static void main(String[] args) throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection con= DriverManager.getConnection(URL,USER,PASSWORD);
Statement stam = con.createStatement();
ResultSet rs = stam.executeQuery("name");
while(rs.next()){
System.out.println(rs.getString("name"));
}
}
}提示找不到main方法求指教
添加回答
举报
0/150
提交
取消