<dependency> <groupId>com.zaxxer</groupId> <artifactId>HikariCP</artifactId> <version>4.0.2</version> </dependency> HikariConfig config = new HikariConfig(); config.setJdbcUrl("jdbc:mysql://localhost:3306/mydatabase"); config.setUsername("username"); config.setPassword("password"); HikariDataSource dataSource = new HikariDataSource(config); try (Connection connection = dataSource.getConnection()) { // ... } catch (SQLException e) { e.printStackTrace(); }


上一篇:
下一篇:
切换中文