桥连:sun.jdbc.odbc.JdbcOdbcDriver
连接字符串:("jdbc:odbc:数据源名","sa","sa");
纯Java驱动:com.microsoft.jdbc.sqlserver.SQLServerDriver
连接字符串:
("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=数据库名","sa","")
连接SQL2005:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
DriverManager.getConnection("jdbc:sqlserver://localhost:1433; DatabaseName=数据库名","数据库登录名","登录密码");
连接Oracle:
Class.forName("oracle.jdbc.driver.OracleDriver");
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:数据库名","用户名","密码");
配置框架数据库连接jdbc:oracle:thin:@localhost:1521:ORCL即可
Java JDBC连接数据库
2022-02-14 04:11:09