**已关闭。**此问题需要调试详细信息。它目前不接受答案。
**想要改进此问题?**更新问题,使其位于堆栈溢出主题上。
五天前关门。
改进这个问题
问题形象
String connectionUrl = "jdbc:sqlserver://localhost;databaseName=QLSV;user=sa;password=12345";
try (Connection con = DriverManager.getConnection(connectionUrl);
Statement stmt = con.createStatement();) {
String SQL = "SELECT TOP 10 * FROM USERS";
ResultSet rs = stmt.executeQuery(SQL);
// Iterate through the data in the result set and display it.
while (rs.next()) {
System.out.println(rs.getString("USERNAME") + " " + rs.getString("PASSWORD"));
}
} // Handle any errors that may have occurred.
catch (SQLException e) {
e.printStackTrace();
}
1条答案
按热度按时间q8l4jmvw1#
如果项目是maven,请更新以下依赖项