1
代码
driverClass=”com.microsoft.jdbc.sqlserver.SQLServerDriver”
url=”jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=dbsqlser2000”
2
举个例子
连接数据库查询表的相关语句:
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=mytest","sa","123");
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from userinfo");
while(rs.next())
{
out.print("
用户名:"+rs.getString("username")+"密码:"+rs.getString("password"));
}
rs.close();
stmt.close();
conn.close();
何为手动,何为自动?求解释!!!!