java连接数据库

Class.forname("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager
                    .getConnection(
                            "jdbc:sqlserver://127.0.0.1:1433; DatabaseName=SuperMarket",
                            "sa", "sa");
            PreparedStatement s = conn
                    .prepareStatement("select * from user");
ResultSet r = s.executeQuery();
......
s.close();
conn.close();


你可能感兴趣的:(java,数据库,连接)