![]() |
![]() |
![]() |
| package DataBase; import java.sql.*; public class MSDBdemo { public static void main(String[] args){ try{ Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); System.out. String url ="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=northwind"; String user = "sa"; String passWord = ""; Connection conn = DriverManager.getConnection(url, user, password); System.out.println("數據庫連接成功"); }catch(Exception e){ e.printStackTrace(); System.out.println("數據庫連接失敗"); } } } |
新聞熱點
疑難解答