package agenda;
import java.io.*;
import java.sql.*;
public class newLogin {
public static Connection conn;
public static ResultSet rs;
public static Statement stmt;
public static void update() throws IOException{
BufferedReader reader = new BufferedReader( new InputStreamReader(System.in));
System.out.print("游戏开始");
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
e.toString();
}
String url = "jdbc:odbc:bank";
try{
Connection con = DriverManager.getConnection(url);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT*FROM account where username = '?'");
while(rs.next()){
String username = reader.readLine();
username = rs.getString("username").trim();
System.out.println("\n\t" + username);
}
}catch(SQLException e){
System.out.println("\n 啥?connect db error:" +e.getMessage() + "\n");
}
finally{
try{
if(conn != null){
rs.close();
stmt.close();
conn.close();
}
}catch(SQLException e){
System.out.println("\n" + e.getMessage() + "最后这是?\n");
}
}
}
}
以上是我自己弄得一个东西,完全没反应。