Ultimate JDBC Connection Pool - Java 6 compatible version providing high-performance database connection pooling
npx @tessl/cli install tessl/maven-com-zaxxer--hikari-cp-java6@2.3.00
# HikariCP-java6
1
2
Ultimate JDBC Connection Pool - Java 6 compatible version providing high-performance database connection pooling with minimal overhead, reliability, and comprehensive management features.
3
4
## Package Information
5
6
- **Package Name**: HikariCP-java6
7
- **Package Type**: maven
8
- **Language**: Java
9
- **Java Version**: Java 6+
10
- **Maven Coordinates**: `com.zaxxer:HikariCP-java6:2.3.13`
11
12
## Core Imports
13
14
Maven dependency:
15
16
```xml
17
<dependency>
18
<groupId>com.zaxxer</groupId>
19
<artifactId>HikariCP-java6</artifactId>
20
<version>2.3.13</version>
21
</dependency>
22
```
23
24
Basic Java imports:
25
26
```java
27
import com.zaxxer.hikari.HikariDataSource;
28
import com.zaxxer.hikari.HikariConfig;
29
```
30
31
## Basic Usage
32
33
```java
34
import com.zaxxer.hikari.HikariConfig;
35
import com.zaxxer.hikari.HikariDataSource;
36
import java.sql.Connection;
37
import java.sql.SQLException;
38
39
// Basic configuration and setup
40
HikariConfig config = new HikariConfig();
41
config.setJdbcUrl("jdbc:mysql://localhost:3306/mydb");
42
config.setUsername("user");
43
config.setPassword("password");
44
config.setDriverClassName("com.mysql.jdbc.Driver");
45
46
// Optional pool tuning
47
config.setMaximumPoolSize(20);
48
config.setMinimumIdle(5);
49
config.setConnectionTimeout(30000);
50
config.setIdleTimeout(600000);
51
config.setMaxLifetime(1800000);
52
53
// Create the DataSource
54
HikariDataSource dataSource = new HikariDataSource(config);
55
56
// Use the connection pool
57
try (Connection connection = dataSource.getConnection()) {
58
// Execute database operations
59
// Connection automatically returned to pool when closed
60
} catch (SQLException e) {
61
e.printStackTrace();
62
}
63
64
// Shutdown when application exits
65
dataSource.close();
66
```
67
68
## Architecture
69
70
HikariCP uses a fast, lock-free design optimized for high-performance connection pooling:
71
72
- **HikariDataSource**: Main entry point implementing javax.sql.DataSource
73
- **HikariConfig**: Configuration management with comprehensive validation
74
- **Connection Pooling**: Lock-free ConcurrentBag implementation for optimal performance
75
- **Proxy System**: Lightweight proxies for all JDBC objects with automatic cleanup
76
- **Management Layer**: JMX beans for runtime monitoring and configuration
77
- **Integration Layer**: Native support for metrics systems and application frameworks
78
79
This design delivers industry-leading performance while maintaining full JDBC compliance and extensive configurability for enterprise environments.
80
81
## Capabilities
82
83
### Core Configuration and Setup
84
85
Primary classes for configuring and creating connection pools, including HikariDataSource, HikariConfig, and comprehensive configuration options for pool behavior, timeouts, and database connectivity.
86
87
```java { .api }
88
public class HikariDataSource extends HikariConfig implements DataSource, Closeable {
89
public HikariDataSource();
90
public HikariDataSource(HikariConfig configuration);
91
public Connection getConnection() throws SQLException;
92
public void close();
93
}
94
95
public class HikariConfig extends AbstractHikariConfig {
96
public HikariConfig();
97
public HikariConfig(Properties properties);
98
public HikariConfig(String propertyFileName);
99
}
100
```
101
102
[Configuration and Setup](./configuration.md)
103
104
### JMX Management
105
106
Runtime monitoring and configuration through JMX MBeans, providing visibility into pool statistics, connection health, and the ability to modify configuration parameters during runtime.
107
108
```java { .api }
109
public interface HikariConfigMXBean {
110
long getConnectionTimeout();
111
void setConnectionTimeout(long connectionTimeoutMs);
112
int getMaximumPoolSize();
113
void setMaximumPoolSize(int maxPoolSize);
114
String getPoolName();
115
}
116
117
public interface HikariPoolMXBean {
118
int getIdleConnections();
119
int getActiveConnections();
120
int getTotalConnections();
121
void suspendPool();
122
void resumePool();
123
}
124
```
125
126
[JMX Management](./jmx-management.md)
127
128
### Hibernate Integration
129
130
Native integration with Hibernate ORM framework, providing seamless connection pooling for Hibernate applications with automatic property mapping and lifecycle management.
131
132
```java { .api }
133
public class HikariConnectionProvider implements ConnectionProvider, Configurable, Stoppable {
134
public void configure(Map props) throws HibernateException;
135
public Connection getConnection() throws SQLException;
136
public void stop();
137
}
138
139
public class HikariConfigurationUtil {
140
public static final String CONFIG_PREFIX = "hibernate.hikari.";
141
public static HikariConfig loadConfiguration(Map props);
142
}
143
```
144
145
[Hibernate Integration](./hibernate-integration.md)
146
147
### Metrics and Monitoring
148
149
Comprehensive metrics collection and health monitoring through integration with popular metrics libraries like Codahale Metrics (Dropwizard Metrics).
150
151
```java { .api }
152
public class MetricsTracker {
153
public MetricsContext recordConnectionRequest(long requestTime);
154
public void recordConnectionUsage(PoolBagEntry bagEntry);
155
public void close();
156
}
157
158
public class CodaHaleMetricsTracker extends MetricsTracker {
159
public Timer getConnectionAcquisitionTimer();
160
public Histogram getConnectionDurationHistogram();
161
}
162
```
163
164
[Metrics and Monitoring](./metrics-monitoring.md)
165
166
### Utilities and Advanced Features
167
168
Advanced functionality including JNDI integration, custom connection handling, proxy system components, and utility classes for specialized use cases.
169
170
```java { .api }
171
public class HikariJNDIFactory implements ObjectFactory {
172
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception;
173
}
174
175
public interface IHikariConnectionProxy extends Connection {
176
PoolBagEntry getPoolBagEntry();
177
SQLException checkException(SQLException sqle);
178
void untrackStatement(Statement statement);
179
void markCommitStateDirty();
180
}
181
```
182
183
[Utilities and Advanced Features](./utilities-advanced.md)
184
185
## Core Types
186
187
```java { .api }
188
// Main configuration class extending base functionality
189
public abstract class AbstractHikariConfig implements HikariConfigMXBean {
190
public void setJdbcUrl(String jdbcUrl);
191
public String getJdbcUrl();
192
public void setUsername(String username);
193
public String getUsername();
194
public void setPassword(String password);
195
public void setMaximumPoolSize(int maxPoolSize);
196
public int getMaximumPoolSize();
197
public void validate();
198
}
199
200
// Pool initialization exception
201
public class PoolInitializationException extends RuntimeException {
202
public PoolInitializationException(Throwable t);
203
}
204
205
// Connection customizer interface (deprecated)
206
@Deprecated
207
public interface IConnectionCustomizer {
208
void customize(Connection connection) throws SQLException;
209
}
210
```