赞
踩
使用("jdbc:sqlserver://localhost:1433;DatabaseName=MyDatabase;autoReconnectForPools=true;encrypt=true;trustServerCertificate=true;","sa","********");
连接成功
-
- import java.sql.*;
- public class sqll {
-
-
-
- public static void main(String [] args)
- {
- try
- {
- Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
- Connection con= DriverManager.getConnection
- ("jdbc:sqlserver://localhost:1433;DatabaseName=one;autoReconnectForPools=true;encrypt=true;trustServerCertificate=true;","sa","********");
- System.out.println("连接数据库成功");
- }
- catch(Exception e)
- {
- e.printStackTrace();
- System.out.print("连接失败");
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。