xs 3 weeks ago
parent 87feefe5f8
commit 29171503e2

@ -0,0 +1,27 @@
package org.dromara.common.mybatis;
//import com.microsoft.sqlserver.jdbc.SQLServerDriver;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
public class DriverTest {
public static void main(String[] args) {
try {
// com.microsoft.sqlserver.jdbc.SQLServerDriver s = new SQLServerDriver();
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
HikariConfig config = new HikariConfig();
config.setJdbcUrl("jdbc:sqlserver://your-server:1433;databaseName=your-database");
config.setUsername("your-username");
config.setPassword("your-password");
config.setDriverClassName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
HikariDataSource dataSource = new HikariDataSource(config);
// 使用 dataSource 进行数据库操作
}
}
Loading…
Cancel
Save