JDBC Type 4 driver for MySQL with X DevAPI support for document store operations
npx @tessl/cli install tessl/maven-com-mysql--mysql-connector-j@9.2.00
# MySQL Connector/J
1
2
MySQL Connector/J is a pure Java JDBC Type 4 driver that implements the Java Database Connectivity (JDBC) 4.2 API and MySQL X DevAPI for connecting Java applications to MySQL databases. It provides comprehensive database connectivity through standard JDBC operations and supports MySQL's document store features through the X DevAPI for NoSQL-style CRUD operations.
3
4
## Package Information
5
6
- **Package Name**: mysql-connector-j
7
- **Maven Coordinates**: `com.mysql:mysql-connector-j:9.2.0`
8
- **Package Type**: Maven
9
- **Language**: Java
10
- **Minimum Java Version**: Java 8
11
- **Installation**: Add to Maven `pom.xml`:
12
13
```xml
14
<dependency>
15
<groupId>com.mysql</groupId>
16
<artifactId>mysql-connector-j</artifactId>
17
<version>9.2.0</version>
18
</dependency>
19
```
20
21
For Gradle:
22
23
```gradle
24
implementation 'com.mysql:mysql-connector-j:9.2.0'
25
```
26
27
## Core Imports
28
29
### JDBC API Imports
30
31
```java
32
// Driver and connection
33
import com.mysql.cj.jdbc.Driver;
34
import com.mysql.cj.jdbc.MysqlDataSource;
35
import java.sql.Connection;
36
import java.sql.DriverManager;
37
import java.sql.Statement;
38
import java.sql.PreparedStatement;
39
import java.sql.ResultSet;
40
```
41
42
### X DevAPI Imports
43
44
```java
45
// Session and core interfaces
46
import com.mysql.cj.xdevapi.Session;
47
import com.mysql.cj.xdevapi.SessionFactory;
48
import com.mysql.cj.xdevapi.Client;
49
import com.mysql.cj.xdevapi.ClientFactory;
50
import com.mysql.cj.xdevapi.Schema;
51
import com.mysql.cj.xdevapi.Collection;
52
import com.mysql.cj.xdevapi.Table;
53
import com.mysql.cj.xdevapi.DbDoc;
54
```
55
56
**IMPORTANT - Import Ambiguity Warning:**
57
58
If you use both JDBC and X DevAPI in the same file, avoid wildcard imports (`import java.sql.*` and `import com.mysql.cj.xdevapi.*`) together, as they create an ambiguity for the `Statement` interface which exists in both packages:
59
- `java.sql.Statement` (JDBC)
60
- `com.mysql.cj.xdevapi.Statement` (X DevAPI)
61
62
Use explicit imports or fully qualified names when using both APIs:
63
64
```java
65
// Option 1: Use explicit imports
66
import java.sql.Connection;
67
import java.sql.PreparedStatement;
68
import com.mysql.cj.xdevapi.Session;
69
import com.mysql.cj.xdevapi.FindStatement;
70
71
// Option 2: Use fully qualified names when necessary
72
java.sql.Statement jdbcStmt = conn.createStatement();
73
com.mysql.cj.xdevapi.Statement xStmt = session.sql("SELECT * FROM users");
74
```
75
76
## Basic Usage
77
78
### JDBC Connection Example
79
80
```java
81
import java.sql.Connection;
82
import java.sql.DriverManager;
83
import java.sql.PreparedStatement;
84
import java.sql.ResultSet;
85
import java.sql.SQLException;
86
87
public class JdbcExample {
88
public static void main(String[] args) {
89
String url = "jdbc:mysql://localhost:3306/mydb";
90
String user = "root";
91
String password = "password";
92
93
try (Connection conn = DriverManager.getConnection(url, user, password)) {
94
// Execute a query
95
String sql = "SELECT id, name FROM users WHERE age > ?";
96
try (PreparedStatement pstmt = conn.prepareStatement(sql)) {
97
pstmt.setInt(1, 18);
98
99
try (ResultSet rs = pstmt.executeQuery()) {
100
while (rs.next()) {
101
int id = rs.getInt("id");
102
String name = rs.getString("name");
103
System.out.println("ID: " + id + ", Name: " + name);
104
}
105
}
106
}
107
} catch (SQLException e) {
108
e.printStackTrace();
109
}
110
}
111
}
112
```
113
114
### X DevAPI Session Example
115
116
```java
117
import com.mysql.cj.xdevapi.*;
118
119
public class XDevApiExample {
120
public static void main(String[] args) {
121
// Create a session
122
SessionFactory factory = new SessionFactory();
123
String url = "mysqlx://root:password@localhost:33060/mydb";
124
125
try (Session session = factory.getSession(url)) {
126
// Get schema and collection
127
Schema schema = session.getDefaultSchema();
128
Collection collection = schema.getCollection("users");
129
130
// Add a document using JSON string
131
collection.add("{\"name\": \"John Doe\", \"age\": 30}").execute();
132
133
// Find documents
134
DocResult result = collection.find("age > :minAge")
135
.bind("minAge", 18)
136
.execute();
137
138
while (result.hasNext()) {
139
DbDoc user = result.next();
140
System.out.println("User: " + user.toString());
141
}
142
}
143
}
144
}
145
```
146
147
## Architecture
148
149
MySQL Connector/J provides two distinct APIs for database access:
150
151
### JDBC API Architecture
152
153
The traditional JDBC 4.2 implementation follows the standard Java database connectivity patterns:
154
155
- **Driver**: Entry point via `com.mysql.cj.jdbc.Driver` registered with DriverManager
156
- **Connection**: `JdbcConnection` interface provides MySQL-specific extensions to `java.sql.Connection`
157
- **Statement Types**: `Statement`, `PreparedStatement`, `CallableStatement` for SQL execution
158
- **ResultSet**: Standard result set implementation with scrollable and updatable variants
159
- **DataSource**: Connection pooling support via `MysqlDataSource`, `MysqlConnectionPoolDataSource`, `MysqlXADataSource`
160
- **Metadata**: Comprehensive database and result set metadata via `DatabaseMetaData`
161
162
### X DevAPI Architecture
163
164
The modern document store API provides NoSQL-style operations:
165
166
- **Session Management**: `Session` and `Client` interfaces for connection lifecycle
167
- **Schema Objects**: `Schema` provides access to collections and tables
168
- **Collections**: Document store operations via `Collection` interface
169
- **CRUD Builders**: Fluent statement builders (`AddStatement`, `FindStatement`, `ModifyStatement`, `RemoveStatement`)
170
- **SQL Support**: Direct SQL execution via `SqlStatement` within X DevAPI context
171
- **Result Types**: Specialized results (`DocResult`, `RowResult`, `SqlResult`)
172
173
### Key Components
174
175
- **Configuration**: Connection URLs parsed by `ConnectionUrl` with properties managed by `PropertySet`
176
- **Protocol Layer**: Low-level MySQL protocol implementation hidden behind public APIs
177
- **Authentication**: Pluggable authentication via `AuthenticationPlugin` interface
178
- **Exception Hierarchy**: `CJException` base with specific subtypes for different error conditions
179
- **Logging**: Unified logging via `Log` interface with multiple implementations
180
181
## Capabilities
182
183
### JDBC Core Operations
184
185
The fundamental JDBC 4.2 API for relational database access, including connection management, statement execution, and result processing.
186
187
```java { .api }
188
// Driver registration and connection
189
public class Driver extends NonRegisteringDriver implements java.sql.Driver {
190
static {
191
// Auto-registers with DriverManager
192
}
193
}
194
195
// Connection interface
196
public interface JdbcConnection extends Connection, MysqlConnection {
197
PreparedStatement clientPrepareStatement(String sql) throws SQLException;
198
PreparedStatement serverPrepareStatement(String sql) throws SQLException;
199
void setAutoCommit(boolean autoCommit) throws SQLException;
200
void commit() throws SQLException;
201
void rollback() throws SQLException;
202
}
203
204
// Statement execution
205
public interface JdbcStatement extends Statement {
206
ResultSet executeQuery(String sql) throws SQLException;
207
int executeUpdate(String sql) throws SQLException;
208
boolean execute(String sql) throws SQLException;
209
}
210
211
// Prepared statement
212
public interface JdbcPreparedStatement extends PreparedStatement, JdbcStatement {
213
void setInt(int parameterIndex, int x) throws SQLException;
214
void setString(int parameterIndex, String x) throws SQLException;
215
void setObject(int parameterIndex, Object x) throws SQLException;
216
ResultSet executeQuery() throws SQLException;
217
int executeUpdate() throws SQLException;
218
}
219
220
// DataSource for connection pooling
221
public class MysqlDataSource implements DataSource {
222
public Connection getConnection() throws SQLException;
223
public Connection getConnection(String username, String password) throws SQLException;
224
public void setURL(String url);
225
public void setUser(String user);
226
public void setPassword(String password);
227
}
228
```
229
230
[JDBC Core Operations](./jdbc-core.md)
231
232
### JDBC Advanced Features
233
234
Advanced JDBC capabilities including connection pooling, distributed transactions (XA), batch operations, and server-side prepared statements.
235
236
```java { .api }
237
// Connection pooling
238
public class MysqlConnectionPoolDataSource implements ConnectionPoolDataSource {
239
public PooledConnection getPooledConnection() throws SQLException;
240
public PooledConnection getPooledConnection(String user, String password) throws SQLException;
241
}
242
243
public class MysqlPooledConnection implements PooledConnection {
244
public Connection getConnection() throws SQLException;
245
public void close() throws SQLException;
246
public void addConnectionEventListener(ConnectionEventListener listener);
247
}
248
249
// XA distributed transactions
250
public class MysqlXADataSource extends MysqlConnectionPoolDataSource implements XADataSource {
251
public XAConnection getXAConnection() throws SQLException;
252
public XAConnection getXAConnection(String user, String password) throws SQLException;
253
}
254
255
public class MysqlXAConnection extends MysqlPooledConnection implements XAConnection {
256
public XAResource getXAResource() throws SQLException;
257
}
258
259
// Callable statements for stored procedures
260
public class CallableStatement extends PreparedStatement implements java.sql.CallableStatement {
261
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException;
262
public void registerOutParameter(String parameterName, int sqlType) throws SQLException;
263
public Object getObject(int parameterIndex) throws SQLException;
264
public Object getObject(String parameterName) throws SQLException;
265
}
266
267
// Batch operations
268
public void addBatch(String sql) throws SQLException;
269
public int[] executeBatch() throws SQLException;
270
public void clearBatch() throws SQLException;
271
```
272
273
[JDBC Advanced Features](./jdbc-advanced.md)
274
275
### JDBC High Availability
276
277
Load balancing, replication, and failover support for high-availability MySQL deployments.
278
279
```java { .api }
280
// Load-balanced connection
281
public interface LoadBalancedConnection extends JdbcConnection {
282
boolean addHost(String host) throws SQLException;
283
void removeHost(String host) throws SQLException;
284
void removeHostWhenNotInUse(String host) throws SQLException;
285
void ping(boolean allConnections) throws SQLException;
286
}
287
288
// Replication connection
289
public interface ReplicationConnection extends JdbcConnection {
290
long getConnectionGroupId();
291
JdbcConnection getCurrentConnection();
292
JdbcConnection getSourceConnection();
293
void promoteReplicaToSource(String host) throws SQLException;
294
void removeSourceHost(String host) throws SQLException;
295
void removeSourceHost(String host, boolean waitUntilNotInUse) throws SQLException;
296
boolean isHostSource(String host);
297
JdbcConnection getReplicaConnection();
298
void addReplicaHost(String host) throws SQLException;
299
void removeReplica(String host) throws SQLException;
300
void removeReplica(String host, boolean closeGently) throws SQLException;
301
boolean isHostReplica(String host);
302
}
303
304
// Connection group management
305
public class ConnectionGroup {
306
public void addHost(String host, boolean forExisting);
307
public void removeHost(String host);
308
public String getGroupName();
309
public Collection<String> getInitialHosts();
310
public int getInitialHostsSize();
311
}
312
313
public class ConnectionGroupManager {
314
public static void registerConnectionGroup(String group, ConnectionGroup connectionGroup);
315
public static ConnectionGroup getConnectionGroup(String group);
316
public static void addHost(String group, String host, boolean forExisting);
317
public static void removeHost(String group, String host) throws SQLException;
318
}
319
320
// Load balancing strategies
321
public interface BalanceStrategy {
322
void init(Connection conn, Properties props) throws SQLException;
323
Connection pickConnection(InvocationHandler proxy, List<String> hosts,
324
Map<String, JdbcConnection> connections,
325
long[] responseTimes, int numRetries) throws SQLException;
326
}
327
328
public interface LoadBalanceExceptionChecker {
329
boolean shouldExceptionTriggerFailover(SQLException ex);
330
void init(Connection conn, Properties props) throws SQLException;
331
void destroy();
332
}
333
```
334
335
[JDBC High Availability](./jdbc-high-availability.md)
336
337
### X DevAPI Core
338
339
Core X DevAPI interfaces for session management, schema access, and basic document/table operations.
340
341
```java { .api }
342
// Session factory
343
public class SessionFactory {
344
public Session getSession(String url);
345
public Session getSession(Properties properties);
346
}
347
348
// Client factory for connection pooling
349
public class ClientFactory {
350
public Client getClient(String url, String clientPropsJson);
351
public Client getClient(String url, Properties clientProps);
352
}
353
354
// Client interface
355
public interface Client extends Closeable {
356
Session getSession();
357
void close();
358
}
359
360
// Session interface
361
public interface Session extends Closeable {
362
Schema getDefaultSchema();
363
String getDefaultSchemaName();
364
Schema getSchema(String schemaName);
365
List<Schema> getSchemas();
366
Schema createSchema(String schemaName);
367
Schema createSchema(String schemaName, boolean reuseExisting);
368
void dropSchema(String schemaName);
369
String getUri();
370
boolean isOpen();
371
void close();
372
SqlStatement sql(String sql);
373
void startTransaction();
374
void commit();
375
void rollback();
376
String setSavepoint();
377
String setSavepoint(String name);
378
void rollbackTo(String name);
379
void releaseSavepoint(String name);
380
}
381
382
// Schema interface
383
public interface Schema extends DatabaseObject {
384
Collection getCollection(String name);
385
Collection getCollection(String name, boolean requireExists);
386
Collection createCollection(String name);
387
Collection createCollection(String name, boolean reuseExisting);
388
Table getTable(String name);
389
Table getTable(String name, boolean requireExists);
390
List<Collection> getCollections();
391
List<Collection> getCollections(String pattern);
392
List<Table> getTables();
393
List<Table> getTables(String pattern);
394
void dropCollection(String collectionName);
395
}
396
397
// Collection interface
398
public interface Collection extends DatabaseObject {
399
AddStatement add(Map<String, ?> doc);
400
AddStatement add(String... jsonStrings);
401
AddStatement add(DbDoc document);
402
AddStatement add(DbDoc... docs);
403
FindStatement find();
404
FindStatement find(String searchCondition);
405
ModifyStatement modify(String searchCondition);
406
RemoveStatement remove(String searchCondition);
407
DbDoc getOne(String id);
408
Result replaceOne(String id, DbDoc doc);
409
Result replaceOne(String id, String jsonString);
410
Result addOrReplaceOne(String id, DbDoc doc);
411
Result addOrReplaceOne(String id, String jsonString);
412
Result removeOne(String id);
413
long count();
414
DbDoc newDoc();
415
Result createIndex(String indexName, DbDoc indexDefinition);
416
Result createIndex(String indexName, String indexDefinition);
417
void dropIndex(String indexName);
418
}
419
420
// Table interface
421
public interface Table extends DatabaseObject {
422
InsertStatement insert();
423
InsertStatement insert(String... fields);
424
SelectStatement select(String... projection);
425
UpdateStatement update();
426
DeleteStatement delete();
427
long count();
428
boolean isView();
429
}
430
```
431
432
[X DevAPI Core](./xdevapi-core.md)
433
434
### X DevAPI CRUD Operations
435
436
Fluent statement builders for Create, Read, Update, and Delete operations on collections and tables.
437
438
```java { .api }
439
// Add documents to collection
440
public interface AddStatement extends Statement<AddStatement, AddResult> {
441
AddStatement add(DbDoc... docs);
442
AddStatement add(String... jsonStrings);
443
AddResult execute();
444
}
445
446
// Find documents in collection
447
public interface FindStatement extends Statement<FindStatement, DocResult> {
448
FindStatement fields(String... projection);
449
FindStatement groupBy(String... fields);
450
FindStatement having(String having);
451
FindStatement orderBy(String... sortFields);
452
FindStatement limit(long numberOfRows);
453
FindStatement offset(long numberOfRows);
454
FindStatement lockShared();
455
FindStatement lockShared(Statement.LockContention lockContention);
456
FindStatement lockExclusive();
457
FindStatement lockExclusive(Statement.LockContention lockContention);
458
FindStatement bind(String name, Object value);
459
FindStatement bind(Map<String, Object> values);
460
DocResult execute();
461
}
462
463
// Modify documents in collection
464
public interface ModifyStatement extends Statement<ModifyStatement, Result> {
465
ModifyStatement set(String docPath, Object value);
466
ModifyStatement change(String docPath, Object value);
467
ModifyStatement unset(String... fields);
468
ModifyStatement arrayInsert(String docPath, Object value);
469
ModifyStatement arrayAppend(String docPath, Object value);
470
ModifyStatement patch(DbDoc patch);
471
ModifyStatement patch(String jsonPatch);
472
ModifyStatement sort(String... sortFields);
473
ModifyStatement limit(long numberOfRows);
474
ModifyStatement bind(String name, Object value);
475
ModifyStatement bind(Map<String, Object> values);
476
Result execute();
477
}
478
479
// Remove documents from collection
480
public interface RemoveStatement extends Statement<RemoveStatement, Result> {
481
RemoveStatement sort(String... sortFields);
482
RemoveStatement limit(long numberOfRows);
483
RemoveStatement bind(String name, Object value);
484
RemoveStatement bind(Map<String, Object> values);
485
Result execute();
486
}
487
488
// Insert rows into table
489
public interface InsertStatement extends Statement<InsertStatement, InsertResult> {
490
InsertStatement values(Object... values);
491
InsertResult execute();
492
}
493
494
// Select rows from table
495
public interface SelectStatement extends Statement<SelectStatement, RowResult> {
496
SelectStatement where(String searchCondition);
497
SelectStatement groupBy(String... fields);
498
SelectStatement having(String having);
499
SelectStatement orderBy(String... sortFields);
500
SelectStatement limit(long numberOfRows);
501
SelectStatement offset(long numberOfRows);
502
SelectStatement lockShared();
503
SelectStatement lockShared(Statement.LockContention lockContention);
504
SelectStatement lockExclusive();
505
SelectStatement lockExclusive(Statement.LockContention lockContention);
506
SelectStatement bind(String name, Object value);
507
SelectStatement bind(Map<String, Object> values);
508
RowResult execute();
509
}
510
511
// Update rows in table
512
public interface UpdateStatement extends Statement<UpdateStatement, Result> {
513
UpdateStatement set(String field, Object value);
514
UpdateStatement where(String searchCondition);
515
UpdateStatement orderBy(String... sortFields);
516
UpdateStatement limit(long numberOfRows);
517
UpdateStatement bind(String name, Object value);
518
UpdateStatement bind(Map<String, Object> values);
519
Result execute();
520
}
521
522
// Delete rows from table
523
public interface DeleteStatement extends Statement<DeleteStatement, Result> {
524
DeleteStatement where(String searchCondition);
525
DeleteStatement orderBy(String... sortFields);
526
DeleteStatement limit(long numberOfRows);
527
DeleteStatement bind(String name, Object value);
528
DeleteStatement bind(Map<String, Object> values);
529
Result execute();
530
}
531
```
532
533
[X DevAPI CRUD Operations](./xdevapi-crud.md)
534
535
### X DevAPI SQL Operations
536
537
Direct SQL execution and result handling within the X DevAPI context.
538
539
```java { .api }
540
// SQL statement execution
541
public interface SqlStatement extends Statement<SqlStatement, SqlResult> {
542
SqlStatement bind(Object... values);
543
SqlStatement bind(List<Object> values);
544
SqlStatement bind(Map<String, Object> values);
545
SqlResult execute();
546
}
547
548
// SQL result handling
549
public interface SqlResult extends Result, RowResult, Iterator<Row> {
550
boolean hasData();
551
SqlResult nextResult();
552
long getAutoIncrementValue();
553
long getAffectedItemsCount();
554
int getWarningsCount();
555
Iterator<Warning> getWarnings();
556
}
557
558
// Result types
559
public interface Result {
560
long getAffectedItemsCount();
561
int getWarningsCount();
562
Iterator<Warning> getWarnings();
563
}
564
565
public interface DocResult extends FetchResult<DbDoc>, Iterator<DbDoc> {
566
int count();
567
List<DbDoc> fetchAll();
568
}
569
570
public interface RowResult extends FetchResult<Row>, Iterator<Row> {
571
int getColumnCount();
572
List<Column> getColumns();
573
List<String> getColumnNames();
574
int count();
575
List<Row> fetchAll();
576
}
577
578
public interface AddResult extends Result {
579
List<String> getGeneratedIds();
580
}
581
582
public interface InsertResult extends Result {
583
Long getAutoIncrementValue();
584
}
585
```
586
587
[X DevAPI SQL Operations](./xdevapi-sql.md)
588
589
### Configuration and Connection URLs
590
591
Connection URL parsing, property management, and host information for configuring database connections.
592
593
```java { .api }
594
// Connection URL
595
public class ConnectionUrl {
596
public static ConnectionUrl getConnectionUrlInstance(String connString, Properties info);
597
public Type getType();
598
public String getDatabase();
599
public int getDefaultPort();
600
public String getDefaultHost();
601
public List<HostInfo> getHostsList();
602
public HostInfo getMainHost();
603
public Properties getOriginalProperties();
604
public Properties getConnectionArgumentsAsProperties();
605
}
606
607
// Host information
608
public class HostInfo {
609
public String getHost();
610
public int getPort();
611
public String getUser();
612
public String getPassword();
613
public String getDatabase();
614
public Map<String, String> getHostProperties();
615
public String getProperty(String key);
616
}
617
618
// Property keys (partial listing - over 200 properties available)
619
// See configuration.md for complete documentation
620
public enum PropertyKey {
621
// Connection properties
622
USER("user"),
623
PASSWORD("password"),
624
DBNAME("dbname"),
625
HOST("host"),
626
PORT("port"),
627
628
// Configuration properties
629
useSSL("useSSL"),
630
requireSSL("requireSSL"),
631
verifyServerCertificate("verifyServerCertificate"),
632
trustCertificateKeyStoreUrl("trustCertificateKeyStoreUrl"),
633
trustCertificateKeyStorePassword("trustCertificateKeyStorePassword"),
634
clientCertificateKeyStoreUrl("clientCertificateKeyStoreUrl"),
635
clientCertificateKeyStorePassword("clientCertificateKeyStorePassword"),
636
637
// Performance properties
638
cachePrepStmts("cachePrepStmts"),
639
prepStmtCacheSize("prepStmtCacheSize"),
640
prepStmtCacheSqlLimit("prepStmtCacheSqlLimit"),
641
useServerPrepStmts("useServerPrepStmts"),
642
useLocalSessionState("useLocalSessionState"),
643
rewriteBatchedStatements("rewriteBatchedStatements"),
644
645
// Timeout properties
646
connectTimeout("connectTimeout"),
647
socketTimeout("socketTimeout"),
648
connectionLifecycleInterceptors("connectionLifecycleInterceptors"),
649
650
// Character encoding and timezone
651
characterEncoding("characterEncoding"),
652
connectionCollation("connectionCollation"),
653
connectionTimeZone("connectionTimeZone", "serverTimezone"), // serverTimezone is an alias
654
655
// Logging
656
logger("logger"),
657
profileSQL("profileSQL"),
658
useUsageAdvisor("useUsageAdvisor");
659
660
private final String keyName;
661
private final String alias;
662
PropertyKey(String keyName) {
663
this(keyName, null);
664
}
665
PropertyKey(String keyName, String alias) {
666
this.keyName = keyName;
667
this.alias = alias;
668
}
669
public String getKeyName() { return keyName; }
670
}
671
672
// Property set interface
673
public interface PropertySet {
674
void initializeProperties(Properties props);
675
<T> RuntimeProperty<T> getProperty(PropertyKey key);
676
<T> RuntimeProperty<T> getProperty(String name);
677
RuntimeProperty<Boolean> getBooleanProperty(PropertyKey key);
678
RuntimeProperty<Integer> getIntegerProperty(PropertyKey key);
679
RuntimeProperty<Long> getLongProperty(PropertyKey key);
680
RuntimeProperty<String> getStringProperty(PropertyKey key);
681
}
682
683
// Property definitions
684
public interface PropertyDefinition<T> {
685
String getName();
686
T getDefaultValue();
687
boolean hasValueConstraints();
688
boolean isRangeBased();
689
String[] getAllowableValues();
690
int getLowerBound();
691
int getUpperBound();
692
}
693
694
// Runtime property
695
public interface RuntimeProperty<T> {
696
PropertyDefinition<T> getPropertyDefinition();
697
void initializeFrom(Properties extractFrom);
698
T getValue();
699
void setValue(T value);
700
boolean isExplicitlySet();
701
}
702
703
// Connection properties transform
704
public interface ConnectionPropertiesTransform {
705
Properties transformProperties(Properties props);
706
}
707
```
708
709
[Configuration and Connection URLs](./configuration.md)
710
711
### Exception Handling
712
713
Comprehensive exception hierarchy for handling errors and exceptional conditions throughout the driver.
714
715
```java { .api }
716
// Base exception
717
public class CJException extends RuntimeException {
718
public CJException();
719
public CJException(String message);
720
public CJException(Throwable cause);
721
public CJException(String message, Throwable cause);
722
}
723
724
// Communication exceptions
725
public class CJCommunicationsException extends CJException {
726
public CJCommunicationsException(String message);
727
public CJCommunicationsException(String message, Throwable cause);
728
}
729
730
public class CommunicationsException extends SQLException {
731
public CommunicationsException(String message, Throwable underlyingException);
732
}
733
734
// Timeout and cancellation
735
public class CJTimeoutException extends CJException {
736
public CJTimeoutException(String message);
737
}
738
739
public class MySQLTimeoutException extends SQLException {
740
public MySQLTimeoutException();
741
public MySQLTimeoutException(String message);
742
}
743
744
public class MySQLStatementCancelledException extends SQLException {
745
public MySQLStatementCancelledException();
746
public MySQLStatementCancelledException(String message);
747
}
748
749
public class MySQLQueryInterruptedException extends SQLException {
750
public MySQLQueryInterruptedException();
751
}
752
753
// Transaction exceptions
754
public class MySQLTransactionRollbackException extends SQLException
755
implements DeadlockTimeoutRollbackMarker {
756
public MySQLTransactionRollbackException();
757
public MySQLTransactionRollbackException(String message);
758
}
759
760
// Data exceptions
761
public class DataConversionException extends CJException {
762
public DataConversionException(String message);
763
}
764
765
public class DataReadException extends CJException {
766
public DataReadException(String message);
767
public DataReadException(Throwable cause);
768
}
769
770
public class DataTruncationException extends CJException {
771
public DataTruncationException(String message);
772
}
773
774
public class MysqlDataTruncation extends DataTruncation {
775
public MysqlDataTruncation(String message, int index, boolean parameter,
776
boolean read, int dataSize, int transferSize, int vendorErrorCode);
777
}
778
779
// Connection exceptions
780
public class ConnectionIsClosedException extends CJException {
781
public ConnectionIsClosedException();
782
public ConnectionIsClosedException(String message);
783
}
784
785
public class UnableToConnectException extends CJException {
786
public UnableToConnectException(String message);
787
public UnableToConnectException(String message, Throwable cause);
788
}
789
790
public class CJConnectionFeatureNotAvailableException extends CJException {
791
public CJConnectionFeatureNotAvailableException();
792
}
793
794
public class ConnectionFeatureNotAvailableException extends SQLException {
795
public ConnectionFeatureNotAvailableException(String message, Throwable underlyingException);
796
}
797
798
// Operation exceptions
799
public class CJOperationNotSupportedException extends CJException {
800
public CJOperationNotSupportedException();
801
public CJOperationNotSupportedException(String message);
802
}
803
804
public class OperationNotSupportedException extends SQLException {
805
public OperationNotSupportedException();
806
public OperationNotSupportedException(String message);
807
}
808
809
public class OperationCancelledException extends CJException {
810
public OperationCancelledException(String message);
811
}
812
813
// Authentication and security
814
public class PasswordExpiredException extends CJException {
815
public PasswordExpiredException();
816
public PasswordExpiredException(String message);
817
}
818
819
public class ClosedOnExpiredPasswordException extends SQLException {
820
public ClosedOnExpiredPasswordException();
821
}
822
823
public class RSAException extends CJException {
824
public RSAException(String message);
825
public RSAException(String message, Throwable cause);
826
}
827
828
public class SSLParamsException extends CJException {
829
public SSLParamsException(String message);
830
public SSLParamsException(String message, Throwable cause);
831
}
832
833
// Packet and protocol exceptions
834
public class CJPacketTooBigException extends CJException {
835
public CJPacketTooBigException();
836
public CJPacketTooBigException(String message);
837
}
838
839
public class PacketTooBigException extends SQLException {
840
public PacketTooBigException(long packetSize);
841
}
842
843
// Other exceptions
844
public class WrongArgumentException extends CJException {
845
public WrongArgumentException(String message);
846
}
847
848
public class InvalidConnectionAttributeException extends CJException {
849
public InvalidConnectionAttributeException(String message);
850
}
851
852
public class PropertyNotModifiableException extends CJException {
853
public PropertyNotModifiableException(String message);
854
}
855
856
public class UnsupportedConnectionStringException extends CJException {
857
public UnsupportedConnectionStringException();
858
}
859
860
public class NumberOutOfRange extends CJException {
861
public NumberOutOfRange(String message);
862
}
863
864
public class FeatureNotAvailableException extends CJException {
865
public FeatureNotAvailableException(String message);
866
}
867
868
public class AssertionFailedException extends CJException {
869
public AssertionFailedException(String message);
870
}
871
872
public class NotUpdatable extends SQLException {
873
public NotUpdatable(String message);
874
}
875
876
// Exception interceptor
877
public interface ExceptionInterceptor {
878
ExceptionInterceptor init(Properties props, Log log);
879
void destroy();
880
Exception interceptException(Exception sqlEx);
881
}
882
883
// Exception factory
884
public class ExceptionFactory {
885
public static <T extends CJException> T createException(Class<T> clazz, String message);
886
public static <T extends CJException> T createException(Class<T> clazz, Throwable cause);
887
public static <T extends CJException> T createException(Class<T> clazz, String message, Throwable cause);
888
}
889
890
// MySQL error numbers
891
public class MysqlErrorNumbers {
892
// Server error codes
893
public static final int ER_HASHCHK = 1000;
894
public static final int ER_NISAMCHK = 1001;
895
public static final int ER_NO = 1002;
896
public static final int ER_YES = 1003;
897
// ... (many more error codes)
898
public static final int ER_MUST_CHANGE_PASSWORD = 1820;
899
public static final int ER_MUST_CHANGE_PASSWORD_LOGIN = 1862;
900
}
901
902
// SQL error mapping
903
public class SQLError {
904
public static SQLException createSQLException(String message, String sqlState,
905
ExceptionInterceptor interceptor);
906
public static String get(String key);
907
}
908
909
// X DevAPI error
910
public class XDevAPIError extends CJException {
911
public XDevAPIError(String message);
912
public XDevAPIError(String message, Throwable cause);
913
}
914
```
915
916
[Exception Handling](./exceptions.md)
917
918
### Authentication and Security
919
920
Authentication callbacks and security mechanisms for various authentication methods.
921
922
```java { .api }
923
// Callback interfaces
924
public interface MysqlCallback {
925
// Marker interface for callbacks
926
}
927
928
public interface MysqlCallbackHandler {
929
void handle(MysqlCallback callback);
930
}
931
932
// OpenID Connect authentication
933
public class OpenidConnectAuthenticationCallback implements MysqlCallback {
934
public OpenidConnectAuthenticationCallback();
935
public void setIdToken(String idToken);
936
public String getIdToken();
937
}
938
939
public class OpenidConnectIdTokenFromFileCallbackHandler implements MysqlCallbackHandler {
940
public OpenidConnectIdTokenFromFileCallbackHandler(String idTokenFile);
941
public void handle(MysqlCallback callback);
942
}
943
944
// WebAuthn authentication
945
public class WebAuthnAuthenticationCallback implements MysqlCallback {
946
public WebAuthnAuthenticationCallback();
947
public void setAuthenticatorData(byte[] authenticatorData);
948
public byte[] getAuthenticatorData();
949
public void setSignature(byte[] signature);
950
public byte[] getSignature();
951
public void setRelyingPartyId(String relyingPartyId);
952
public String getRelyingPartyId();
953
public void setChallenge(byte[] challenge);
954
public byte[] getChallenge();
955
}
956
957
// Username callback
958
public class UsernameCallback implements MysqlCallback {
959
public UsernameCallback();
960
public void setUsername(String username);
961
public String getUsername();
962
}
963
964
// Authentication plugin interface
965
public interface AuthenticationPlugin<M extends Message> {
966
void init(Protocol<M> prot, MysqlCallbackHandler cbh);
967
void reset();
968
void destroy();
969
String getProtocolPluginName();
970
boolean requiresConfidentiality();
971
boolean isReusable();
972
void setAuthenticationParameters(String user, String password);
973
boolean nextAuthenticationStep(M fromServer, List<M> toServer);
974
}
975
976
// Authentication provider
977
public interface AuthenticationProvider<M extends Message> {
978
void init(Protocol<M> prot, PropertySet propertySet, ExceptionInterceptor exceptionInterceptor);
979
void connect(String userName, String password, String database);
980
void changeUser(String userName, String password, String database);
981
}
982
```
983
984
[Authentication and Security](./authentication.md)
985
986
### Logging and Monitoring
987
988
Logging interfaces and implementations, plus profiling capabilities for monitoring driver behavior.
989
990
```java { .api }
991
// Log interface
992
public interface Log {
993
boolean isDebugEnabled();
994
boolean isErrorEnabled();
995
boolean isFatalEnabled();
996
boolean isInfoEnabled();
997
boolean isTraceEnabled();
998
boolean isWarnEnabled();
999
1000
void logDebug(Object msg);
1001
void logDebug(Object msg, Throwable thrown);
1002
void logError(Object msg);
1003
void logError(Object msg, Throwable thrown);
1004
void logFatal(Object msg);
1005
void logFatal(Object msg, Throwable thrown);
1006
void logInfo(Object msg);
1007
void logInfo(Object msg, Throwable thrown);
1008
void logTrace(Object msg);
1009
void logTrace(Object msg, Throwable thrown);
1010
void logWarn(Object msg);
1011
void logWarn(Object msg, Throwable thrown);
1012
}
1013
1014
// Standard logger implementation
1015
public class StandardLogger implements Log {
1016
public StandardLogger(String name);
1017
public StandardLogger(String name, boolean logLocationInfo);
1018
// ... implements all Log methods
1019
}
1020
1021
// SLF4J logger implementation
1022
public class Slf4JLogger implements Log {
1023
public Slf4JLogger(String name);
1024
// ... implements all Log methods
1025
}
1026
1027
// JDK 1.4 logger implementation
1028
public class Jdk14Logger implements Log {
1029
public Jdk14Logger(String name);
1030
// ... implements all Log methods
1031
}
1032
1033
// Null logger (no-op)
1034
public class NullLogger implements Log {
1035
public NullLogger(String instanceName);
1036
// ... implements all Log methods as no-ops
1037
}
1038
1039
// Profiler event interface
1040
public interface ProfilerEvent {
1041
byte getEventType();
1042
String getCatalog();
1043
long getConnectionId();
1044
int getResultSetColumnCount();
1045
long getResultSetRowsCount();
1046
String getMessage();
1047
long getEventCreationTime();
1048
long getEventDuration();
1049
String getDurationUnits();
1050
String getEventCreationPointAsString();
1051
}
1052
1053
// Profiler event handler
1054
public interface ProfilerEventHandler {
1055
void init(Log log);
1056
void destroy();
1057
void consumeEvent(ProfilerEvent evt);
1058
}
1059
1060
// Log utility
1061
public class LogUtils {
1062
public static void logInfo(Log logger, Object message);
1063
public static void logDebug(Log logger, Object message);
1064
public static void logWarn(Log logger, Object message);
1065
public static void logError(Log logger, Object message);
1066
public static void logFatal(Log logger, Object message);
1067
public static void logTrace(Log logger, Object message);
1068
}
1069
```
1070
1071
[Logging and Monitoring](./logging-monitoring.md)
1072
1073
### Interceptors
1074
1075
Query and connection lifecycle interceptors for customizing driver behavior.
1076
1077
```java { .api }
1078
// Query interceptor interface
1079
public interface QueryInterceptor {
1080
QueryInterceptor init(MysqlConnection conn, Properties props, Log log);
1081
1082
<T extends Resultset> T preProcess(Supplier<String> sql, Query interceptedQuery);
1083
1084
boolean executeTopLevelOnly();
1085
1086
void destroy();
1087
1088
<T extends Resultset> T postProcess(Supplier<String> sql, Query interceptedQuery,
1089
T originalResultSet, ServerSession serverSession);
1090
}
1091
1092
// Connection lifecycle interceptor interface
1093
public interface ConnectionLifecycleInterceptor {
1094
ConnectionLifecycleInterceptor init(MysqlConnection conn, Properties props, Log log);
1095
1096
void destroy();
1097
1098
void createNewSession();
1099
1100
void transactionBegun();
1101
1102
void transactionCompleted();
1103
}
1104
1105
// Pre-built interceptors
1106
public class ResultSetScannerInterceptor implements QueryInterceptor {
1107
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log);
1108
// Scans result sets for specific patterns
1109
}
1110
1111
public class ServerStatusDiffInterceptor implements QueryInterceptor {
1112
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log);
1113
// Tracks server status changes
1114
}
1115
1116
public class SessionAssociationInterceptor implements ConnectionLifecycleInterceptor {
1117
public ConnectionLifecycleInterceptor init(MysqlConnection conn, Properties props, Log log);
1118
// Associates sessions with application context
1119
}
1120
1121
public class LoadBalancedAutoCommitInterceptor implements QueryInterceptor {
1122
public QueryInterceptor init(MysqlConnection conn, Properties props, Log log);
1123
// Handles auto-commit in load-balanced environments
1124
}
1125
```
1126
1127
[Interceptors](./interceptors.md)
1128
1129
### Utilities
1130
1131
Utility classes for string manipulation, time handling, encoding, and other common operations.
1132
1133
```java { .api }
1134
// String utilities
1135
public class StringUtils {
1136
public static String toString(byte[] bytes);
1137
public static String toString(byte[] bytes, int offset, int length);
1138
public static String toString(byte[] bytes, String encoding);
1139
public static String toString(byte[] bytes, int offset, int length, String encoding);
1140
public static byte[] getBytes(String s);
1141
public static byte[] getBytes(String s, String encoding);
1142
1143
public static boolean isNullOrEmpty(String str);
1144
public static String stripComments(String src, String stringOpens, String stringCloses,
1145
boolean slashStarComments, boolean slashSlashComments,
1146
boolean hashComments, boolean dashDashComments);
1147
1148
public static int indexOfIgnoreCase(String searchIn, String searchFor);
1149
public static int indexOfIgnoreCase(int startingPosition, String searchIn, String searchFor);
1150
1151
public static List<String> split(String stringVal, String delimiter, boolean trim);
1152
public static String[] split(String stringVal, String delimiter, String markers,
1153
String markerCloses, boolean trim);
1154
}
1155
1156
// String inspector for query parsing
1157
public class StringInspector {
1158
public StringInspector(String source);
1159
public int indexOfIgnoreCase(int startPos, String searchFor);
1160
public int indexOfIgnoreCase(int startPos, String searchFor,
1161
String openingMarkers, String closingMarkers,
1162
SearchMode searchMode);
1163
public String substring(int beginIndex, int endIndex);
1164
}
1165
1166
// Search mode enum
1167
public enum SearchMode {
1168
ALLOW_BACKSLASH_ESCAPE,
1169
SKIP_BETWEEN_MARKERS,
1170
SKIP_BLOCK_COMMENTS,
1171
SKIP_LINE_COMMENTS,
1172
SKIP_WHITE_SPACE;
1173
}
1174
1175
// Time utilities
1176
public class TimeUtil {
1177
public static Time adjustTime(Time time, Calendar fromCal, Calendar toCal);
1178
public static Timestamp adjustTimestamp(Timestamp timestamp, Calendar fromCal, Calendar toCal);
1179
public static Timestamp adjustTimestamp(Timestamp timestamp, TimeZone fromTz, TimeZone toTz);
1180
1181
public static Time parseTime(String timeStr, Calendar cal);
1182
public static Timestamp parseTimestamp(String timestampStr, Calendar cal);
1183
public static Date parseDate(String dateStr, Calendar cal);
1184
}
1185
1186
// Base64 decoder
1187
public class Base64Decoder {
1188
public Base64Decoder();
1189
public byte[] decode(byte[] base64Data);
1190
public byte[] decode(String base64String);
1191
}
1192
1193
// DNS SRV record handling
1194
public class DnsSrv {
1195
public static class SrvRecord {
1196
public String getHost();
1197
public int getPort();
1198
public int getPriority();
1199
public int getWeight();
1200
}
1201
1202
public static List<SrvRecord> lookupSrvRecords(String serviceName);
1203
public static List<SrvRecord> sortSrvRecords(List<SrvRecord> records);
1204
}
1205
1206
// LRU cache
1207
public class LRUCache<K, V> {
1208
public LRUCache(int maxElements);
1209
public void put(K key, V value);
1210
public V get(K key);
1211
public void clear();
1212
public int size();
1213
}
1214
1215
// Data type utilities
1216
public class DataTypeUtil {
1217
public static int getJdbcType(String mysqlType);
1218
public static String getJavaEncodingFromMysqlCharset(String mysqlCharset);
1219
public static String getMysqlCharsetFromJavaEncoding(String javaEncoding);
1220
}
1221
1222
// Escape tokenizer for JDBC escape sequences
1223
public class EscapeTokenizer {
1224
public EscapeTokenizer(String s);
1225
public boolean hasMoreTokens();
1226
public String nextToken();
1227
public char getLastChar();
1228
}
1229
1230
// Lazy string evaluation
1231
public class LazyString {
1232
public LazyString(byte[] buffer, int offset, int length, String encoding);
1233
public String toString();
1234
public int length();
1235
}
1236
1237
// SASLprep for authentication
1238
public class SaslPrep {
1239
public static String prepare(String str);
1240
public static String prepare(String str, boolean allowUnassigned);
1241
}
1242
1243
// Sequential ID lease for connection pools
1244
public class SequentialIdLease {
1245
public SequentialIdLease();
1246
public int allocate();
1247
public void release(int id);
1248
}
1249
1250
// Utilities class
1251
public class Util {
1252
public static boolean isJdbc4();
1253
public static boolean isJdbc42();
1254
public static String stackTraceToString(Throwable t);
1255
public static boolean isCommunityEdition(String serverVersion);
1256
public static boolean isEnterpriseEdition(String serverVersion);
1257
}
1258
1259
// Test utilities
1260
public class TestUtils {
1261
public static Properties getPropertiesFromTestsuiteUrl();
1262
public static String getBuildTestUrl(Properties props);
1263
public static Connection getConnection() throws SQLException;
1264
}
1265
```
1266
1267
[Utilities](./utilities.md)
1268
1269
### Type System
1270
1271
MySQL type enumeration, charset mapping, server version handling, and type conversion utilities for mapping between MySQL, JDBC, and Java types.
1272
1273
```java { .api }
1274
// MySQL type enumeration
1275
public enum MysqlType implements SQLType {
1276
// Numeric types
1277
BIT, TINYINT, TINYINT_UNSIGNED, SMALLINT, SMALLINT_UNSIGNED,
1278
MEDIUMINT, MEDIUMINT_UNSIGNED, INT, INT_UNSIGNED, BIGINT, BIGINT_UNSIGNED,
1279
FLOAT, FLOAT_UNSIGNED, DOUBLE, DOUBLE_UNSIGNED, DECIMAL, DECIMAL_UNSIGNED,
1280
BOOLEAN,
1281
1282
// Date and time types
1283
DATE, TIME, DATETIME, TIMESTAMP, YEAR,
1284
1285
// String types
1286
CHAR, VARCHAR, TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT,
1287
1288
// Binary types
1289
BINARY, VARBINARY, TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB,
1290
1291
// Special types
1292
JSON, ENUM, SET, GEOMETRY, VECTOR, NULL, UNKNOWN;
1293
1294
public String getName();
1295
public int getJdbcType();
1296
public String getClassName();
1297
public static MysqlType getByName(String mysqlTypeName);
1298
public static MysqlType getByJdbcType(int jdbcType);
1299
}
1300
1301
// Charset mapping
1302
public class CharsetMapping {
1303
public static String getJavaEncodingForMysqlCharset(String mysqlCharsetName);
1304
public static String getMysqlCharsetForJavaEncoding(String javaEncoding, ServerVersion version);
1305
public static boolean isMultibyteCharset(String javaEncodingName);
1306
}
1307
1308
// Server version
1309
public class ServerVersion implements Comparable<ServerVersion> {
1310
public ServerVersion(int major, int minor, int subminor);
1311
public ServerVersion(String versionString);
1312
public boolean meetsMinimum(ServerVersion version);
1313
public int compareTo(ServerVersion other);
1314
}
1315
```
1316
1317
[Type System](./type-system.md)
1318
1319
## Common Types
1320
1321
### DbDoc and JSON Types
1322
1323
```java { .api }
1324
// Document interface
1325
public interface DbDoc extends JsonValue, Map<String, JsonValue> {
1326
DbDoc add(String key, JsonValue value);
1327
JsonValue get(Object key); // Inherited from Map
1328
JsonValue remove(Object key); // Inherited from Map
1329
int size(); // Inherited from Map
1330
Set<String> keySet(); // Inherited from Map
1331
}
1332
1333
// JSON value types
1334
public interface JsonValue {
1335
// Base interface for all JSON values
1336
default String toFormattedString();
1337
}
1338
1339
public class JsonString implements JsonValue {
1340
public JsonString();
1341
public JsonString setValue(String value);
1342
public String getString();
1343
}
1344
1345
public class JsonNumber implements JsonValue {
1346
public JsonNumber();
1347
public JsonNumber setValue(String value);
1348
public String getString();
1349
public Integer getInteger();
1350
public BigDecimal getBigDecimal();
1351
}
1352
1353
public class JsonArray extends ArrayList<JsonValue> implements JsonValue {
1354
public JsonArray();
1355
public JsonArray addValue(JsonValue val); // Convenience method
1356
// Inherited from ArrayList: add(), get(), size(), remove(), clear(), etc.
1357
}
1358
1359
public enum JsonLiteral implements JsonValue {
1360
TRUE,
1361
FALSE,
1362
NULL;
1363
}
1364
1365
// DbDoc implementation
1366
public class DbDocImpl implements DbDoc {
1367
public DbDocImpl();
1368
public DbDocImpl(String jsonString);
1369
// ... implements all DbDoc methods
1370
}
1371
```
1372
1373
### Expression and Query Types
1374
1375
```java { .api }
1376
// Expression wrapper
1377
public class Expression {
1378
public static Expression expr(String expressionString);
1379
public String getExpressionString();
1380
}
1381
1382
// Column types
1383
public enum Type {
1384
BIT, TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT,
1385
FLOAT, DECIMAL, DOUBLE,
1386
JSON, STRING, BYTES,
1387
TIME, DATE, DATETIME, TIMESTAMP,
1388
SET, ENUM, GEOMETRY;
1389
}
1390
1391
// Column interface
1392
public interface Column {
1393
String getSchemaName();
1394
String getTableName();
1395
String getTableLabel();
1396
String getColumnName();
1397
String getColumnLabel();
1398
Type getType();
1399
long getLength();
1400
int getFractionalDigits();
1401
boolean isNumberSigned();
1402
String getCollationName();
1403
String getCharacterSetName();
1404
boolean isPadded();
1405
boolean isNullable();
1406
boolean isAutoIncrement();
1407
boolean isPrimaryKey();
1408
boolean isUniqueKey();
1409
boolean isPartKey();
1410
}
1411
1412
// Row interface
1413
public interface Row {
1414
Object getObject(int pos);
1415
Object getObject(String columnName);
1416
DbDoc toDbDoc();
1417
String getString(int pos);
1418
String getString(String columnName);
1419
int getInt(int pos);
1420
int getInt(String columnName);
1421
long getLong(int pos);
1422
long getLong(String columnName);
1423
boolean getBoolean(int pos);
1424
boolean getBoolean(String columnName);
1425
byte[] getBytes(int pos);
1426
byte[] getBytes(String columnName);
1427
Date getDate(int pos);
1428
Date getDate(String columnName);
1429
Timestamp getTimestamp(int pos);
1430
Timestamp getTimestamp(String columnName);
1431
Time getTime(int pos);
1432
Time getTime(String columnName);
1433
BigDecimal getBigDecimal(int pos);
1434
BigDecimal getBigDecimal(String columnName);
1435
}
1436
```
1437
1438
### Warning Interface
1439
1440
```java { .api }
1441
public interface Warning {
1442
int getLevel();
1443
long getCode();
1444
String getMessage();
1445
}
1446
```
1447