81,092
社区成员
发帖
与我相关
我的任务
分享
import java.sql.*;
public class Text{
public Text(){}
public static void main(String args[]){
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection conn
=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;User=ljm;Password=19891118;DatabaseName=wuyeDateBase");
Statement stmt=conn.createStatement();
String sql="select * from employee_info";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()) {
System.out.println("TestName:"+rs.getString("Employee_Name"));
}
rs.close();
stmt.close();
conn.close();
} catch(Exception ex) { System.err.println(ex.getMessage()); }
}
}