or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

configuration.mdconnections.mddata-sources.mddata-types.mdhigh-availability.mdindex.mdpooling.mdsecurity.mdstatements.md

configuration.mddocs/

0

# Configuration Management

1

2

Comprehensive configuration system with 100+ options for connection behavior, performance tuning, security settings, and high availability configuration.

3

4

## Capabilities

5

6

### Configuration Parser

7

8

Central configuration management for parsing JDBC URLs and properties into a Configuration object.

9

10

```java { .api }

11

/**

12

* Configuration management for MariaDB connections

13

*/

14

public class Configuration {

15

/**

16

* Parse JDBC URL and properties into Configuration

17

* @param url JDBC connection URL

18

* @param props Additional properties

19

* @return Configuration instance or null if URL not supported

20

* @throws SQLException if parsing fails

21

*/

22

public static Configuration parse(String url, Properties props) throws SQLException;

23

24

// Basic connection properties

25

public String user();

26

public String password();

27

public String database();

28

public List<HostAddress> addresses();

29

public HaMode haMode();

30

31

// SSL/TLS configuration

32

public SslMode sslMode();

33

public String serverSslCert();

34

public String clientSslCert();

35

public String clientSslKey();

36

public String keyStore();

37

public String keyStorePassword();

38

public String keyStoreType();

39

public String trustStore();

40

public String trustStorePassword();

41

public String trustStoreType();

42

public String enabledSslCipherSuites();

43

public String enabledSslProtocolSuites();

44

45

// Connection behavior

46

public int connectTimeout();

47

public int socketTimeout();

48

public boolean tcpKeepAlive();

49

public int tcpAbortiveClose();

50

public String pipe();

51

public String localSocket();

52

public boolean tcpRcvBuf();

53

public boolean tcpSndBuf();

54

public boolean tcpNoDelay();

55

56

// Protocol options

57

public boolean allowMultiQueries();

58

public boolean useCompression();

59

public boolean allowLocalInfile();

60

public boolean useBulkStmts();

61

public boolean disablePipeline();

62

public boolean autocommit();

63

64

// Prepared statement options

65

public boolean cachePrepStmts();

66

public int prepStmtCacheSize();

67

public int prepStmtCacheSqlLimit();

68

public boolean useServerPrepStmts();

69

public boolean useAffectedRows();

70

71

// Connection pool options

72

public boolean pool();

73

public String poolName();

74

public int maxPoolSize();

75

public int minPoolSize();

76

public int maxIdleTime();

77

public boolean registerJmxPool();

78

public int poolValidMinDelay();

79

public boolean useResetConnection();

80

81

// Metadata options

82

public boolean blankTableNameMeta();

83

public boolean dumpQueriesOnException();

84

public boolean includeInnodbStatusInDeadlockExceptions();

85

public boolean includeThreadDumpInDeadlockExceptions();

86

public String servicePrincipalName();

87

public String defaultFetchSize();

88

public boolean tinyInt1isBit();

89

public boolean yearIsDateType();

90

public boolean createDatabaseIfNotExist();

91

92

// High availability options

93

public int retriesAllDown();

94

public String galeraAllowedState();

95

public boolean transactionReplay();

96

public int transactionReplaySize();

97

public String geometryDefaultType();

98

public String restrictedAuth();

99

public String initSql();

100

101

// Authentication and security

102

public String credentialType();

103

public String sessionVariables();

104

public String connectionAttributes();

105

public boolean useBatchMultiSend();

106

public boolean useBatchMultiSendNumber();

107

public boolean usePipelineAuth();

108

public boolean enableSkipMeta();

109

public boolean preserveInstants();ы

110

public boolean trackSchema();

111

}

112

```

113

114

**Usage Examples:**

115

116

```java

117

// Parse configuration from URL and properties

118

String url = "jdbc:mariadb://localhost:3306/mydb?useCompression=true&cachePrepStmts=true";

119

Properties props = new Properties();

120

props.setProperty("user", "myuser");

121

props.setProperty("password", "mypass");

122

props.setProperty("connectTimeout", "5000");

123

124

Configuration config = Configuration.parse(url, props);

125

126

// Access configuration values

127

String user = config.user();

128

boolean compression = config.useCompression();

129

int timeout = config.connectTimeout();

130

List<HostAddress> hosts = config.addresses();

131

```

132

133

### Basic Connection Configuration

134

135

Core connection settings for establishing database connections.

136

137

```java

138

// Basic connection URL

139

"jdbc:mariadb://localhost:3306/mydb"

140

141

// With basic authentication

142

"jdbc:mariadb://user:password@localhost:3306/mydb"

143

144

// Multiple hosts for high availability

145

"jdbc:mariadb://host1:3306,host2:3306,host3:3306/mydb"

146

147

// Connection timeout settings

148

"jdbc:mariadb://localhost:3306/mydb?connectTimeout=5000&socketTimeout=30000"

149

```

150

151

### SSL/TLS Configuration

152

153

Comprehensive SSL/TLS security configuration options.

154

155

```java

156

// SSL configuration examples

157

// Disable SSL (not recommended for production)

158

"jdbc:mariadb://localhost:3306/mydb?sslMode=DISABLE"

159

160

// Enable SSL with trust mode (encryption only)

161

"jdbc:mariadb://localhost:3306/mydb?sslMode=TRUST"

162

163

// Verify certificate authority

164

"jdbc:mariadb://localhost:3306/mydb?sslMode=VERIFY_CA&serverSslCert=/path/to/ca-cert.pem"

165

166

// Full certificate and hostname verification

167

"jdbc:mariadb://localhost:3306/mydb?sslMode=VERIFY_FULL&trustStore=/path/to/truststore.jks&trustStorePassword=secret"

168

169

// Client certificate authentication

170

"jdbc:mariadb://localhost:3306/mydb?sslMode=VERIFY_FULL&" +

171

"keyStore=/path/to/keystore.jks&keyStorePassword=secret&" +

172

"trustStore=/path/to/truststore.jks&trustStorePassword=secret"

173

174

// Custom cipher suites and protocols

175

"jdbc:mariadb://localhost:3306/mydb?sslMode=VERIFY_FULL&" +

176

"enabledSslCipherSuites=TLS_RSA_WITH_AES_256_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256&" +

177

"enabledSslProtocolSuites=TLSv1.2,TLSv1.3"

178

```

179

180

### Performance Configuration

181

182

Settings for optimizing connection and query performance.

183

184

```java

185

// Compression and bulk operations

186

"jdbc:mariadb://localhost:3306/mydb?useCompression=true&useBulkStmts=true"

187

188

// Prepared statement caching

189

"jdbc:mariadb://localhost:3306/mydb?cachePrepStmts=true&prepStmtCacheSize=250&prepStmtCacheSqlLimit=2048"

190

191

// Server-side prepared statements

192

"jdbc:mariadb://localhost:3306/mydb?useServerPrepStmts=true"

193

194

// TCP socket optimization

195

"jdbc:mariadb://localhost:3306/mydb?tcpKeepAlive=true&tcpNoDelay=true"

196

197

// Pipeline and batch optimizations

198

"jdbc:mariadb://localhost:3306/mydb?usePipelineAuth=true&useBatchMultiSend=true&disablePipeline=false"

199

200

// Connection reuse

201

"jdbc:mariadb://localhost:3306/mydb?useResetConnection=true"

202

```

203

204

### Connection Pool Configuration

205

206

Built-in connection pooling configuration options.

207

208

```java

209

// Enable connection pooling

210

"jdbc:mariadb://localhost:3306/mydb?pool=true"

211

212

// Full pool configuration

213

"jdbc:mariadb://localhost:3306/mydb?" +

214

"pool=true&" + // Enable pooling

215

"poolName=MyApplicationPool&" + // Pool name for monitoring

216

"maxPoolSize=25&" + // Maximum connections

217

"minPoolSize=5&" + // Minimum connections

218

"maxIdleTime=600&" + // Max idle time in seconds

219

"poolValidMinDelay=1000&" + // Validation delay in ms

220

"registerJmxPool=true" // Enable JMX monitoring

221

```

222

223

### High Availability Configuration

224

225

Configuration for multi-host deployments and failover scenarios.

226

227

```java

228

// Replication setup

229

"jdbc:mariadb:replication://primary:3306,replica1:3306,replica2:3306/mydb"

230

231

// Load balancing

232

"jdbc:mariadb:loadbalance://host1:3306,host2:3306,host3:3306/mydb"

233

234

// Sequential failover

235

"jdbc:mariadb:sequential://host1:3306,host2:3306,host3:3306/mydb"

236

237

// Advanced host specification with types

238

"jdbc:mariadb://address=(host=primary)(port=3306)(type=primary)," +

239

"address=(host=replica1)(port=3306)(type=replica)," +

240

"address=(host=replica2)(port=3306)(type=replica)/mydb"

241

242

// Failover configuration

243

"jdbc:mariadb:replication://primary:3306,replica:3306/mydb?" +

244

"retriesAllDown=5&" + // Retry attempts when all hosts down

245

"galeraAllowedState=4&" + // Galera cluster state requirements

246

"transactionReplay=true&" + // Enable transaction replay on failover

247

"transactionReplaySize=64" // Transaction replay buffer size

248

```

249

250

### Authentication Configuration

251

252

Various authentication methods and credential management.

253

254

```java

255

// Environment variable credentials

256

"jdbc:mariadb://localhost:3306/mydb?credentialType=ENV"

257

258

// AWS IAM authentication

259

"jdbc:mariadb://rds-endpoint:3306/mydb?credentialType=AWS_IAM"

260

261

// Properties file credentials

262

"jdbc:mariadb://localhost:3306/mydb?credentialType=PROPERTY&propertiesFile=/path/to/creds.properties"

263

264

// Restricted authentication plugins

265

"jdbc:mariadb://localhost:3306/mydb?restrictedAuth=mysql_native_password,caching_sha2_password"

266

267

// Session variables

268

"jdbc:mariadb://localhost:3306/mydb?sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_DATE'"

269

270

// Connection attributes for monitoring

271

"jdbc:mariadb://localhost:3306/mydb?connectionAttributes=program_name:MyApp,version:1.0"

272

```

273

274

### Special Connection Types

275

276

Configuration for non-standard connection methods.

277

278

```java

279

// Windows named pipe

280

"jdbc:mariadb://address=(pipe=\\\\.\\pipe\\mysql)/mydb"

281

282

// Unix domain socket

283

"jdbc:mariadb://address=(localSocket=/var/run/mysqld/mysqld.sock)/mydb"

284

285

// Multiple socket files for load balancing

286

"jdbc:mariadb://address=(localSocket=/var/run/mysqld/mysqld1.sock)," +

287

"address=(localSocket=/var/run/mysqld/mysqld2.sock)/mydb"

288

```

289

290

### Metadata and Compatibility Configuration

291

292

Settings for metadata behavior and compatibility with different MySQL versions.

293

294

```java

295

// Metadata configuration

296

"jdbc:mariadb://localhost:3306/mydb?" +

297

"blankTableNameMeta=true&" + // Return blank table names in metadata

298

"tinyInt1isBit=true&" + // Treat TINYINT(1) as boolean

299

"yearIsDateType=true&" + // Treat YEAR as Date type

300

"dumpQueriesOnException=true&" + // Include queries in exception messages

301

"includeInnodbStatusInDeadlockExceptions=true" // Include InnoDB status in deadlock exceptions

302

303

// Geometry type handling

304

"jdbc:mariadb://localhost:3306/mydb?geometryDefaultType=default"

305

306

// Database creation

307

"jdbc:mariadb://localhost:3306/mydb?createDatabaseIfNotExist=true"

308

309

// Schema tracking

310

"jdbc:mariadb://localhost:3306/mydb?trackSchema=true"

311

```

312

313

### Development and Debugging Configuration

314

315

Configuration options useful for development and troubleshooting.

316

317

```java

318

// Debug and logging options

319

"jdbc:mariadb://localhost:3306/mydb?" +

320

"dumpQueriesOnException=true&" + // Show queries in exceptions

321

"includeInnodbStatusInDeadlockExceptions=true&" + // Detailed deadlock info

322

"includeThreadDumpInDeadlockExceptions=true&" + // Thread dump on deadlock

323

"log=true&" + // Enable query logging

324

"profileSql=true" // Enable SQL profiling

325

```

326

327

## Configuration Best Practices

328

329

### Production Configuration

330

331

```java

332

// Recommended production configuration

333

String productionUrl = "jdbc:mariadb:replication://primary:3306,replica:3306/mydb?" +

334

// Security

335

"sslMode=VERIFY_FULL&" +

336

"trustStore=/path/to/truststore.jks&" +

337

"trustStorePassword=secret&" +

338

339

// Connection management

340

"connectTimeout=5000&" +

341

"socketTimeout=30000&" +

342

"tcpKeepAlive=true&" +

343

344

// Performance

345

"useCompression=true&" +

346

"cachePrepStmts=true&" +

347

"prepStmtCacheSize=250&" +

348

"useServerPrepStmts=true&" +

349

"useBulkStmts=true&" +

350

351

// High availability

352

"retriesAllDown=3&" +

353

"transactionReplay=true&" +

354

355

// Connection pooling

356

"pool=true&" +

357

"maxPoolSize=20&" +

358

"minPoolSize=5&" +

359

"maxIdleTime=600&" +

360

"registerJmxPool=true";

361

```

362

363

### Development Configuration

364

365

```java

366

// Development configuration with debugging

367

String devUrl = "jdbc:mariadb://localhost:3306/mydb?" +

368

// Basic auth (not for production)

369

"user=devuser&password=devpass&" +

370

371

// Debugging

372

"dumpQueriesOnException=true&" +

373

"includeInnodbStatusInDeadlockExceptions=true&" +

374

375

// Performance (relaxed for debugging)

376

"connectTimeout=10000&" +

377

"socketTimeout=60000&" +

378

379

// Create database if needed

380

"createDatabaseIfNotExist=true";

381

```