2018/10/24

測試 JDBC driver on windows

## 下載 Microsoft JDBC Driver for SQL Server ``` choco install sqljdbc -y ``` or 下載 Microsoft JDBC Driver for SQL Server ## Microsoft JDBC DRIVER 7.0 for SQL Server Sample code 路徑 ``` C:\Program Files\Microsoft JDBC DRIVER 7.0 for SQL Server\sqljdbc_7.0\enu\samples\connections ``` ## 修改範例程式: 連接 URL 範例 ``` // Create a variable for the connection string. String connectionUrl = "jdbc:sqlserver://<server>:<port>;databaseName=AdventureWorks;user=<user>;password=<password>"; ``` ## Build ``` javac .\ConnectURL.java ``` ## Run Test ``` java -cp "C:\Program Files\Microsoft JDBC DRIVER 7.0 for SQL Server\sqljdbc_7.0\enu\mssql-jdbc-7.0.0.jre8.jar;." ConnectURL ```

沒有留言:

90% 症候群