游客发表

通过引进SQL Server 2000驱动的jar包连接SQL服务器

发帖时间:2025-11-04 14:26:04

通过引进SQL Server 2000驱动的jar包连接SQL服务器
复制import java.sql.*;   public class test     public static void main(String[] args)   String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";   String dbURL = "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=test";//test为数据库名   String userName = "sa";//sa为SQL用户名   String userPwd = "123456";//SQL密码   Connection dbConn;   try         Class.forName(driverName);   dbConn = DriverManager.getConnection(dbURL,通过 userName, userPwd);        System.out.println("Connection Successful!");    catch (Exception e)        e.printStackTrace();     }   }  1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.

    热门排行

    友情链接