为了账号安全,请及时绑定邮箱和手机立即绑定

老师,能不能稍微讲一下SQL sever的 驱动方式

SQL sever的不知道

正在回答

1 回答

public static void main(String[] args) throws ClassNotFoundException, SQLException {


Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

String connectionUrl = "jdbc:sqlserver://127.0.0.1:1433;" +

       "databaseName=JDBC;user=sa;password=123;";

Connection con;

try {

con = DriverManager.getConnection(connectionUrl);

Statement stmt = con.createStatement();

            ResultSet rs=stmt.executeQuery("select*from imooc_goddess");

            while (rs.next()) {

            System.out.println(rs.getNString("user_name"));

}

rs.close();

con.close();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

老师,能不能稍微讲一下SQL sever的 驱动方式

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信