dorothy1028661
2017-03-27 10:25
private static final String URL = "jdbc:mysql://localhost:3306/imooc";
private static final String USER = "root";
private static final String PASSWORD = "root";
public static void main(String[] args) throws Exception {
//1、加载驱动程序
Class.forName("com.mysql.jdbc.Driver");
//2、获得数据库的连接
Connection conn = DriverManager.getConnection(URL, USER, PASSWORD);
//3、通过数据库的连接操作数据库,实现增删改查
Statement stmt = conn.createStatement();
ResultSet res = stmt.executeQuery("select user_name, age from imooc_goddess");
while (res.next()) {
System.out.println(res.getString("user_name") + "," + res.getInt("age"));
}
}
哪位大神帮我看看这是为什么呀?不是build path的问题,那个已经配置好了,难道是因为我用的是workbench???
应该是包没倒号,我也用的workbench没事,倒包记得倒压缩包下的jar文件
JDBC之 “ 对岸的女孩看过来”
99334 学习 · 916 问题
相似问题