问答详情
源自:-

运行出错 找不出来问题

package User;


import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.Statement;


public class db {


private static final String URL="JDBC:mysql://127.0.0.1:3306/testone";

private static final String USER="root";

private static final String PASSWORD="";

public static void main(String[] args) throws Exception{

//加载驱动

Class.forName("com.mysql.jdbc.Driver");

   //获得数据链接

Connection conn=DriverManager.getConnection(URL, USER, PASSWORD);

//实现增删改查

Statement stmt=conn.createStatement();

ResultSet rs=stmt.executeQuery("select username from use");

while(rs.next()){

System.out.println(rs.getInt("name"));


}

}


提问者:qq_狠乖很乖_0 2016-10-12 13:33

个回答