| import java.net.URL; class java2sqlserver { public static void main(String[] args) { String url="jdbc:microsoft:sqlserver://localhost:1433;User=sa;Password=739555;DatabaseName=northwind"; String query="Select * From Categories"; try { Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); //DriverManager.setLogStream(System.out); Connection con=DriverManager.getConnection(url); checkForWarning(con.getWarnings()); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query); dispResultSet(rs); rs.close(); stmt.close(); con.close(); } catch(SQLException ex) 上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >> |