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方法求指教
小城阿哥
子木李
相关分类