📄 例12-6.txt
字号:
import java.sql.*;
public class Example12_6{
public static void main(String args[]){
Connection con;
PreparedStatement pre;
ResultSet rs;
try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException e){
System.out.println(""+e);
}
try{ con=DriverManager.getConnection("jdbc:odbc:hello","","");
pre=con.prepareStatement("SELECT * FROM message");//预处理语句pre
rs=pre.executeQuery();
while(rs.next()){
String number=rs.getString(1);
String name=rs.getString(2);
Date birth=rs.getDate(3);
double height=rs.getDouble(4);
System.out.println(number+","+name+","+birth+","+height);
}
con.close();
}
catch(SQLException e){
System.out.println(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -