源代码来自:http://yuncode.net/code/c_505f0dc8059a794
|
Class.forName( "com.microsoft.sqlserver.jdbc.SQLServerDriver" ); |
2 |
String url = "jdbc:sqlserver://localhost:3306;DataBaseName=dbname" ;// dbname为数据库名 |
3 |
String dlname = "sa" ; |
4 |
String dlpass = "12345678" ; |
5 |
Connection conn = DriverManager.getConnection(url, dlname, dlpass); |
6 |
Statement statement = conn.createStatement(); |