com.mysql.jdbc.Driver
com.microsoft.sqlserver.jdbc.SQLServerDerver
1. Load the driver Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDerver");
2. Establish a connection
Mysql: jdbc:mysql://localhost/abc
SQLServer: String uri = "jdbc:sqlserver"//localhost:1433;databaseName = abc";
DriverManager.getConnection(url,"sa","123");
interface:
Statement executes general SQL statements
PreparedStaterment executes precompiled SQL statements
General:
"select * from test where id = " + id both interfaces are acceptable
"select * from test where id = ? " The second