Connection conn = null;
String url="",QueryStr="";
Statement stmt = null;
ResultSet rs = null;

String MySQL_IP = "192.180.15.1";
String MySQL_ID = "mht";
String MySQL_PW = "19951101";
try{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
// Class.forName("com.mysql.jdbc.Driver").newInstance();//使用这一行与上一行问题一样
url ="jdbc:mysql://"MySQL_IP"/basic?user="MySQL_ID"&password="MySQL_PW"&useUnicode=true&characterEncoding=gb2312";
conn = DriverManager.getConnection(url);
stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
}catch(Exception e){
e.printStackTrace();
out.println(e);
}
String str="";
QueryStr="select * from station where TYPE='0' or TYPE='1' or TYPE='2'";
rs=stmt.executeQuery(QueryStr);
while(rs.next()){
str=rs.getString("STATION");
out.print(str);
}
if(rs != null) rs.close();
if(stmt != null) stmt.close();
if(conn != null) conn.close();

相关文章:

  • 2021-10-12
  • 2021-10-05
  • 2021-11-04
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2021-12-17
  • 2022-12-23
  • 2021-11-30
  • 2021-07-13
相关资源
相似解决方案