Skip to content
Commits on Source (6)
# Change Log
== 2.4.2 - Released on 17 Jun. 2019
## [2.5.3](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.5.3) (07 Jan. 2020)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.5.2...2.5.3)
* CONJ-752 - Manifest file wrong entry - thanks to Christoph Läubrich
* CONJ-750 - protocol error when not setting database with maxscale
* CONJ-747 - JDBC Conversion Function fast-path skipped, always using longer implementation
## [2.5.2](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.5.2) (22 Nov. 2019)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.5.1...2.5.2)
* CONJ-745 - use pool reset only for corrected COM_RESET_CONNECTION
* CONJ-743 - byte signed value wrong serialization for text protocol
* CONJ-742 - ensure plugin using Driver classloader
## [2.5.1](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.5.1) (15 Oct. 2019)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.5.0...2.5.1)
* CONJ-736 - OSGI compliance
* CONJ-737 - Error packet caching_sha2_password not handled when not having a password
* CONJ-738 - PAM authentication multiple exchanges permitting multiple step in connection string
* CONJ-735 - Multi insert regression correction returning multi generated keys
## [2.5.0](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.5.0) (02 Oct. 2019)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.4.4...2.5.0)
* CONJ-663 - Client authentication plugins are now defined as services. The driver has 2 new plugins `caching_sha2_password` and `sha256_password plugin` for MySQL compatibility
* CONJ-733 - Credential service: AWS IAM authentication
* CONJ-727 - Support configuration of custom SSLSocketFactory
* CONJ-561 - JDBC 4.3 partial implementation java.sql.Statement methods isSimpleIdentifier, enquoteIdentifier, enquoteLiteral and enquoteNCharLiteral
* CONJ-692 - ConnectionPoolDataSource interface addition to MariaDbPoolDataSource
* CONJ-563 - closing possible option batch thread on driver deregistration.
* CONJ-732 - Driver getPropertyInfo returns no options information when url is empty
* CONJ-734 - DatabaseMetaData.getSchemaTerm now return "schema", not empty string
## [2.4.4](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.4.4) (14 Sep. 2019)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.4.3...2.4.4)
* CONJ-724 - Do not ignore the Calendar parameter in ResultSet#getTime(int, Calendar)
* CONJ-725 - Connection Failure when using PAM authenticated user on 10.4 MariaDB server
* CONJ-729 - master-slave regression: commit on read-only server Executed only when there is an active transaction on master connection
* CONJ-726 - removing possible NPE after failover on aurora cluster
## [2.4.3](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.4.3) (02 Jul. 2019)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.4.2...2.4.3)
* CONJ-717 - conversion function support for other data type than default MariaDB conversion type
* CONJ-722 - Permit suppression of result-set metadata getTableName for oracle compatibility
* CONJ-719 - Saving values using Java 8 LocalTime does not store fractional parts of seconds
* CONJ-716 - Correcting possible NPE on non thread safe NumberFormat (logging)
## [2.4.2](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.4.2) (17 Jun. 2019)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.4.1...2.4.2)
Security
* [CONJ-679] parse Query when receiving LOAD LOCAL INFILE
* CONJ-679 - parse Query when receiving LOAD LOCAL INFILE
Bugs
* [CONJ-703] ClassNotFoundException when trying to connect using two-authentication in an OSGI environment.
* [CONJ-711] Xid format id is unsigned integer, currently sending as signed value.
* [CONJ-700] autoReconnect=true on Basic Failover doesn't reconnect
* [CONJ-707] failover might throw an unexpected exception with using "failover"/"sequential" configuration on socket error
* [CONJ-709] includeThreadDumpInDeadlockExceptions is thrown only if option includeInnodbStatusInDeadlockExceptions is set
* [CONJ-710] Throw complete stackTrace when having an exception on XA Commands
* [CONJ-714] Error on connection on galera server when in detached mode.
* [CONJ-701] typo in error message in SelectResultSet.java
== 2.4.1 - Released on 15 Mar. 2019
* CONJ-703 - ClassNotFoundException when trying to connect using two-authentication in an OSGI environment.
* CONJ-711 - Xid format id is unsigned integer, currently sending as signed value.
* CONJ-700 - autoReconnect=true on Basic Failover doesn't reconnect
* CONJ-707 - failover might throw an unexpected exception with using "failover"/"sequential" configuration on socket error
* CONJ-709 - includeThreadDumpInDeadlockExceptions is thrown only if option includeInnodbStatusInDeadlockExceptions is set
* CONJ-710 - Throw complete stackTrace when having an exception on XA Commands
* CONJ-714 - Error on connection on galera server when in detached mode.
* CONJ-701 - typo in error message in SelectResultSet.java
## [2.4.1](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.4.1) (15 Mar. 2019)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.4.0...2.4.1)
Evolutions
* [misc] enabled running of 'SHOW ENGINE INNODB STATUS' for error code 1213 (@mtykhenko)
* [misc] reduce mutex using select @@innodb_read_only for aurora (@matsuzayaws)
* misc - enabled running of 'SHOW ENGINE INNODB STATUS' for error code 1213 (@mtykhenko)
* misc - reduce mutex using select @@innodb_read_only for aurora (@matsuzayaws)
Bugs
* [misc] updating checkstyle version dependency
* [misc] permit using SSL on localsocket
* [CONJ-687] addition of option "useMysqlMetadata" to permit MySQL meta compatibility
* [misc] java PID using java 9 ProcessHandle if existing, relying on JNA if present
* [CONJ-682] internal pool correction: when receiving an RST during connection validation, the pool will end up throwing connection timeout exception in place of reusing another connection.
* misc - updating checkstyle version dependency
* misc - permit using SSL on localsocket
* CONJ-687 - addition of option "useMysqlMetadata" to permit MySQL meta compatibility
* misc - java PID using java 9 ProcessHandle if existing, relying on JNA if present
* CONJ-682 - internal pool correction: when receiving an RST during connection validation, the pool will end up throwing connection timeout exception in place of reusing another connection.
== 2.4.0 - Released on 28 Jan. 2019
## [2.4.0](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.4.0) (28 Jan. 2019)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.3.0...2.4.0)
Evolutions
* [CONJ-675] permit multiple alternative authentication methods for the same user (future MariaDB 10.4 feature)
* {CONJ-678] permit indication of truststore/keystore type (JKS/PKCS12), then not relying on java default type
* [CONJ-378] GSSAPI: client can provide SPN
* [CONJ-667] Support MYSQL_TYPE_JSON datatype
* [CONJ-652] faster results buffering socket available
* [CONJ-659] improve text performance reading date/time/timestamp resultset
* [CONJ-670] ability to Refresh SSL certificate
* CONJ-675 - permit multiple alternative authentication methods for the same user (future MariaDB 10.4 feature)
* CONJ-678 - permit indication of truststore/keystore type (JKS/PKCS12), then not relying on java default type
* CONJ-378 - GSSAPI: client can provide SPN
* CONJ-667 - Support MYSQL_TYPE_JSON datatype
* CONJ-652 - faster results buffering socket available
* CONJ-659 - improve text performance reading date/time/timestamp resultset
* CONJ-670 - ability to Refresh SSL certificate
New options
|=useReadAheadInput|use a buffered inputSteam that read socket available data. \\//Default: true//|
|=keyStoreType|indicate key store type (JKS/PKCS12). default is null, then using java default type.|
|=trustStoreType|indicate trust store type (JKS/PKCS12). default is null, then using java default type|
|=servicePrincipalName|when using GSSAPI authentication, SPN (Service Principal Name) use the server SPN information. When set, connector will use this value, ignoring server information|
|Option|Description|
|---|---|
|useReadAheadInput|use a buffered inputSteam that read socket available data. <br /><i>Default: true</i>|
|keyStoreType|indicate key store type (JKS/PKCS12). default is null, then using java default type.|
|trustStoreType|indicate trust store type (JKS/PKCS12). default is null, then using java default type|
|servicePrincipalName|when using GSSAPI authentication, SPN (Service Principal Name) use the server SPN information. When set, connector will use this value, ignoring server information|
Bugs
* [CONJ-646] possible NullPointerException when connection lost to database using aurora configuration with one node
* [CONJ-672] batch using multi-send can hang when using query timeout
* [CONJ-544] disable SSL session resumption when using SSL
* [CONJ-589] correcting Clob.length() for utf8mb4
* [CONJ-649] datasource connectTimeout URL parameter is not honoured
* [CONJ-650] Correction on resultset.getObject(columnName, byte[].class) when value is NULL
* [CONJ-665] old MySQL (<5.5.3) doesn't support utf8mb4, using utf8 on 3 bytes as connection charset by default
* [CONJ-671] MariaDb bulk threads occupy full cpu(99%) while db connections broken
* [CONJ-673] abording a connection while fetching a query still does read whole resultset
* [CONJ-669] SQLSyntaxErrorException when querying on empty column name
* [CONJ-674] make dumpQueriesOnException = false by default as per documentation
* CONJ-646 - possible NullPointerException when connection lost to database using aurora configuration with one node
* CONJ-672 - batch using multi-send can hang when using query timeout
* CONJ-544 - disable SSL session resumption when using SSL
* CONJ-589 - correcting Clob.length() for utf8mb4
* CONJ-649 - datasource connectTimeout URL parameter is not honoured
* CONJ-650 - Correction on resultset.getObject(columnName, byte[].class) when value is NULL
* CONJ-665 - old MySQL (<5.5.3) doesn't support utf8mb4, using utf8 on 3 bytes as connection charset by default
* CONJ-671 - MariaDb bulk threads occupy full cpu(99%) while db connections broken
* CONJ-673 - abording a connection while fetching a query still does read whole resultset
* CONJ-669 - SQLSyntaxErrorException when querying on empty column name
* CONJ-674 - make dumpQueriesOnException = false by default as per documentation
minor:
* [CONJ-644] small optimization when validating galera connection
* [CONJ-625] add coverage test
* [CONJ-654] DatabaseMetaData.getDriverName() returns connector/J with a lowercase c
* CONJ-644 - small optimization when validating galera connection
* CONJ-625 - add coverage test
* CONJ-654 - DatabaseMetaData.getDriverName() returns connector/J with a lowercase c
== 2.3.0 - 06 Sep. 2018
## [2.3.0](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.3.0) (06 Sep. 2018)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.2.6...2.3.0)
==== [CONJ-398] Improve deadlock debugging capabilities
#### [CONJ-398] Improve deadlock debugging capabilities
MariaDB has now 2 new options to permit identifying deadlock :
New options
|=includeInnodbStatusInDeadlockExceptions|add "SHOW ENGINE INNODB STATUS" result to exception trace when having a deadlock exception.\\//Default: false//
|=includeThreadDumpInDeadlockExceptions|add thread dump to exception trace when having a deadlock exception.\\//Default: false//
==== [CONJ-639] the option "enabledSslProtocolSuites" now include TLSv1.2 by default
|Option|Description|
|---|---|
|includeInnodbStatusInDeadlockExceptions|add "SHOW ENGINE INNODB STATUS" result to exception trace when having a deadlock exception.<br /><i>//Default: false</i>|
|includeThreadDumpInDeadlockExceptions|add thread dump to exception trace when having a deadlock exception.<br /><i>Default: false</i>|
#### [CONJ-639] the option "enabledSslProtocolSuites" now include TLSv1.2 by default
previous default value was "TLSv1, TLSv1.1", disabling TLSv1.2 by default, due to a corrected issue (MDEV-12190) with servers using YaSSL - not openSSL. Server error was .
Now, the default value is "TLSv1, TLSv1.1, TLSv1.2". So TLSv1.2 can be use directly.
Connecting MySQL community server use YaSSL without correction, and connection might result in SSLException: "Unsupported record version Unknown-0.0".
==== [CONJ-642] disable the option "useBulkStmts" by default
#### [CONJ-642] disable the option "useBulkStmts" by default
Using useBulkStmts permit faster batch, but cause one major issue : Batch return -1 = SUCCESS_NO_INFO
Different option use this information for optimistic update, and cannot confirm if update succeed or not.
This option still makes sense, since for big batch is way more faster, but will not be activated by default.
=== Minor change:
* [CONJ-628] optimization to read metadata faster
* [CONJ-637] java.sql.Driver class implement DriverPropertyInfo[] getPropertyInfo, permitting listing options on querying tools
* [CONJ-639] enabledSslProtocolSuites does not include TLSv1.2 by default
* [CONJ-641] update maven test dependencies for java 10 compatibility
* [CONJ-643] PreparedStatement::getParameterMetaData always returns VARSTRING as type resulting in downstream libraries interpreting values wrongly
##= Minor change:
* CONJ-628 - optimization to read metadata faster
* CONJ-637 - java.sql.Driver class implement DriverPropertyInfo[] getPropertyInfo, permitting listing options on querying tools
* CONJ-639 - enabledSslProtocolSuites does not include TLSv1.2 by default
* CONJ-641 - update maven test dependencies for java 10 compatibility
* CONJ-643 - PreparedStatement::getParameterMetaData always returns VARSTRING as type resulting in downstream libraries interpreting values wrongly
=== Bug correction:
* [CONJ-616] correction on possible NPE on getConnection when using failover configuration and master is down, not throwing a proper exception
* [CONJ-636] Error in batch might throw a NPE and not the proper Exception
##= Bug correction:
* CONJ-616 - correction on possible NPE on getConnection when using failover configuration and master is down, not throwing a proper exception
* CONJ-636 - Error in batch might throw a NPE and not the proper Exception
== 2.2.6
## [2.2.6](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.2.6) (19 Jul. 2018)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.2.5...2.2.6)
minor change:
* [CONJ-623] Increase connection logging when Primary node connection fails
* [CONJ-384] Permit knowing affected rows number, not only real changed rows
* CONJ-623 - Increase connection logging when Primary node connection fails
* CONJ-384 - Permit knowing affected rows number, not only real changed rows
New options
|=useAffectedRows|default correspond to the JDBC standard, reporting real affected rows. if enable, will report "affected" rows. example : if enable, an update command that doesn't change a row value will still be "affected", then report.\\//Default: false. Since 2.2.6//
|=useAffectedRows|default correspond to the JDBC standard, reporting real affected rows. if
enable, will report "affected" rows. example : if enable, an update command that doesn't change a row value will still be "affected", then report.<br /><i>Default: false. Since 2.2.6</i>
Bug correction:
* [CONJ-624] MariaDbPoolDataSource possible NPE on configuration getter
* [CONJ-623] Increase connection logging when Primary node connection fails
* [CONJ-622] The option "connectTimeout" must take in account DriverManager.getLoginTimeout() when set
* [CONJ-621] wrong escaping when having curly bracket in table/field name
* [CONJ-618] Client preparestatement parsing error on escaped ' / " in query
* CONJ-624 - MariaDbPoolDataSource possible NPE on configuration getter
* CONJ-623 - Increase connection logging when Primary node connection fails
* CONJ-622 - The option "connectTimeout" must take in account DriverManager.getLoginTimeout() when set
* CONJ-621 - wrong escaping when having curly bracket in table/field name
* CONJ-618 - Client preparestatement parsing error on escaped ' / " in query
## [2.2.5](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.2.5) (28 May. 2018)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.2.4...2.2.5)
== 2.2.5
minor change:
* [CONJ-602] Add server hostname to connection packet for proxy
* [CONJ-604] handle support for mysql 8.0 tx_isolation replacement by transaction_isolation
* CONJ-602 - Add server hostname to connection packet for proxy
* CONJ-604 - handle support for mysql 8.0 tx_isolation replacement by transaction_isolation
Bug correction:
* [CONJ-613] Connection using "replication" Parameters fail when no slave is available
* [CONJ-595] Create option to configure DONOR/DESYNCED Galera nodes to be unavailable for load-balancing
* [CONJ-605] Newlines where breaking calling stored procedures
* [CONJ-609] Using getDate with function DATE_ADD() with parameter using string format where return wrong result using binary protocol
* [CONJ-610] Option "allowMasterDownConnection" improvement on connection validation and Exceptions on master down
* CONJ-613 - Connection using "replication" Parameters fail when no slave is available
* CONJ-595 - Create option to configure DONOR/DESYNCED Galera nodes to be unavailable for load-balancing
* CONJ-605 - Newlines where breaking calling stored procedures
* CONJ-609 - Using getDate with function DATE_ADD() with parameter using string format where return wrong result using binary protocol
* CONJ-610 - Option "allowMasterDownConnection" improvement on connection validation and Exceptions on master down
== 2.2.4
## [2.2.4](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.2.4) (04 May. 2018)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.2.3...2.2.4)
Minor changes:
* [CONJ-580] Some options are missing in documentation like default 'autocommit' value
* [CONJ-597] Internal exchanges send utf8mb4 with server even if default server collation is not utf8/utf8mb4
* [CONJ-600] Upgrading non mandatory Waffle dependency to 1.9.0 (windows GSSAPI authentication)
* [CONJ-575] test addition to ensure YaSSL downgrade TLSv1.2 protocol to TLSv1.1
* CONJ-580 - Some options are missing in documentation like default 'autocommit' value
* CONJ-597 - Internal exchanges send utf8mb4 with server even if default server collation is not utf8/utf8mb4
* CONJ-600 - Upgrading non mandatory Waffle dependency to 1.9.0 (windows GSSAPI authentication)
* CONJ-575 - test addition to ensure YaSSL downgrade TLSv1.2 protocol to TLSv1.1
== 2.2.3
## [2.2.3](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.2.3) (08 Mar. 2018)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.2.2...2.2.3)
Bug correction:
* [CONJ-583] possible hang indefinitely using master/slave configuration and failover occur
* [CONJ-586] erroneous transaction state when first command result as error
* [CONJ-587] using allowMasterDownConnection option can lead to NPE when using setReadOnly()
* [CONJ-588] using option 'allowMasterDownConnection' won't permit to connect if master is down
* [CONJ-534] Connection.isValid() must be routed to Master and Slave connections to avoid any server timeout
* CONJ-583 - possible hang indefinitely using master/slave configuration and failover occur
* CONJ-586 - erroneous transaction state when first command result as error
* CONJ-587 - using allowMasterDownConnection option can lead to NPE when using setReadOnly()
* CONJ-588 - using option 'allowMasterDownConnection' won't permit to connect if master is down
* CONJ-534 - Connection.isValid() must be routed to Master and Slave connections to avoid any server timeout
== 2.2.2
## [2.2.2](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.2.2) (20 Feb. 2018)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.2.1...2.2.2)
Bug correction:
* [CONJ-564] Never ever throw an instance of java.lang.Error
* [CONJ-579] Keywords missing from DatabaseMetaData.getSQLKeywords()
* [CONJ-567] UrlParser.initialUrl gets overwritten
* [CONJ-571] Permit java 9 serialization filtering
* [CONJ-574] forcing using toLowerCase/toUpperCase with Locale.ROOT
* [CONJ-560] Automatic module name for java 9
* [CONJ-578] windows testing using all mariadb server
* [CONJ-570] Add tests for 10.3.3 INVISIBLE column
* CONJ-564 - Never ever throw an instance of java.lang.Error
* CONJ-579 - Keywords missing from DatabaseMetaData.getSQLKeywords()
* CONJ-567 - UrlParser.initialUrl gets overwritten
* CONJ-571 - Permit java 9 serialization filtering
* CONJ-574 - forcing using toLowerCase/toUpperCase with Locale.ROOT
* CONJ-560 - Automatic module name for java 9
* CONJ-578 - windows testing using all mariadb server
* CONJ-570 - Add tests for 10.3.3 INVISIBLE column
== 2.2.1
## [2.2.1](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.2.1) (22 Dec. 2017)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.2.0...2.2.1)
* [CONJ-501] provide support for authentication plugin ed25519
* CONJ-501 - provide support for authentication plugin ed25519
Bug correction:
* [CONJ-529] failover : the driver will pause for 250ms if no servers are available before attempting to reconnect another time
* [CONJ-548] don't use COM_STMT_BULK_EXECUTE for INSERT ... SELECT statements
* [CONJ-549] correction on connection reset when using MariaDbPoolDataSource with options useServerPrepStmts and useResetConnection enabled
* [CONJ-555] failover caused by client timeout must not reuse connection
* [CONJ-558] removing extra ".0" to resultset.getString() value for FLOAT/DOUBLE fields
* [CONJ-550] fetching state correction when reusing statement without having read all results
* [CONJ-553] RejectedExecutionException was thrown when having large amount of concurrent batches
* CONJ-529 - failover : the driver will pause for 250ms if no servers are available before attempting to reconnect another time
* CONJ-548 - don't use COM_STMT_BULK_EXECUTE for INSERT ... SELECT statements
* CONJ-549 - correction on connection reset when using MariaDbPoolDataSource with options useServerPrepStmts and useResetConnection enabled
* CONJ-555 - failover caused by client timeout must not reuse connection
* CONJ-558 - removing extra ".0" to resultset.getString() value for FLOAT/DOUBLE fields
* CONJ-550 - fetching state correction when reusing statement without having read all results
* CONJ-553 - RejectedExecutionException was thrown when having large amount of concurrent batches
== 2.2.0
## [2.2.0](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.2.0) (08 Nov. 2017)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.1.2...2.2.0)
Evolutions:
==== [CONJ-522] Pool datasource implementation
#### CONJ-522 - Pool datasource implementation
MariaDB has now 2 different Datasource implementation :
* MariaDbDataSource : Basic implementation. A new connection each time method getConnection() is called.
* MariaDbPoolDataSource : Connection pooling implementation. MariaDB Driver will keep a pool of connection and borrow Connections when asked for it.
New options
|=pool|Use pool. This option is useful only if not using a DataSource object, but only connection object. \\//Default: false. since 2.2.0//|
|=poolName|Pool name that will permit to identify thread.\\default: auto-generated as MariaDb-pool-<pool-index>//since 2.2.0//|
|=maxPoolSize| The maximum number of physical connections that the pool should contain. \\//Default: 8. since 2.2.0//|
|=minPoolSize| When connection are removed since not used since more than "maxIdleTime", connections are closed and removed from pool. "minPoolSize" indicate the number of physical connections the pool should keep available at all times. Should be less or equal to maxPoolSize.\\//Default: maxPoolSize value. Since 2.2.0//|
|=poolValidMinDelay| When asking a connection to pool, Pool will validate connection state. "poolValidMinDelay" permit to disable this validation if connection has been borrowed recently avoiding useless verification in case of frequent reuse of connection. 0 meaning validation is done each time connection is asked.\\//Default: 1000 (in milliseconds). Since 2.2.0//|
|=maxIdleTime|The maximum amount of time in seconds that a connection can stay in pool when not used. This value must always be below @wait_timeout value - 45s \\//Default: 600 in seconds (=10 minutes), minimum value is 60 seconds. Since 2.2.0//|
|=staticGlobal|Indicate the following global variable (@@max_allowed_packet,@@wait_timeout,@@autocommit,@@auto_increment_increment,@@time_zone,@@system_time_zone,@@tx_isolation) values won't changed, permitting to pool to create new connection faster.\\//Default: false. Since 2.2.0//|
|=useResetConnection|When a connection is closed() (give back to pool), pool reset connection state. Setting this option, session variables change will be reset, and user variables will be destroyed when server permit it (MariaDB >= 10.2.4, MySQL >= 5.7.3), permitting to save memory on server if application make extensive use of variables\\//Default: false. Since 2.2.0//|
|Option|Description|
|---|---|
|pool|Use pool. This option is useful only if not using a DataSource object, but only connection object. <br /><i>Default: false. since 2.2.0</i>|
|poolName|Pool name that will permit to identify thread.<br />default: auto-generated as MariaDb-pool-<pool-index> <i>since 2.2.0</i>|
|maxPoolSize| The maximum number of physical connections that the pool should contain. <br /><i>Default: 8. since 2.2.0</i>|
|minPoolSize| When connection are removed since not used since more than "maxIdleTime", connections are closed and removed from pool. "minPoolSize" indicate the number of physical connections the pool should keep available at all times. Should be less or equal to maxPoolSize.<br /><i>Default: maxPoolSize value. Since 2.2.0</i>|
|poolValidMinDelay| When asking a connection to pool, Pool will validate connection state. "poolValidMinDelay" permit to disable this validation if connection has been borrowed recently avoiding useless verification in case of frequent reuse of connection. 0 meaning validation is done each time connection is asked.<br /><i>Default: 1000 (in milliseconds). Since 2.2.0</i>|
|maxIdleTime|The maximum amount of time in seconds that a connection can stay in pool when not used. This value must always be below @wait_timeout value - 45s <br /><i>Default: 600 in seconds (=10 minutes), minimum value is 60 seconds. Since 2.2.0</i>|
|staticGlobal|Indicate the following global variable (@@max_allowed_packet,@@wait_timeout,@@autocommit,@@auto_increment_increment,@@time_zone,@@system_time_zone,@@tx_isolation) values won't changed, permitting to pool to create new connection faster.<br /><i>Default: false. Since 2.2.0</i>|
|useResetConnection|When a connection is closed() (give back to pool), pool reset connection state. Setting this option, session variables change will be reset, and user variables will be destroyed when server permit it (MariaDB >= 10.2.4, MySQL >= 5.7.3), permitting to save memory on server if application make extensive use of variables<br /><i>Default: false. Since 2.2.0</i>|
Other evolutions:
[CONJ-530] Permit Connection.abort() forcing killing the connection, even if connection is stuck in another thread
[CONJ-531] permit cancelling streaming result-set using Statement.cancel.
[CONJ-495] Improve reading result-set data
[CONJ-510] allow execution of read-only statements on slaves when master is down
* CONJ-530 - Permit Connection.abort() forcing killing the connection, even if connection is stuck in another thread
* CONJ-531 - permit cancelling streaming result-set using Statement.cancel.
* CONJ-495 - Improve reading result-set data
* CONJ-510 - allow execution of read-only statements on slaves when master is down
Bug :
[CONJ-532] correction Statement.getMoreResults() for multi-queries
[CONJ-533] PrepareStatement.setTime() may insert incorrect time according to current timezone, time and option "useLegacyDatetimeCode"
[CONJ-535] correction on numerical getter for big BIT data type fields
[CONJ-541] Fix behavior of ResultSet#relative when crossing result set boundaries
* CONJ-532 - correction Statement.getMoreResults() for multi-queries
* CONJ-533 - PrepareStatement.setTime() may insert incorrect time according to current timezone, time and option "useLegacyDatetimeCode"
* CONJ-535 - correction on numerical getter for big BIT data type fields
* CONJ-541 - Fix behavior of ResultSet#relative when crossing result set boundaries
Misc:
[CONJ-469] Improve Blob/Clob implementation (avoiding array copy from result-set row)
[CONJ-539] better message when server close connection
[misc] resultset.findColumn method use column name if alias not found
[misc] default option "connectTimeout" value to 30 seconds (was 0 = no timeout)
[misc] ensure that enablePacketDebug option works when timer tick is big
* CONJ-469 - Improve Blob/Clob implementation (avoiding array copy from result-set row)
* CONJ-539 - better message when server close connection
* misc - resultset.findColumn method use column name if alias not found
* misc - default option "connectTimeout" value to 30 seconds (was 0 = no timeout)
* misc - ensure that enablePacketDebug option works when timer tick is big
== 2.1.2
## [2.1.2](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.1.2) (24 Sep. 2017)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.1.1...2.1.2)
Bug :
* [CONJ-525] Batch result-set return array correction when DELETE statement when bulk option is used
* [CONJ-526] better error message getting metadata information when SQL syntax is wrong
* [CONJ-527] Resultset.last() return wrong value if resultset has only one result
* [CONJ-528] Error executing LOAD DATA LOCAL INFILE when file is larger than max_allowed_packet
* CONJ-525 - Batch result-set return array correction when DELETE statement when bulk option is used
* CONJ-526 - better error message getting metadata information when SQL syntax is wrong
* CONJ-527 - Resultset.last() return wrong value if resultset has only one result
* CONJ-528 - Error executing LOAD DATA LOCAL INFILE when file is larger than max_allowed_packet
== 2.1.1
## [2.1.1](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.1.1) (05 Sep. 2017)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.1.0...2.1.1)
Bug :
* [CONJ-519] Updatable result-set possible NPE when same field is repeated.
* [CONJ-514] ResultSet method wasNull() always return true after a call on a "null-date" field binary protocol handling
* [CONJ-516] Permit using updatable result-set when fetching
* [CONJ-511] Add legacy SSL certificate Hostname verification with CN even when SAN are set
* [CONJ-515] Improve MariaDB driver stability in case JNA errors
* CONJ-519 - Updatable result-set possible NPE when same field is repeated.
* CONJ-514 - ResultSet method wasNull() always return true after a call on a "null-date" field binary protocol handling
* CONJ-516 - Permit using updatable result-set when fetching
* CONJ-511 - Add legacy SSL certificate Hostname verification with CN even when SAN are set
* CONJ-515 - Improve MariaDB driver stability in case JNA errors
misc :
* correct typo in error message when setting wrong parameter
* add trace to HostnameVerifier implementation
* handling connection error when no database is provided
== 2.1.0
=== CONJ-422 : verification of SSL Certificate Name Mismatch
## [2.1.0](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.1.0) (29 Jul. 2017)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.0.3...2.1.0)
##= CONJ-422 : verification of SSL Certificate Name Mismatch
When using ssl, driver check hostname against the server's identity as presented in the server's Certificate (checking alternative names or certificate CN) to prevent man-in-the-middle attack.
A new option "disableSslHostnameVerification" permit to deactivate this validation.
|=disableSslHostnameVerification| When using ssl, driver check hostname against the server's identity as presented in the server's Certificate (checking alternative names or certificate CN) to prevent man-in-the-middle attack. This option permit to deactivate this validation.\\//Default: false. Since 2.1.0//
|=disableSslHostnameVerification| When using ssl, driver check hostname against the server's identity as presented in the server's Certificate (checking alternative names or certificate CN) to prevent man-in-the-middle attack. This option permit to deactivate this validation.<br />//Default: false. Since 2.1.0//
=== CONJ-400 - Galera validation
##= CONJ-400 - Galera validation
When configuration with multi-master, Connection.isValid() will not only validate connection, but primary state.
A connection to a node that is not in primary mode will return false (then for pool, connection will be discarded)
=== CONJ-322 - ResultSet.update* methods implementation
##= CONJ-322 - ResultSet.update* methods implementation
ResultSet.update* methods aren't implemented
statement using ResultSet.CONCUR_UPDATABLE must be able to update record.
exemple:
......@@ -263,54 +346,58 @@ exemple:
}}}
=== CONJ-389 - faster batch insert
##= CONJ-389 - faster batch insert
Use dedicated [COM_STMT_BULK_EXECUTE |https://mariadb.com/kb/en/mariadb/com_stmt_bulk_execute/] protocol for batch insert when possible.
(batch without Statement.RETURN_GENERATED_KEYS and streams) to have faster batch.
(significant only if server MariaDB &ge; 10.2.7)
A new option "useBulkStmts" permit to deactivate this functionality.
|=useBulkStmts| Use dedicated COM_STMT_BULK_EXECUTE protocol for batch insert when possible. (batch without Statement.RETURN_GENERATED_KEYS and streams) to have faster batch. (significant only if server MariaDB &ge; 10.2.7)\\//Default: true. Since 2.1.0//
|=useBulkStmts| Use dedicated COM_STMT_BULK_EXECUTE protocol for batch insert when possible. (batch without Statement.RETURN_GENERATED_KEYS and streams) to have faster batch. (significant only if server MariaDB &ge; 10.2.7)<br />//Default: true. Since 2.1.0//
other evolution
*[CONJ-508] Connection.getCatalog() optimisation for 10.2+ server using new session_track_schema capabilities
*[CONJ-492] Failover handle automatic reconnection on KILL command
* CONJ-508 - Connection.getCatalog() optimisation for 10.2+ server using new session_track_schema capabilities
* CONJ-492 - Failover handle automatic reconnection on KILL command
Bug
*[CONJ-502] isolation leak when using multiple pools on same VM on failover
*[CONJ-503] regression on aurora Connection Connection.isReadOnly()
*[CONJ-505] correcting issue that ended throwing "Unknown prepared statement handler given to mysqld_stmt_execute"
*[CONJ-496] return rounded numeric when querying on a decimal field in place of throwing an exception for compatibility
* CONJ-502 - isolation leak when using multiple pools on same VM on failover
* CONJ-503 - regression on aurora Connection Connection.isReadOnly()
* CONJ-505 - correcting issue that ended throwing "Unknown prepared statement handler given to mysqld_stmt_execute"
* CONJ-496 - return rounded numeric when querying on a decimal field in place of throwing an exception for compatibility
== 2.0.3
## [2.0.3](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.0.3) (27 Jun. 2017)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.0.2...2.0.3)
Bug
*[CONJ-473] when useServerPrepStmts is not set, the PREPARE statement must not be cached.
*[CONJ-494] Handle PrepareStatement.getParameterMetaData() if query cannot be PREPAREd
*[CONJ-497] escape string correction for big query
* CONJ-473 - when useServerPrepStmts is not set, the PREPARE statement must not be cached.
* CONJ-494 - Handle PrepareStatement.getParameterMetaData() if query cannot be PREPAREd
* CONJ-497 - escape string correction for big query
== 1.6.1
report of 2.0.2 corrections for jre 1.7 compatible version.
## [2.0.2](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.0.2) (05 Jun. 2017)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.0.1...2.0.2)
== 2.0.2
Bug
*[CONJ-490] - DataSource connectTimeout is in second, but was set on socket timeout that is in milliseconds
*[CONJ-481] - Buffer overrun reading ResultSet when using option "useServerPrepStmts"
*[CONJ-470] - Error when executing SQL contains "values" and rewriteBatchedStatements=true
*[CONJ-471] - PK_NAME returned by DatabaseMetadata.getPrimaryKeys() should not be null
*[CONJ-477] - Aurora not compatible with option usePipelineAuth. Now automatically disabled when aurora is detected
*[CONJ-479] - ArrayIndexOutOfBoundsException on connect to MySQL 5.1.73
*[CONJ-480] - Access denied error on connect to MySQL 5.1.73
*[CONJ-483] - Wrong content of DEFERRABILITY column in MariaDbDatabaseMetaData
*[CONJ-487] - No timeout exception on Client PrepareStatement
*[CONJ-489] - javax.transaction.xa.XAException message error truncated ( near '0x )
* CONJ-490 - DataSource connectTimeout is in second, but was set on socket timeout that is in milliseconds
* CONJ-481 - Buffer overrun reading ResultSet when using option "useServerPrepStmts"
* CONJ-470 - Error when executing SQL contains "values" and rewriteBatchedStatements=true
* CONJ-471 - PK_NAME returned by DatabaseMetadata.getPrimaryKeys() should not be null
* CONJ-477 - Aurora not compatible with option usePipelineAuth. Now automatically disabled when aurora is detected
* CONJ-479 - ArrayIndexOutOfBoundsException on connect to MySQL 5.1.73
* CONJ-480 - Access denied error on connect to MySQL 5.1.73
* CONJ-483 - Wrong content of DEFERRABILITY column in MariaDbDatabaseMetaData
* CONJ-487 - No timeout exception on Client PrepareStatement
* CONJ-489 - javax.transaction.xa.XAException message error truncated ( near '0x )
Task
*[CONJ-478] - Change CI tests to use maxscale 2.1 version
*[CONJ-482] - Connection.setNetworkTimeout don't throw exception if no executor
*[CONJ-488] - Use java.net.URL to read keyStore and trustStore again
* CONJ-478 - Change CI tests to use maxscale 2.1 version
* CONJ-482 - Connection.setNetworkTimeout don't throw exception if no executor
* CONJ-488 - Use java.net.URL to read keyStore and trustStore again
## [2.0.1](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.0.1) (10 May. 2017)
[Full Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/compare/2.0.0-RC...2.0.1)
== 2.0.1
* CONJ-467 - changing database metadata to 4.2
* CONJ-460 - Query that contain multiqueries with fetch and EOF deprecation failed
* CONJ-464 - Using of "slowQueryThresholdNanos" option with value > Integer.MAX_VALUE results in class cast exception
......@@ -319,31 +406,27 @@ Task
* CONJ-465 - new option "enablePacketDebug"
New Options :
|=enablePacketDebug|Driver will save the last 16 MySQL packet exchanges (limited to first 1000 bytes).\\Hexadecimal value of those packet will be added to stacktrace when an IOException occur.\\This options has no performance incidence (< 1 microseconds per query) but driver will then take 16kb more memory.//Default: true. Since 1.6.0//|
|=enablePacketDebug|Driver will save the last 16 MySQL packet exchanges (limited to first 1000 bytes).<br />Hexadecimal value of those packet will be added to stacktrace when an IOException occur.<br />This options has no performance incidence (< 1 microseconds per query) but driver will then take 16kb more memory.//Default: true. Since 1.6.0//|
* CONJ-468 - autoIncrementIncrement value loaded during connection, avoiding a query for first statement for rewrite
== 1.6.0
version contain 2.0.0/2.0.1 evolutions, without the Java 8 part with java 8 temporal temporal object
== 2.0.0-RC
## [2.0.0-RC](https://github.com/mariadb-corporation/mariadb-connector-j/tree/2.0.0-RC) (20 Apr. 2017)
Release candidate version.
Java 8 is now minimum required version.
=== CONJ-318 : Handle CLIENT_DEPRECATE_EOF flag
##= CONJ-318 : Handle CLIENT_DEPRECATE_EOF flag
Implement some protocol changes that permit to save some bytes.(part of https://jira.mariadb.org/browse/MDEV-8931).
=== CONJ-341 : handle SERVER_SESSION_STATE_CHANGE status flag
##= CONJ-341 : handle SERVER_SESSION_STATE_CHANGE status flag
With server with version MariaDB 10.2, MySQL 5.7, ensure driver state :
- driver does now always get current database, even database is changed by query.
- when using rewriteBatchedStatements does return correct autoincrement ids even when session variable @auto_increment_increment has change during session.
=== CONJ-393 : improve setQueryTimeout to use SET STATEMENT max_statement_time
##= CONJ-393 : improve setQueryTimeout to use SET STATEMENT max_statement_time
Previous implementation of query timeout handling (using Statement.setQueryTimeout) will create an additional thread with a scheduler.
When timeout is reached, a temporary connection will be created to permit executing "KILL QUERY <current connection id>", then closing the temporary connection.
......@@ -351,31 +434,31 @@ When query ended before timeout, the scheduled task will be canceled.
If server is > 10.1.2, query timeout will be handle server side using "SET MAX_STATEMENT_TIME FOR" command.
=== [CONJ-315]
##= [CONJ-315]
Closing a Statement that was fetching a result-set (using Statement.setFetchSize) and all rows where not read at the time of closing, a kill query command
will be executed on close, to avoid having to parse all remaining results.
=== [CONJ-442]
##= [CONJ-442]
Memory optimization : streaming query.
Very big command now doesn't use any intermediate buffer. Commands are send directly to socket avoiding using memory, This permit to send very large object (1G) without using any additional memory.
=== [CONJ-366]
##= [CONJ-366]
Faster connection : bundle first commands in authentication packet
Driver execute different command on connection. Those queries are now send using pipeline (all queries are send, then only all results are reads).
New Options :
|=usePipelineAuth|Fast connection creation.//Default: true. Since 2.0.0//|
=== [CONJ-368]
##= [CONJ-368]
Parsing row result optimisation to avoid creating byte array to the maximum for faster results and less memory use.
=== Remaining JDBC 4.2 missing implementation :
##= Remaining JDBC 4.2 missing implementation :
- CONJ-414 - support for large update count [CONJ-414]
- CONJ-409 - PrepareStatement.setObject(...) support for with java 8 temporal temporal object.
- CONJ-411 - support for Statement maxFieldSize
=== Misc
##= Misc
* CONJ-443 - NullpointerException when making concurrent procedure calls
* CONJ-391 - Improve connection using SELECT in place of SHOW to avoid creating a mutex server side.
......@@ -392,7 +475,7 @@ Parsing row result optimisation to avoid creating byte array to the maximum for
* CONJ-449 - Permit CallableStatement streaming
== 1.5.9
## 1.5.9
* CONJ-212 : Implement password encoding charset option
* CONJ-423 : Permit to have MySQL driver and MariaDB driver in same classpath
* CONJ-431 : multi-values queries return only one generated key
......@@ -404,7 +487,7 @@ Parsing row result optimisation to avoid creating byte array to the maximum for
* CONJ-429 : ResultSet.getDouble/getFloat may throws a NumberFormatException
* CONJ-438 : using option rewriteBatchedStatements, permit rewrite when query has column/table that contain 'select' keyword.
== 1.5.8
## 1.5.8
* CONJ-424 : getGeneratedKeys() on table without generated key failed on second execution
* CONJ-412 : Metadata take in account tinyInt1isBit in method columnTypeClause
* CONJ-418 : ResultSet.last() isLast() afterLast() and isAfterLast() correction when streaming
......@@ -414,13 +497,13 @@ Parsing row result optimisation to avoid creating byte array to the maximum for
* CONJ-426 : Allow executeBatch to be interrupted
* CONJ-420 : High CPU usage against Aurora after 2 hours inactivity
== 1.5.7
## 1.5.7
* CONJ-407 : handling failover when packet > max_allowed_packet reset the connection state.
* CONJ-403 : possible NPE on ResultSet.close() correction
* CONJ-405 : Calendar instance not cleared before being used in ResultSet.getTimestamp
== 1.5.6
## 1.5.6
* CONJ-399 : resultSet getLong() for BIGINT column fails if value is Long.MIN_VALUE in Text protocol
* CONJ-395 : Aurora does not randomise selection of read replicas
* CONJ-392 : Aurora cluster endpoint detection timezone issue
......@@ -430,7 +513,7 @@ Parsing row result optimisation to avoid creating byte array to the maximum for
* CONJ-391 : Use SELECT in place of SHOW command on connection
* CONJ-396 : handling multiple resultSet correctly (was failing if more than 2)
== 1.5.5
## 1.5.5
* CONJ-386 : Disabling useBatchMultiSend option for Aurora, since can hang connection.
* CONJ-385 : Store procedure with resultSet get wrong getUpdateCount() value (0 in place of -1)
* CONJ-383 : permit OldAuthSwitchRequest protocol (compatibility with 5.5 server using plugin)
......@@ -443,13 +526,13 @@ Parsing row result optimisation to avoid creating byte array to the maximum for
* CONJ-369 : Encoding on clob column when useServerPrepStmts=true
* CONJ-362 : fix a possible race condition MariaDbPooledConnection
== 1.5.4
## 1.5.4
* CONJ-363 : Connection.getClientInfo implementation correction to follow JDBC rules
* CONJ-361 : PrepareStatement setString() with empty string correction.
* CONJ-360 : replacing ManagementFactory.getRuntimeMXBean() that cause possible slow connection depending on JVM / environment
* CONJ-359 : Metadata getColumns(...) resultSet doesnt have "IS_GENERATEDCOLUMN" info
== 1.5.3
## 1.5.3
* CONJ-358 : Permit using private key with password that differ from keyStore password
* CONJ-356 : secure connection : use KeyStore private key and associate public keys certificates only
* CONJ-342 : Empty clientCertificateKeyStoreUrl option correction
......@@ -459,7 +542,7 @@ Parsing row result optimisation to avoid creating byte array to the maximum for
* CONJ-352 : metadata correction on getPrecision() for numeric fields
* CONJ-350 : make prepare fallback to client prepare if query cannot be prepare
== 1.5.2
## 1.5.2
Release version
* CONJ-331 : clearWarnings() now throw exception on closed connection
* CONJ-299 : PreparedStatement.setObject(Type.BIT, "1") registered as true.
......@@ -471,21 +554,21 @@ RC corrections
* CONJ-332 : option enabledSslCipherSuites rely on java supportedCipherSuites (replacing enabledCipherSuites)
* UTF-8 conversion correction
== 1.5.1
## 1.5.1
Release candidate version
=== Evolution
==== Aurora host auto-discovery
### Evolution
#### Aurora host auto-discovery
(CONJ-325)
Aurora now auto discover nodes from cluster endpoint.
===== Aurora endpoints
##### Aurora endpoints
Every aurora instance has a specific endpoint, i.e. an URL that identify the host. Those endpoints look like `xxx.yyy.zzz.rds.amazonaws.com`.
There is another endpoint named "cluster endpoint" (format `xxx.cluster-yyy.zzz.rds.amazonaws.com`) which is assigned to the current master instance and will change when a new master is promoted.
In previous version, cluster endpoint use was discouraged, since when a failover occur, this cluster endpoint can point for a limited time to a host that isn't the current master anymore. Old recommandation was to list all specific end-points, like : \\
In previous version, cluster endpoint use was discouraged, since when a failover occur, this cluster endpoint can point for a limited time to a host that isn't the current master anymore. Old recommandation was to list all specific end-points, like : <br />
{{{
jdbc:mariadb:aurora://a.yyy.zzz.rds.amazonaws.com.com,b.yyy.zzz.rds.amazonaws.com.com/db
}}}
......@@ -500,14 +583,14 @@ This discovery append at connection time, so if you are using pool framework, ch
(If connections are never discarded, new replicas will begin be used only when a failover occur)
=== Bugfix
### Bugfix
* CONJ-329 and CONJ-330 : rewriteBatchedStatements execute single query exceptions correction.
\\\\
<br /><br />
== 1.5.0
## 1.5.0
Release candidate version
=== Use native SSPI windows implementation
CONJ-295.\\
### Use native SSPI windows implementation
CONJ-295.<br />
Java kerberos implementation is not well implemented with windows :
* need a windows registry entry (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\Kerberos\Parameters\AllowTGTSessionKey) so windows shared current ticket to java.
......@@ -515,20 +598,20 @@ Java kerberos implementation is not well implemented with windows :
* restriction when client with local admin rights
* ...
[[https://bugs.openjdk.java.net/browse/JDK-6722928|see openJDK issue]] for more informations
[see openJDK issue](https://bugs.openjdk.java.net/browse/JDK-6722928) for more informations
Kerberos GSSAPI implementation on windows in now based on [[https://github.com/dblock/waffle|Waffle]] that support windows SSPI based on [[https://github.com/java-native-access/jna|JNA]].\\
Kerberos GSSAPI implementation on windows in now based on [Waffle](https://github.com/dblock/waffle) that support windows SSPI based on [JNA](https://github.com/java-native-access/jna).<br />
if waffle-jna (and dependencies) is on classpath, native implementation will automatically be used.
This removes all those problems
=== Support for TLSv1.1 and TLSv1.2
CONJ-249/CONJ-301\\
### Support for TLSv1.1 and TLSv1.2
CONJ-249/CONJ-301<br />
Driver before version 1.5 support only TLSv1.\\
Driver before version 1.5 support only TLSv1.<br />
Default supported protocol are now TLSv1 and TLSv1.1, other protocols can be activated by options.
MariaDB and MySQL community server permit TLSv1 and TLSv1.1.\\
MariaDB and MySQL community server permit TLSv1 and TLSv1.1.<br />
MariaDB server from version 10.0.15 is using the openSSL library permitting TLSv1.2 (>= 5.5.41 for the 5.5 branch).
//YaSSL doesn't support TLSv1.2, so if MariaDB server is build from sources with YaSSL, only TLSv1 and TLSv1.1 will be available, even for version > 10.0.15//
......@@ -537,11 +620,11 @@ TLSv1.2 can be enabled by setting option {{{enabledSslProtocolSuites}}} to value
A new option {{{enabledSslCipherSuites}}} permit to set specific cipher.
New Options :
|=enabledSslProtocolSuites|Force TLS/SSL protocol to a specific set of TLS versions (comma separated list). \\Example : "TLSv1, TLSv1.1, TLSv1.2"\\//Default: TLSv1, TLSv1.1. Since 1.5.0//|
|=enabledSslCipherSuites|Force TLS/SSL cipher (comma separated list).\\ Example : "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384"\\//Default: use JRE ciphers. Since 1.5.0//|
|=enabledSslProtocolSuites|Force TLS/SSL protocol to a specific set of TLS versions (comma separated list). <br />Example : "TLSv1, TLSv1.1, TLSv1.2"<br />//Default: TLSv1, TLSv1.1. Since 1.5.0//|
|=enabledSslCipherSuites|Force TLS/SSL cipher (comma separated list).<br /> Example : "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384"<br />//Default: use JRE ciphers. Since 1.5.0//|
=== Performance improvement
[CONJ-291]\\
### Performance improvement
[CONJ-291]<br />
Different performance improvement have been done :
* Using PreparedStatement on client side use a simple query parser to identify query parameters. This parsing was taking up to 7% of query time, reduced to 3%.
......@@ -557,9 +640,9 @@ Basically that permit to avoid a lot of 'ping-pong' between driver and server.
New Options :
|=useBatchMultiSend|PreparedStatement.executeBatch() will send many QUERY before reading result packets.//Default: true. Since 1.5.0//|
|=useBatchMultiSendNumber|When using useBatchMultiSend, indicate maximum query that can be send at a time.\\//Default: 100. Since 1.5.0//|
|=useBatchMultiSendNumber|When using useBatchMultiSend, indicate maximum query that can be send at a time.<br />//Default: 100. Since 1.5.0//|
=== Prepare + execute in one call
### Prepare + execute in one call
CONJ-296
When using MySQL/MariaDB prepared statement, there will be 3 exchanges with server :
......@@ -567,32 +650,33 @@ When using MySQL/MariaDB prepared statement, there will be 3 exchanges with serv
* EXECUTE - Executes a prepared statement preparing by a PREPARE statement.
* DEALLOCATE PREPARE - Releases a prepared statement.
See [[https://mariadb.com/kb/en/mariadb/prepare-statement/|Server prepare documentation]] for more information.
See [Server prepare documentation](https://mariadb.com/kb/en/mariadb/prepare-statement/) for more
information.
PREPARE and DEALLOCATE PREPARE are 2 additional client-server round-trip.
Since MariaDB 10.2, a new functionality named COM-MULTI to permitting to send different task to server in one round-trip.
Driver is using this functionality to PREPARE and EXECUTE in one client-server round-trip.
=== Client logging
### Client logging
Client logging can be enable, permitting to log query information, execution time and different failover information.
This implementation need the standard SLF4J dependency.
New Options :
|=log|Enable log information. require Slf4j version > 1.4 dependency.\\//Default: false. Since 1.5.0//|
|=maxQuerySizeToLog|Only the first characters corresponding to this options size will be displayed in logs\\//Default: 1024. Since 1.5.0//|
|=slowQueryThresholdNanos|Will log query with execution time superior to this value (if defined )\\//Default: 1024. Since 1.5.0//|
|=profileSql|log query execution time.\\//Default: false. Since 1.5.0//|
|=log|Enable log information. require Slf4j version > 1.4 dependency.<br />//Default: false. Since 1.5.0//|
|=maxQuerySizeToLog|Only the first characters corresponding to this options size will be displayed in logs<br />//Default: 1024. Since 1.5.0//|
|=slowQueryThresholdNanos|Will log query with execution time superior to this value (if defined )<br />//Default: 1024. Since 1.5.0//|
|=profileSql|log query execution time.<br />//Default: false. Since 1.5.0//|
=== "LOAD DATA INFILE" Interceptors
### "LOAD DATA INFILE" Interceptors
CONJ-305
LOAD DATA INFILE The fastest way to load many datas is using query [[https://mariadb.com/kb/en/mariadb/load-data-infile/|LOAD DATA INFILE]].
\\Problem is using "LOAD DATA LOCAL INFILE" (ie : loading a file from client), may be a security problem :
LOAD DATA INFILE The fastest way to load many datas is using query [LOAD DATA INFILE](https://mariadb.com/kb/en/mariadb/load-data-infile/).
<br />Problem is using "LOAD DATA LOCAL INFILE" (ie : loading a file from client), may be a security problem :
* A "man in the middle" proxy server can change the actual file asked from server so client will send a Local file to this proxy.
* If someone has can execute query from client, he can have access to any file on client (according to the rights of the user running the client process).
See [[./use-mariadb-connector-j-driver.creole#load-data-infile|load-data-infile documentation]] for more information.
See [load-data-infile documentation](./documentation/use-mariadb-connector-j-driver.creole#load-data-infile) for more information.
Interceptors can now filter LOAD DATA LOCAL INFILE query's file location to validate path / file name.
Those interceptors:
......@@ -632,79 +716,79 @@ public class LocalInfileInterceptorImpl implements LocalInfileInterceptor {
=== Minor evolution
### Minor evolution
* CONJ-260 : Add jdbc nString, nCharacterStream, nClob implementation
=== Bugfix
### Bugfix
* CONJ-316 : Wrong Exception thrown for ScrollType TYPE_SCROLL_INSENSITIVE
* CONJ-298 : Error on Callable function exception when no parameter and space before parenthesis
* CONJ-314 : Permit using Call with Statement / Prepare Statement
\\\\\\
== 1.4.6
* [CONJ-293] Permit named pipe connection without host
* [CONJ-309] Possible NPE on aurora when failover occur during connection initialisation
* [CONJ-312] NPE while loading a null from TIMESTAMP field using binary protocol
* [misc] batch with one parameter correction (using rewriteBatchedStatements option)
<br /><br /><br />
## 1.4.6
* CONJ-293] Permit named pipe connection without host
* CONJ-309] Possible NPE on aurora when failover occur during connection initialisation
* CONJ-312] NPE while loading a null from TIMESTAMP field using binary protocol
* misc] batch with one parameter correction (using rewriteBatchedStatements option)
== 1.4.5
* [CONJ-297] Useless memory consumption when using Statement.setQueryTimeout
* [CONJ-294] PrepareStatement on master reconnection after a failover
* [CONJ-288] using SHOW VARIABLES to replace SELECT on connection to permit connection on a galera non primary node
* [CONJ-290] Timestamps format error when using prepareStatement with options useFractionalSeconds and useServerPrepStmts
## 1.4.5
* CONJ-297] Useless memory consumption when using Statement.setQueryTimeout
* CONJ-294] PrepareStatement on master reconnection after a failover
* CONJ-288] using SHOW VARIABLES to replace SELECT on connection to permit connection on a galera non primary node
* CONJ-290] Timestamps format error when using prepareStatement with options useFractionalSeconds and useServerPrepStmts
== 1.4.4
* [CONJ-289] PrepareStatement on master reconnection after a failover
* [CONJ-288] using SHOW VARIABLES to replace SELECT on connection to permit connection on a galera non primary node
## 1.4.4
* CONJ-289] PrepareStatement on master reconnection after a failover
* CONJ-288] using SHOW VARIABLES to replace SELECT on connection to permit connection on a galera non primary node
== 1.4.3
## 1.4.3
* [CONJ-284] Cannot read autoincremented IDs bigger than Short.MAX_VALUE
* [CONJ-283] Parsing correction on MariaDbClientPreparedStatement - syntax error on insert values
* [CONJ-282] Handling YEARs with binary prepareStatement
* [CONJ-281] Connector/J is incompatible with Google App Engine correction
* [CONJ-278] Improve prepared statement on failover
* CONJ-284] Cannot read autoincremented IDs bigger than Short.MAX_VALUE
* CONJ-283] Parsing correction on MariaDbClientPreparedStatement - syntax error on insert values
* CONJ-282] Handling YEARs with binary prepareStatement
* CONJ-281] Connector/J is incompatible with Google App Engine correction
* CONJ-278] Improve prepared statement on failover
== 1.4.2
## 1.4.2
* [CONJ-275] Streaming result without result throw "Current position is before the first row"
* CONJ-275] Streaming result without result throw "Current position is before the first row"
== 1.4.1
## 1.4.1
* [CONJ-274] correction to permit connection to MySQL 5.1 server
* [CONJ-273] correction when using prepareStatement without parameters and option rewriteBatchedStatements to true
* [CONJ-270] permit 65535 parameters to server preparedStatement
* [CONJ-268] update license header
* [misc] when option rewriteBatchedStatements is set to true, correction of packet separation when query size > max_allow_packet
* [misc] performance improvement for select result.
* CONJ-274] correction to permit connection to MySQL 5.1 server
* CONJ-273] correction when using prepareStatement without parameters and option rewriteBatchedStatements to true
* CONJ-270] permit 65535 parameters to server preparedStatement
* CONJ-268] update license header
* misc] when option rewriteBatchedStatements is set to true, correction of packet separation when query size > max_allow_packet
* misc] performance improvement for select result.
== 1.4.0
## 1.4.0
=== Complete implementation of fetch size.
### Complete implementation of fetch size.
CONJ-26
JDBC allows to specify the number of rows fetched for a query, and this number is referred to as the fetch size
Before version 1.4.0, query were loading all results or row by row using Statement.setFetchSize(Integer.MIN_VALUE).
Now it's possible to set fetch size according to your need.
Loading all results for large result sets is using a lot of memory. This functionality permit to save memory without having performance decrease.
=== Memory footprint improvement
### Memory footprint improvement
CONJ-125
Buffers have been optimized to reduced memory footprint
=== CallableStatement performance improvement.
### CallableStatement performance improvement.
CONJ-209
Calling function / procedure performance is now optimized according to query. Depending on queries, difference can be up to 300%.
=== Authentication evolution
### Authentication evolution
CONJ-251 Permit now new authentication possibility : [[https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/|PAM authentication]], and GSSAPI/SSPI authentication.
GSSAPI/SSPI authentication authentication plugin for MariaDB permit a passwordless login.
On Unix systems, GSSAPI is usually synonymous with Kerberos authentication. Windows has slightly different but very similar API called SSPI, that along with Kerberos, also supports NTLM authentication.
See more detail in [[https://github.com/MariaDB/mariadb-connector-j/blob/master/documentation/plugin/GSSAPI|GSSAPI/SSPI configuration]]
See more detail in [[https://github.com/mariadb-corporation/mariadb-connector-j/blob/master/documentation/plugin/GSSAPI|GSSAPI/SSPI configuration]]
=== Connection attributes
### Connection attributes
CONJ-217
Driver information informations are now send to [[https://mariadb.com/kb/en/mariadb/performance-schema-session_connect_attrs-table/|connection attributes tables]] (performance_schema must be activated).
A new option "connectionAttributes" permit to add client specifics data.
......@@ -729,12 +813,12 @@ select * from performance_schema.session_connect_attrs where processList_id = 5
}}}
== Minor evolution
## Minor evolution
* CONJ-210 : adding a "jdbcCompliantTruncation" option to force truncation warning as SQLException.
* CONJ-211 : when in master/slave configuration, option "assureReadOnly" will ensure that slaves are in read-only mode ( forcing transaction by a query "SET SESSION TRANSACTION READ ONLY").
* CONJ-213 : new option "continueBatchOnError". Permit to continue batch when an exception occur : When executing a batch and an error occur, must the batch stop immediatly (default) or finish remaining batch before throwing exception.
== Bugfix
## Bugfix
* CONJ-236 : Using a parametrized query with a smallint -1 does return the unsigned value
* CONJ-250 : Tomcat doesn't stop when using Aurora failover configuration
* CONJ-260 : Add jdbc nString, nCharacterStream, nClob implementation
......
......@@ -8,6 +8,7 @@ For significant feature additions, we like to have an open issue in [MariaDB JIR
These are the set of tools which are required in order to complete any build. Follow the links to download and install them on your own before continuing.
* At least one GPG Key see https://help.github.com/en/articles/generating-a-new-gpg-key
* [Oracle JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) ( with [JCE policies](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html) if using TLS/SSL)
* IDE (eclipse / netbean / intelliJ) with maven and GIT plugins
......
......@@ -11,20 +11,16 @@ MariaDB java connector is a JDBC 4.2 compatible driver, used to connect applicat
Tracker link <a href="https://jira.mariadb.org/projects/CONJ/issues/">https://jira.mariadb.org/projects/CONJ/issues/</a>
## Status
[![Linux Build](https://travis-ci.org/MariaDB/mariadb-connector-j.svg?branch=master)](https://travis-ci.org/MariaDB/mariadb-connector-j)
[![Linux Build](https://travis-ci.org/mariadb-corporation/mariadb-connector-j.svg?branch=master)](https://travis-ci.org/mariadb-corporation/mariadb-connector-j)
[![Windows Build](https://ci.appveyor.com/api/projects/status/7hpe3wmbu57r8noa/branch/master?svg=true)](https://ci.appveyor.com/project/rusher/mariadb-connector-j/branch/master)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.mariadb.jdbc/mariadb-java-client/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.mariadb.jdbc/mariadb-java-client)
[![License (LGPL version 2.1)](https://img.shields.io/badge/license-GNU%20LGPL%20version%202.1-green.svg?style=flat-square)](http://opensource.org/licenses/LGPL-2.1)
[![Known Vulnerabilities](https://snyk.io/test/github/mariadb/mariadb-connector-j/badge.svg)](https://snyk.io/test/github/mariadb/mariadb-connector-j)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/be7f4c89d63e496d824e8f365478e8c8)](https://www.codacy.com/app/diego-dupin/mariadb-connector-j?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=MariaDB/mariadb-connector-j&amp;utm_campaign=Badge_Grade)
## Obtaining the driver
| Java version | current version |
|:------------:|:-------------------------:|
| 6 | 1.7.4 |
| 7 | 1.7.4 |
| 8+ | 2.4.2 |
For java 8 or more :
(maintenance branch for java 7 is 1.x)
The driver (jar) can be downloaded from [mariadb connector download](https://mariadb.com/products/connectors-plugins)
or maven :
......@@ -32,7 +28,7 @@ or maven :
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.4.0</version>
<version>2.5.3</version>
</dependency>
```
......@@ -50,7 +46,7 @@ Development snapshot are available on sonatype nexus repository
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>2.5.0-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</dependency>
</dependencies>
```
......@@ -60,7 +56,7 @@ Development snapshot are available on sonatype nexus repository
For a Getting started guide, API docs, recipes, etc. see the
* [About MariaDB connector/J](/documentation/about-mariadb-connector-j.creole)
* [Use MariaDB connector/j driver](/documentation/use-mariadb-connector-j-driver.creole)
* [Changelog](/documentation/changelog.creole)
* [Changelog](/CHANGELOG.md)
* [Failover and high-availability](/documentation/failover-and-high-availability-with-mariadb-connector-j.creole)
......
version: '{build}'
environment:
matrix:
- DB: '10.2.24'
- DB: '10.2.26'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
JAVA_HOME: C:\Program Files\Java\jdk1.8.0
- DB: '10.3.15'
- DB: '10.3.17'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
JAVA_HOME: C:\Program Files\Java\jdk1.8.0
- DB: '10.1.40'
- DB: '10.4.7'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
JAVA_HOME: C:\Program Files\Java\jdk1.8.0
- DB: '10.0.38'
- DB: '10.1.41'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
JAVA_HOME: C:\Program Files\Java\jdk1.8.0
- DB: '5.5.64'
- DB: '5.5.65'
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_PARAM: 'Visual Studio 15 2017 Win64'
JAVA_HOME: C:\Program Files\Java\jdk1.8.0
......
resources:
containers:
- container: ubuntu-1804
image: ubuntu:18.04
options: "--name ubuntu-1804 --add-host=mariadb.example.com:127.0.0.1 -v /usr/bin/docker:/tmp/docker:ro"
jobs:
- job: SSLFiles
displayName: 'Creating SSL Files'
pool:
vmImage: 'ubuntu-16.04'
container: $[ variables['containerImage'] ]
steps:
- script: |
java --version
mkdir tmp
chmod 777 .travis/gen-ssl.sh
.travis/gen-ssl.sh mariadb.example.com tmp
cp -R tmp $BUILD_ARTIFACTSTAGINGDIRECTORY
displayName: 'create SSL certificates'
- task: PublishPipelineArtifact@0
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifactName: ssl_certs
- job: windowsTest
displayName: 'test windows'
pool:
vmImage: 'windows-2019'
dependsOn:
- SSLFiles
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download SSL files'
inputs:
artifactName: ssl_certs
targetPath: $(System.DefaultWorkingDirectory)
- task: DownloadPipelineArtifact@2
displayName: 'Download 10.4 server'
inputs:
source: 'specific'
project: '550599d3-6165-4abd-8c86-e3f7e53a1847'
artifact: 'Windows'
pipeline: 3
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/10.4-enterprise'
downloadPath: $(System.DefaultWorkingDirectory)
- script: |
choco install jdk8 -ia "INSTALLDIR=""c:\java"""
Get-EnvironmentVariable -Name 'JAVA_HOME' -Scope 'Machine'
choco install maven
rem type C:\ProgramData\chocolatey\logs\chocolatey.log
displayName: 'install java + maven'
- script: |
dir $(System.DefaultWorkingDirectory)\win_build\
for /f %%a in ('dir /B $(System.DefaultWorkingDirectory)\win_build\mariadb-enterprise-10.*-winx64.msi') do set servername=$(System.DefaultWorkingDirectory)\win_build\%%a
echo %servername%
msiexec /i %servername% INSTALLDIR=c:\projects\server SERVICENAME=mariadb ALLOWREMOTEROOTACCESS=true /qn
c:\projects\server\bin\mysql.exe -e "create database testj" --user=root
c:\projects\server\bin\mysql.exe -e "GRANT ALL on *.* to 'someUser'@'%' identified by 'Passw@rd2' with grant option;" --user=root
displayName: 'install server'
- script: |
echo 127.0.0.1 mariadb.example.com >> %WINDIR%\System32\Drivers\Etc\Hosts
displayName: 'set hostname'
- script: |
set JAVA_HOME=C:\java\
set PATH=%PATH%;%JAVA_HOME%\bin
java -version
rem search maven version
dir /B C:\ProgramData\chocolatey\lib\maven\apache-maven-*.*.* | findstr /x apache-maven-[0-9]\.[0-9]\.[0-9] > mavenversion.txt
set /p mavenversion= < mavenversion.txt
echo %mavenversion%
C:\ProgramData\chocolatey\lib\maven\%mavenversion%\bin\mvn clean test -DdbUrl="jdbc:mariadb://mariadb.example.com:3306/testj?user=someUser&password=Passw@rd2" -DkeystorePath="$(System.DefaultWorkingDirectory)/tmp/client-keystore.jks" -DkeystorePassword="kspass" -DserverCertificatePath="$(System.DefaultWorkingDirectory)/tmp/server.crt" -Dkeystore2Path="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.jks" -Dkeystore2Password="kspass" -DkeyPassword="kspasskey" -Dkeystore2PathP12="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.p12" -DrunLongTest=false
if %ERRORLEVEL% EQU 0 (
echo Success
) else (
echo exit code is %errorlevel%
exit /b %errorlevel%
)
displayName: 'run tests'
- job: RunInContainer
pool:
vmImage: 'ubuntu-16.04'
displayName: 'test ubuntu bionic'
dependsOn:
- SSLFiles
strategy:
matrix:
ubuntu-1804:
containerImage: ubuntu-1804
containerName: bionic
container: $[variables['containerImage']]
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifactName: ssl_certs
targetPath: $(System.DefaultWorkingDirectory)
- script: /tmp/docker exec -t -u 0 $(containerImage) sh -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" -y install sudo"
displayName: 'Set up sudo'
- task: DownloadPipelineArtifact@2
displayName: 'Download 10.4 enterprise server artifact files'
inputs:
source: 'specific'
project: '550599d3-6165-4abd-8c86-e3f7e53a1847'
artifact: '$(containerImage)'
pipeline: 3
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/10.4-enterprise'
downloadPath: $(System.DefaultWorkingDirectory)
- task: DownloadPipelineArtifact@2
displayName: 'Download galera server artifact files'
inputs:
source: 'specific'
project: '550599d3-6165-4abd-8c86-e3f7e53a1847'
artifact: $(containerImage)
runVersion: 'latestFromBranch'
pipeline: 2
runBranch: 'refs/heads/es-mariadb-4.x'
downloadPath: $(System.DefaultWorkingDirectory)
- script: |
sudo apt install -y default-jdk
sudo apt install -y maven
mvn -version
java -version
displayName: 'Install java + maven'
- script: |
tar xf mariadb-enterprise*
sudo ln -fs /usr/share/zoneinfo/UTC /etc/localtime
sudo apt-get update && sudo apt-get install -y --no-install-recommends apt-transport-https ca-certificates tzdata pwgen
export DEBIAN_FRONTEND="noninteractive"
sudo debconf-set-selections <<< "mariadb-server-10.4 mysql-server/root_password password P4ssw@rd"
sudo debconf-set-selections <<< "mariadb-server-10.4 mysql-server/root_password_again password P4ssw@rd"
sudo apt-get update -y
sudo apt-get install --allow-unauthenticated -f -y libaio1 libaio-dev libxml2 libcurl4 curl libc-dev linux-libc-dev libc-dev-bin libdbi-perl rsync socat libnuma1 zlib1g-dev libreadline5 libjemalloc1 libsnappy1v5 libcrack2 gawk lsof psmisc perl libreadline5
cd mariadb-enterprise*/
sudo groupadd mysql
sudo useradd -g mysql mysql
export PROJ_PATH=`pwd`
echo $PROJ_PATH
cat <<EOT >> my.cnf
[mysqld]
port=3306
max_allowed_packet=16M
datadir=$PROJ_PATH/data
socket=/tmp/mysql.sock
user=mysql
ssl-ca=$(System.DefaultWorkingDirectory)/tmp/ca.crt
ssl-cert=$(System.DefaultWorkingDirectory)/tmp/server.crt
ssl-key=$(System.DefaultWorkingDirectory)/tmp/server.key
EOT
sudo chown mysql $PROJ_PATH/my.cnf
sudo tail -n 5000 $PROJ_PATH/my.cnf
sudo chmod 777 $PROJ_PATH
sudo ln -s $PROJ_PATH /usr/local/mysql
sudo ./scripts/mysql_install_db --defaults-file=$PROJ_PATH/my.cnf --user=mysql
sudo chown -R root .
sudo chown -R mysql data
export PATH=$PATH:$PROJ_PATH/bin/
env:
WORKING_DIR: $(System.DefaultWorkingDirectory)
displayName: 'install server'
- script: |
cd mariadb-enterprise*/
sudo ./bin/mysqld --defaults-file=./my.cnf &
for i in {30..0}; do
if sudo ./bin/mysql -e "SELECT 1" &> /dev/null; then
echo 'MySQL connected...'
break
fi
echo 'MySQL init process in progress...'
sleep 1
done
if [ "$i" = 0 ]; then
echo >&2 'MySQL init process failed.'
sudo ./bin/mysql -e "SELECT 1"
exit 1
fi
sudo ./bin/mysql -e "CREATE USER 'someUser'@'%' identified by 'Passw@rd2';"
sudo ./bin/mysql -e "GRANT ALL on *.* to 'someUser'@'%' identified by 'Passw@rd2' with grant option;"
sudo ./bin/mysql -e "CREATE DATABASE testj;"
cd ..
/usr/share/maven/bin/mvn clean test -DdbUrl="jdbc:mariadb://mariadb.example.com:3306/testj?user=someUser&password=Passw@rd2" -DkeystorePath="$(System.DefaultWorkingDirectory)/tmp/client-keystore.jks" -DkeystorePassword="kspass" -DserverCertificatePath="$(System.DefaultWorkingDirectory)/tmp/server.crt" -Dkeystore2Path="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.jks" -Dkeystore2Password="kspass" -DkeyPassword="kspasskey" -Dkeystore2PathP12="$(System.DefaultWorkingDirectory)/tmp/fullclient-keystore.p12" -DrunLongTest=false
if [ $? -ne 0 ]; then
exit 1
fi
cd mariadb-enterprise*/
sudo ./bin/mysqladmin shutdown
env:
JAVA_HOME: "/usr/lib/jvm/default-java"
MAVEN_HOME: "/opt/maven"
displayName: 'run tests'
\ No newline at end of file
......@@ -52,11 +52,11 @@ All of them are needed for native windows kerberos implementation. (see [[plugi
== Source code
The source code is available on GitHub:
https://github.com/MariaDB/mariadb-connector-j and the most recent development
https://github.com/mariadb-corporation/mariadb-connector-j and the most recent development
version can be obtained using the following command:
{{{
git clone https://github.com/MariaDB/mariadb-connector-j.git
git clone https://github.com/mariadb-corporation/mariadb-connector-j.git
}}}
== License
......@@ -80,7 +80,7 @@ localhost (on default TCP port 3306) and a database called 'testj', and user
'root' with empty password
{{{
git clone https://github.com/MariaDB/mariadb-connector-j.git = Or, unpack the source distribution tarball
git clone https://github.com/mariadb-corporation/mariadb-connector-j.git = Or, unpack the source distribution tarball
cd mariadb-connector-j
# For the unit test run, start local mysqld mysqld,
......
= GSSAPI Authentication
MariaDB GSSAPI support GSSAPI since the 10.1 version (Server configuration can be found on https://github.com/MariaDB/server/blob/10.2/plugin/auth_gssapi/README.md ).
MariaDB GSSAPI support GSSAPI since the 10.1 version (Server configuration can be found on https://github.com/mariadb-corporation/server/blob/10.2/plugin/auth_gssapi/README.md ).
The following subsections show how to implement GSSAPI Authentication with the java connector.
......
......@@ -187,6 +187,7 @@ See [[use-mariadb-connector-j-driver.creole#using-pooling|using pooling]] for mo
|=useAffectedRows|default correspond to the JDBC standard, reporting real affected rows. if enable, will report "affected" rows. example : if enable, an update command that doesn't change a row value will still be "affected", then report.\\//Default: false. Since 2.2.6//
|=includeInnodbStatusInDeadlockExceptions|add "SHOW ENGINE INNODB STATUS" result to exception trace when having a deadlock exception\\//Default: false. Since 2.3.0//
|=includeThreadDumpInDeadlockExceptions|add thread dump to exception trace when having a deadlock exception\\//Default: false. Since 2.3.0//
|=blankTableNameMeta|Result-set metadata getTableName always return blank. This option is mainly for ORACLE db compatibility\\//Default: false. Since 2.4.3//
\\\\
== Failover/High availability URL parameters
......
......@@ -50,7 +50,6 @@
# OF SUCH DAMAGE.
# */
#
#Generated by Maven Ant Plugin - DO NOT EDIT THIS FILE!
#Mon Jul 13 22:05:03 CEST 2015
maven.settings.offline=false
......
......@@ -99,15 +99,18 @@
<pathelement location="${maven.repo.local}/net/java/dev/jna/jna/3.3.0/jna-3.3.0.jar"/>
<pathelement location="${maven.repo.local}/net/java/dev/jna/jna/3.3.0/jna-3.3.0-platform.jar"/>
<pathelement location="${maven.repo.local}/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar"/>
<pathelement location="${maven.repo.local}/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"/>
<pathelement
location="${maven.repo.local}/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"/>
</path>
<path id="build.test.classpath">
<pathelement location="${maven.repo.local}/junit/junit/4.12/junit-4.12.jar"/>
<pathelement location="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
<pathelement
location="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
<pathelement location="${maven.repo.local}/net/java/dev/jna/jna/3.3.0/jna-3.3.0.jar"/>
<pathelement location="${maven.repo.local}/net/java/dev/jna/jna/3.3.0/jna-3.3.0-platform.jar"/>
<pathelement location="${maven.repo.local}/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar"/>
<pathelement location="${maven.repo.local}/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"/>
<pathelement
location="${maven.repo.local}/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"/>
</path>
<!-- ====================================================================== -->
......@@ -210,7 +213,8 @@
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present" classpathref="build.test.classpath"/>
<available classname="junit.framework.Test" property="junit.present"
classpathref="build.test.classpath"/>
</target>
<target name="test-junit-status"
......@@ -233,7 +237,9 @@
depends="test-junit-status"
if="junit.missing">
<echo>=================================== WARNING ===================================</echo>
<echo>JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not executed.</echo>
<echo>JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not
executed.
</echo>
<echo>===============================================================================</echo>
</target>
......@@ -299,7 +305,8 @@
unless="maven.mode.offline">
<mkdir dir="${maven.repo.local}"/>
<mkdir dir="${maven.repo.local}/junit/junit/4.12"/>
<get src="https://oss.sonatype.org/content/repositories/snapshots/junit/junit/4.12/junit-4.12.jar"
<get
src="https://oss.sonatype.org/content/repositories/snapshots/junit/junit/4.12/junit-4.12.jar"
dest="${maven.repo.local}/junit/junit/4.12/junit-4.12.jar"
usetimestamp="false"
ignoreerrors="true"/>
......@@ -308,16 +315,19 @@
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3"/>
<get src="https://oss.sonatype.org/content/repositories/snapshots/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
<get
src="https://oss.sonatype.org/content/repositories/snapshots/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
dest="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
usetimestamp="false"
ignoreerrors="true"/>
<get src="https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
<get
src="https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
dest="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/net/java/dev/jna/jna/3.3.0"/>
<get src="https://oss.sonatype.org/content/repositories/snapshots/net/java/dev/jna/jna/3.3.0/jna-3.3.0.jar"
<get
src="https://oss.sonatype.org/content/repositories/snapshots/net/java/dev/jna/jna/3.3.0/jna-3.3.0.jar"
dest="${maven.repo.local}/net/java/dev/jna/jna/3.3.0/jna-3.3.0.jar"
usetimestamp="false"
ignoreerrors="true"/>
......@@ -326,29 +336,35 @@
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/net/java/dev/jna/jna/3.3.0"/>
<get src="https://oss.sonatype.org/content/repositories/snapshots/net/java/dev/jna/jna/3.3.0/jna-3.3.0-platform.jar"
<get
src="https://oss.sonatype.org/content/repositories/snapshots/net/java/dev/jna/jna/3.3.0/jna-3.3.0-platform.jar"
dest="${maven.repo.local}/net/java/dev/jna/jna/3.3.0/jna-3.3.0-platform.jar"
usetimestamp="false"
ignoreerrors="true"/>
<get src="https://repo.maven.apache.org/maven2/net/java/dev/jna/jna/3.3.0/jna-3.3.0-platform.jar"
<get
src="https://repo.maven.apache.org/maven2/net/java/dev/jna/jna/3.3.0/jna-3.3.0-platform.jar"
dest="${maven.repo.local}/net/java/dev/jna/jna/3.3.0/jna-3.3.0-platform.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/commons-dbcp/commons-dbcp/1.4"/>
<get src="https://oss.sonatype.org/content/repositories/snapshots/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar"
<get
src="https://oss.sonatype.org/content/repositories/snapshots/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar"
dest="${maven.repo.local}/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar"
usetimestamp="false"
ignoreerrors="true"/>
<get src="https://repo.maven.apache.org/maven2/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar"
<get
src="https://repo.maven.apache.org/maven2/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar"
dest="${maven.repo.local}/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/commons-pool/commons-pool/1.5.4"/>
<get src="https://oss.sonatype.org/content/repositories/snapshots/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"
<get
src="https://oss.sonatype.org/content/repositories/snapshots/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"
dest="${maven.repo.local}/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"
usetimestamp="false"
ignoreerrors="true"/>
<get src="https://repo.maven.apache.org/maven2/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"
<get
src="https://repo.maven.apache.org/maven2/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"
dest="${maven.repo.local}/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar"
usetimestamp="false"
ignoreerrors="true"/>
......
......@@ -50,7 +50,8 @@
~ */
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
......@@ -58,7 +59,7 @@
<artifactId>mariadb-java-client</artifactId>
<packaging>jar</packaging>
<name>mariadb-java-client</name>
<version>2.4.2</version>
<version>2.5.3</version>
<description>JDBC driver for MariaDB and MySQL</description>
<url>https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/</url>
......@@ -69,9 +70,10 @@
<version.file>src/main/java/org/mariadb/jdbc/internal/util/constant/Version.java</version.file>
<checkstyleVersion>8.18</checkstyleVersion>
<checkstyle.plugin.version>2.17</checkstyle.plugin.version>
<osgi.version>4.3.1</osgi.version>
<driver.version.major>2</driver.version.major>
<driver.version.minor>4</driver.version.minor>
<driver.version.patch>2</driver.version.patch>
<driver.version.minor>5</driver.version.minor>
<driver.version.patch>3</driver.version.patch>
<driver.version.qualifier></driver.version.qualifier>
</properties>
......@@ -95,9 +97,10 @@
</developers>
<scm>
<connection>scm:git:git://github.com/MariaDB/mariadb-connector-j.git</connection>
<url>https://github.com/MariaDB/mariadb-connector-j</url>
<developerConnection>scm:git:git@github.com:MariaDB/mariadb-connector-j.git</developerConnection>
<connection>scm:git:git://github.com/mariadb-corporation/mariadb-connector-j.git</connection>
<url>https://github.com/mariadb-corporation/mariadb-connector-j</url>
<developerConnection>scm:git:git@github.com:MariaDB/mariadb-connector-j.git
</developerConnection>
</scm>
<issueManagement>
......@@ -273,7 +276,8 @@
<Bundle-SymbolicName>org.mariadb.jdbc</Bundle-SymbolicName>
<Automatic-Module-Name>org.mariadb.jdbc</Automatic-Module-Name>
<Export-Package>org.mariadb.jdbc</Export-Package>
<Import-Package>javax.naming, javax.management, javax.net;resolution:=optional, javax.net.ssl;resolution:=optional, javax.sql, javax.transaction.xa;resolution:=optional, waffle.windows.auth;resolution:=optional, waffle.windows.auth.impl;resolution:=optional, * </Import-Package>
<Import-Package>org.osgi.framework,javax.naming,javax.management,javax.sql,javax.net;resolution:=optional,javax.net.ssl;resolution:=optional,javax.transaction.xa;resolution:=optional,waffle.windows.auth;resolution:=optional,waffle.windows.auth.impl;resolution:=optional</Import-Package>
<Bundle-Activator>org.mariadb.jdbc.internal.osgi.MariaDbActivator</Bundle-Activator>
</manifestEntries>
</archive>
</configuration>
......@@ -386,5 +390,25 @@
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-rds</artifactId>
<version>1.11.636</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>${osgi.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
......@@ -3,7 +3,7 @@
* MariaDB Client for Java
*
* Copyright (c) 2012-2014 Monty Program Ab.
* Copyright (c) 2015-2017 MariaDB Ab.
* Copyright (c) 2015-2019 MariaDB Ab.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -52,12 +52,9 @@
package org.mariadb.jdbc;
import java.io.IOException;
import java.io.OutputStream;
import java.io.*;
/**
* Output stream for the blob.
*/
/** Output stream for the blob. */
class BlobOutputStream extends OutputStream {
private final MariaDbBlob blob;
......@@ -107,4 +104,3 @@ class BlobOutputStream extends OutputStream {
write(buf, 0, buf.length);
}
}
......@@ -3,7 +3,7 @@
* MariaDB Client for Java
*
* Copyright (c) 2012-2014 Monty Program Ab.
* Copyright (c) 2015-2017 MariaDB Ab.
* Copyright (c) 2015-2019 MariaDB Ab.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -52,11 +52,9 @@
package org.mariadb.jdbc;
import java.sql.Types;
import java.sql.*;
/**
* Info about in/out parameters.
*/
/** Info about in/out parameters. */
class CallParameter {
private boolean isInput;
......
......@@ -3,7 +3,7 @@
* MariaDB Client for Java
*
* Copyright (c) 2012-2014 Monty Program Ab.
* Copyright (c) 2015-2017 MariaDB Ab.
* Copyright (c) 2015-2019 MariaDB Ab.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -50,42 +50,24 @@
*
*/
package org.mariadb.jdbc;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import org.mariadb.jdbc.internal.*;
import org.mariadb.jdbc.internal.com.read.resultset.*;
import org.mariadb.jdbc.internal.util.exceptions.*;
import java.io.*;
import java.math.*;
import java.net.*;
import java.sql.Date;
import java.sql.NClob;
import java.sql.ParameterMetaData;
import java.sql.Ref;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLType;
import java.sql.SQLXML;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.Calendar;
import java.util.Map;
import org.mariadb.jdbc.internal.ColumnType;
import org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet;
import org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper;
public abstract class CallableFunctionStatement extends ClientSidePreparedStatement implements
CallableStatement {
import java.sql.*;
import java.util.*;
public abstract class CallableFunctionStatement extends ClientSidePreparedStatement
implements CallableStatement {
protected CallableParameterMetaData parameterMetadata;
/**
* Information about parameters, merely from registerOutputParameter() and setXXX() calls.
*/
/** Information about parameters, merely from registerOutputParameter() and setXXX() calls. */
private CallParameter[] params;
/**
......@@ -93,16 +75,15 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
*
* @param connection current connection
* @param sql query
* @param resultSetType a result set type; one of <code>ResultSet.TYPE_FORWARD_ONLY</code>,
* <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
* <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
* @param resultSetType a result set type; one of <code>ResultSet.TYPE_FORWARD_ONLY</code>, <code>
* ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
* @param resultSetConcurrency a concurrency type; one of <code>ResultSet.CONCUR_READ_ONLY</code>
* or
* <code>ResultSet.CONCUR_UPDATABLE</code>
* or <code>ResultSet.CONCUR_UPDATABLE</code>
* @throws SQLException if clientPrepareStatement creation throw an exception
*/
public CallableFunctionStatement(MariaDbConnection connection, String sql, int resultSetType,
final int resultSetConcurrency) throws SQLException {
public CallableFunctionStatement(
MariaDbConnection connection, String sql, int resultSetType, final int resultSetConcurrency)
throws SQLException {
super(connection, sql, resultSetType, resultSetConcurrency, Statement.NO_GENERATED_KEYS);
}
......@@ -165,7 +146,6 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
throw new SQLException("there is no parameter with the name " + parameterName);
}
/**
* Convert parameter name to output parameter index in the query.
*
......@@ -360,7 +340,6 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
return getResult().getTimestamp(nameToOutputIndex(parameterName));
}
@Override
public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException {
return getResult().getTimestamp(nameToOutputIndex(parameterName), cal);
......@@ -368,13 +347,12 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
@Override
public Object getObject(int parameterIndex) throws SQLException {
Class<?> classType = ColumnType
.classFromJavaType(getParameter(parameterIndex).getOutputSqlType());
Class<?> classType =
ColumnType.classFromJavaType(getParameter(parameterIndex).getOutputSqlType());
if (classType != null) {
return getResult().getObject(indexToOutputIndex(parameterIndex), classType);
}
return getResult().getObject(indexToOutputIndex(parameterIndex));
}
@Override
......@@ -457,7 +435,6 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
return getResult().getURL(nameToOutputIndex(parameterName));
}
@Override
public RowId getRowId(int parameterIndex) throws SQLException {
throw ExceptionMapper.getFeatureNotSupportedException("RowIDs not supported");
......@@ -519,33 +496,31 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
}
/**
* <p>Registers the designated output parameter.
* This version of the method <code>registerOutParameter</code> should be used for a user-defined
* or <code>REF</code> output parameter. Examples of user-defined types include:
* <code>STRUCT</code>, <code>DISTINCT</code>,
* <code>JAVA_OBJECT</code>, and named array types.</p>
* <p>All OUT parameters must be registered
* before a stored procedure is executed.</p>
* <p> For a user-defined parameter, the fully-qualified SQL
* type name of the parameter should also be given, while a <code>REF</code> parameter requires
* that the fully-qualified type name of the referenced type be given. A JDBC driver that does
* not need the type code and type name information may ignore it. To be portable, however,
* applications should always provide these values for user-defined and <code>REF</code>
* parameters.</p>
* <p>Although it is intended for user-defined and <code>REF</code> parameters,
* this method may be used to register a parameter of any JDBC type. If the parameter does not
* have a user-defined or <code>REF</code> type, the
* <i>typeName</i> parameter is ignored.</p>
* <p><B>Note:</B> When reading the value of an out parameter, you
* must use the getter method whose Java type corresponds to the parameter's registered SQL
* type.</p>
* Registers the designated output parameter. This version of the method <code>
* registerOutParameter</code> should be used for a user-defined or <code>REF</code> output
* parameter. Examples of user-defined types include: <code>STRUCT</code>, <code>DISTINCT</code>,
* <code>JAVA_OBJECT</code>, and named array types.
*
* <p>All OUT parameters must be registered before a stored procedure is executed.
*
* <p>For a user-defined parameter, the fully-qualified SQL type name of the parameter should also
* be given, while a <code>REF</code> parameter requires that the fully-qualified type name of the
* referenced type be given. A JDBC driver that does not need the type code and type name
* information may ignore it. To be portable, however, applications should always provide these
* values for user-defined and <code>REF</code> parameters.
*
* <p>Although it is intended for user-defined and <code>REF</code> parameters, this method may be
* used to register a parameter of any JDBC type. If the parameter does not have a user-defined or
* <code>REF</code> type, the <i>typeName</i> parameter is ignored.
*
* <p><B>Note:</B> When reading the value of an out parameter, you must use the getter method
* whose Java type corresponds to the parameter's registered SQL type.
*
* @param parameterIndex the first parameter is 1, the second is 2,...
* @param sqlType a value from {@link Types}
* @param typeName the fully-qualified name of an SQL structured type
* @throws SQLException if the parameterIndex is not valid; if a database
* access error occurs or this method is called on a
* closed <code>CallableStatement</code>
* @throws SQLException if the parameterIndex is not valid; if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @see Types
*/
public void registerOutParameter(int parameterIndex, int sqlType, String typeName)
......@@ -562,23 +537,22 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
}
/**
* <p>Registers the parameter in ordinal position
* <code>parameterIndex</code> to be of JDBC type
* <code>sqlType</code>. All OUT parameters must be registered
* before a stored procedure is executed.</p>
* <p>The JDBC type specified by <code>sqlType</code> for an OUT
* parameter determines the Java type that must be used in the <code>get</code> method to read the
* value of that parameter.</p>
* <p>This version of <code>registerOutParameter</code> should be
* used when the parameter is of JDBC type <code>NUMERIC</code> or <code>DECIMAL</code>.</p>
* Registers the parameter in ordinal position <code>parameterIndex</code> to be of JDBC type
* <code>sqlType</code>. All OUT parameters must be registered before a stored procedure is
* executed.
*
* <p>The JDBC type specified by <code>sqlType</code> for an OUT parameter determines the Java
* type that must be used in the <code>get</code> method to read the value of that parameter.
*
* <p>This version of <code>registerOutParameter</code> should be used when the parameter is of
* JDBC type <code>NUMERIC</code> or <code>DECIMAL</code>.
*
* @param parameterIndex the first parameter is 1, the second is 2, and so on
* @param sqlType the SQL type code defined by <code>java.sql.Types</code>.
* @param scale the desired number of digits to the right of the decimal point. It must
* be greater than or equal to zero.
* @throws SQLException if the parameterIndex is not valid; if a database
* access error occurs or this method is called on a
* closed <code>CallableStatement</code>
* @param scale the desired number of digits to the right of the decimal point. It must be greater
* than or equal to zero.
* @throws SQLException if the parameterIndex is not valid; if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @see Types
*/
@Override
......@@ -600,7 +574,6 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
registerOutParameter(nameToIndex(parameterName), sqlType, scale);
}
@Override
public void registerOutParameter(String parameterName, int sqlType, String typeName)
throws SQLException {
......@@ -743,7 +716,6 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
setBinaryStream(nameToIndex(parameterName), inputStream, length);
}
@Override
public void setBinaryStream(String parameterName, InputStream inputStream) throws SQLException {
setBinaryStream(nameToIndex(parameterName), inputStream);
......@@ -790,7 +762,6 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
@Override
public void setBoolean(String parameterName, boolean booleanValue) throws SQLException {
setBoolean(nameToIndex(parameterName), booleanValue);
}
@Override
......@@ -869,7 +840,6 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
setTimestamp(nameToIndex(parameterName), timestamp, cal);
}
@Override
public void setObject(String parameterName, Object obj, int targetSqlType, int scale)
throws SQLException {
......@@ -897,5 +867,4 @@ public abstract class CallableFunctionStatement extends ClientSidePreparedStatem
throws SQLException {
setObject(nameToIndex(parameterName), obj, targetSqlType.getVendorTypeNumber());
}
}
......@@ -3,7 +3,7 @@
* MariaDB Client for Java
*
* Copyright (c) 2012-2014 Monty Program Ab.
* Copyright (c) 2015-2017 MariaDB Ab.
* Copyright (c) 2015-2019 MariaDB Ab.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -52,17 +52,9 @@
package org.mariadb.jdbc;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLSyntaxErrorException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.sql.*;
import java.util.*;
import java.util.regex.*;
public class CallableParameterMetaData implements ParameterMetaData {
......@@ -71,7 +63,8 @@ public class CallableParameterMetaData implements ParameterMetaData {
"\\s*(IN\\s+|OUT\\s+|INOUT\\s+)?([\\w\\d]+)\\s+(UNSIGNED\\s+)?(\\w+)\\s*(\\([\\d,]+\\))?\\s*",
Pattern.CASE_INSENSITIVE);
private static final Pattern RETURN_PATTERN =
Pattern.compile("\\s*(UNSIGNED\\s+)?(\\w+)\\s*(\\([\\d,]+\\))?\\s*(CHARSET\\s+)?(\\w+)?\\s*",
Pattern.compile(
"\\s*(UNSIGNED\\s+)?(\\w+)\\s*(\\([\\d,]+\\))?\\s*(CHARSET\\s+)?(\\w+)?\\s*",
Pattern.CASE_INSENSITIVE);
private final MariaDbConnection con;
private final String name;
......@@ -88,8 +81,8 @@ public class CallableParameterMetaData implements ParameterMetaData {
* @param name procedure/function name
* @param isFunction is it a function
*/
public CallableParameterMetaData(MariaDbConnection con, String database, String name,
boolean isFunction) {
public CallableParameterMetaData(
MariaDbConnection con, String database, String name, boolean isFunction) {
this.params = null;
this.con = con;
if (database != null) {
......@@ -185,14 +178,13 @@ public class CallableParameterMetaData implements ParameterMetaData {
default:
return Types.OTHER;
}
}
private String[] queryMetaInfos(boolean isFunction) throws SQLException {
String paramList;
String functionReturn;
try (PreparedStatement preparedStatement = con.prepareStatement(
try (PreparedStatement preparedStatement =
con.prepareStatement(
"select param_list, returns, db, type from mysql.proc where name=? and db="
+ (database != null ? "?" : "DATABASE()"))) {
......@@ -216,9 +208,9 @@ public class CallableParameterMetaData implements ParameterMetaData {
} catch (SQLSyntaxErrorException sqlSyntaxErrorException) {
throw new SQLException(
"Access to metaData informations not granted for current user. Consider grant select access to mysql.proc "
+ " or avoid using parameter by name", sqlSyntaxErrorException);
+ " or avoid using parameter by name",
sqlSyntaxErrorException);
}
}
private void parseFunctionReturnParam(String functionReturn) throws SQLException {
......@@ -306,7 +298,6 @@ public class CallableParameterMetaData implements ParameterMetaData {
if (isFunction) {
parseFunctionReturnParam(functionReturn);
}
}
public int getParameterCount() {
......@@ -351,11 +342,12 @@ public class CallableParameterMetaData implements ParameterMetaData {
/**
* Get mode info.
*
* <ul>
* <li>0 : unknown</li>
* <li>1 : IN</li>
* <li>2 : INOUT</li>
* <li>4 : OUT</li>
* <li>0 : unknown
* <li>1 : IN
* <li>2 : INOUT
* <li>4 : OUT
* </ul>
*
* @param param parameter index
......@@ -387,5 +379,4 @@ public class CallableParameterMetaData implements ParameterMetaData {
public boolean isWrapperFor(Class<?> iface) {
return false;
}
}
......@@ -3,7 +3,7 @@
* MariaDB Client for Java
*
* Copyright (c) 2012-2014 Monty Program Ab.
* Copyright (c) 2015-2017 MariaDB Ab.
* Copyright (c) 2015-2019 MariaDB Ab.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -50,43 +50,25 @@
*
*/
package org.mariadb.jdbc;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import org.mariadb.jdbc.internal.*;
import org.mariadb.jdbc.internal.com.read.resultset.*;
import org.mariadb.jdbc.internal.util.exceptions.*;
import java.io.*;
import java.math.*;
import java.net.*;
import java.sql.Date;
import java.sql.NClob;
import java.sql.ParameterMetaData;
import java.sql.Ref;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLType;
import java.sql.SQLXML;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import org.mariadb.jdbc.internal.ColumnType;
import org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet;
import org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper;
public abstract class CallableProcedureStatement extends ServerSidePreparedStatement implements
CallableStatement, Cloneable {
import java.sql.*;
import java.util.*;
/**
* Information about parameters, merely from registerOutputParameter() and setXXX() calls.
*/
public abstract class CallableProcedureStatement extends ServerSidePreparedStatement
implements CallableStatement, Cloneable {
/** Information about parameters, merely from registerOutputParameter() and setXXX() calls. */
protected List<CallParameter> params;
protected int[] outputParameterMapper = null;
protected CallableParameterMetaData parameterMetadata;
protected boolean hasInOutParameters;
......@@ -96,17 +78,15 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
*
* @param connection current connection
* @param sql query
* @param resultSetScrollType one of the following <code>ResultSet</code> constants:
* <code>ResultSet.TYPE_FORWARD_ONLY</code>,
* <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
* @param resultSetScrollType one of the following <code>ResultSet</code> constants: <code>
* ResultSet.TYPE_FORWARD_ONLY</code>, <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
* <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
* @param resultSetConcurrency a concurrency type; one of <code>ResultSet.CONCUR_READ_ONLY</code>
* or
* <code>ResultSet.CONCUR_UPDATABLE</code>
* or <code>ResultSet.CONCUR_UPDATABLE</code>
* @throws SQLException is prepareStatement connection throw any error
*/
public CallableProcedureStatement(MariaDbConnection connection, String sql,
int resultSetScrollType, int resultSetConcurrency)
public CallableProcedureStatement(
MariaDbConnection connection, String sql, int resultSetScrollType, int resultSetConcurrency)
throws SQLException {
super(connection, sql, resultSetScrollType, resultSetConcurrency, Statement.NO_GENERATED_KEYS);
}
......@@ -128,9 +108,7 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
return clone;
}
/**
* Set in/out parameters value.
*/
/** Set in/out parameters value. */
public void setParametersVariables() {
hasInOutParameters = false;
for (CallParameter param : params) {
......@@ -166,7 +144,6 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
throw new SQLException("there is no parameter with the name " + parameterName);
}
/**
* Convert parameter name to output parameter index in the query.
*
......@@ -181,7 +158,9 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
if (name != null && name.equalsIgnoreCase(parameterName)) {
if (outputParameterMapper[i] == -1) {
// this is not an outputParameter
throw new SQLException("Parameter '" + parameterName
throw new SQLException(
"Parameter '"
+ parameterName
+ "' is not declared as output parameter with method registerOutParameter");
}
return outputParameterMapper[i];
......@@ -201,7 +180,9 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
try {
if (outputParameterMapper[parameterIndex - 1] == -1) {
// this is not an outputParameter
throw new SQLException("Parameter in index '" + parameterIndex
throw new SQLException(
"Parameter in index '"
+ parameterIndex
+ "' is not declared as output parameter with method registerOutParameter");
}
return outputParameterMapper[parameterIndex - 1];
......@@ -209,8 +190,8 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
if (parameterIndex < 1) {
throw new SQLException("Index " + parameterIndex + " must at minimum be 1");
}
throw new SQLException("Index value '" + parameterIndex
+ "' is incorrect. Maximum value is " + params.size());
throw new SQLException(
"Index value '" + parameterIndex + "' is incorrect. Maximum value is " + params.size());
}
}
......@@ -381,7 +362,6 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
return getOutputResult().getTimestamp(nameToOutputIndex(parameterName));
}
@Override
public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException {
return getOutputResult().getTimestamp(nameToOutputIndex(parameterName), cal);
......@@ -394,8 +374,8 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
@Override
public Object getObject(int parameterIndex) throws SQLException {
Class<?> classType = ColumnType
.classFromJavaType(getParameter(parameterIndex).getOutputSqlType());
Class<?> classType =
ColumnType.classFromJavaType(getParameter(parameterIndex).getOutputSqlType());
if (classType != null) {
return getOutputResult().getObject(indexToOutputIndex(parameterIndex), classType);
}
......@@ -412,7 +392,6 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
return getOutputResult().getObject(indexToOutputIndex(index));
}
@Override
public Object getObject(String parameterName, Map<String, Class<?>> map) throws SQLException {
return getOutputResult().getObject(nameToOutputIndex(parameterName), map);
......@@ -478,7 +457,6 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
return getOutputResult().getURL(nameToOutputIndex(parameterName));
}
@Override
public RowId getRowId(int parameterIndex) throws SQLException {
throw ExceptionMapper.getFeatureNotSupportedException("RowIDs not supported");
......@@ -540,33 +518,31 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
}
/**
* <p>Registers the designated output parameter.
* This version of the method <code>registerOutParameter</code> should be used for a user-defined
* or <code>REF</code> output parameter. Examples of user-defined types include:
* <code>STRUCT</code>, <code>DISTINCT</code>,
* <code>JAVA_OBJECT</code>, and named array types.</p>
* <p>All OUT parameters must be registered
* before a stored procedure is executed.</p>
* <p> For a user-defined parameter, the fully-qualified SQL
* type name of the parameter should also be given, while a <code>REF</code> parameter requires
* that the fully-qualified type name of the referenced type be given. A JDBC driver that does
* not need the type code and type name information may ignore it. To be portable, however,
* applications should always provide these values for user-defined and <code>REF</code>
* parameters.</p>
* <p>Although it is intended for user-defined and <code>REF</code> parameters,
* this method may be used to register a parameter of any JDBC type. If the parameter does not
* have a user-defined or <code>REF</code> type, the
* <i>typeName</i> parameter is ignored.</p>
* <p><B>Note:</B> When reading the value of an out parameter, you
* must use the getter method whose Java type corresponds to the parameter's registered SQL
* type.</p>
* Registers the designated output parameter. This version of the method <code>
* registerOutParameter</code> should be used for a user-defined or <code>REF</code> output
* parameter. Examples of user-defined types include: <code>STRUCT</code>, <code>DISTINCT</code>,
* <code>JAVA_OBJECT</code>, and named array types.
*
* <p>All OUT parameters must be registered before a stored procedure is executed.
*
* <p>For a user-defined parameter, the fully-qualified SQL type name of the parameter should also
* be given, while a <code>REF</code> parameter requires that the fully-qualified type name of the
* referenced type be given. A JDBC driver that does not need the type code and type name
* information may ignore it. To be portable, however, applications should always provide these
* values for user-defined and <code>REF</code> parameters.
*
* <p>Although it is intended for user-defined and <code>REF</code> parameters, this method may be
* used to register a parameter of any JDBC type. If the parameter does not have a user-defined or
* <code>REF</code> type, the <i>typeName</i> parameter is ignored.
*
* <p><B>Note:</B> When reading the value of an out parameter, you must use the getter method
* whose Java type corresponds to the parameter's registered SQL type.
*
* @param parameterIndex the first parameter is 1, the second is 2,...
* @param sqlType a value from {@link Types}
* @param typeName the fully-qualified name of an SQL structured type
* @throws SQLException if the parameterIndex is not valid; if a database
* access error occurs or this method is called on a
* closed <code>CallableStatement</code>
* @throws SQLException if the parameterIndex is not valid; if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @see Types
*/
public void registerOutParameter(int parameterIndex, int sqlType, String typeName)
......@@ -583,23 +559,22 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
}
/**
* <p>Registers the parameter in ordinal position
* <code>parameterIndex</code> to be of JDBC type
* <code>sqlType</code>. All OUT parameters must be registered
* before a stored procedure is executed.</p>
* <p>The JDBC type specified by <code>sqlType</code> for an OUT
* parameter determines the Java type that must be used in the <code>get</code> method to read the
* value of that parameter.</p>
* <p>This version of <code>registerOutParameter</code> should be
* used when the parameter is of JDBC type <code>NUMERIC</code> or <code>DECIMAL</code>.</p>
* Registers the parameter in ordinal position <code>parameterIndex</code> to be of JDBC type
* <code>sqlType</code>. All OUT parameters must be registered before a stored procedure is
* executed.
*
* <p>The JDBC type specified by <code>sqlType</code> for an OUT parameter determines the Java
* type that must be used in the <code>get</code> method to read the value of that parameter.
*
* <p>This version of <code>registerOutParameter</code> should be used when the parameter is of
* JDBC type <code>NUMERIC</code> or <code>DECIMAL</code>.
*
* @param parameterIndex the first parameter is 1, the second is 2, and so on
* @param sqlType the SQL type code defined by <code>java.sql.Types</code>.
* @param scale the desired number of digits to the right of the decimal point. It must
* be greater than or equal to zero.
* @throws SQLException if the parameterIndex is not valid; if a database
* access error occurs or this method is called on a
* closed <code>CallableStatement</code>
* @param scale the desired number of digits to the right of the decimal point. It must be greater
* than or equal to zero.
* @throws SQLException if the parameterIndex is not valid; if a database access error occurs or
* this method is called on a closed <code>CallableStatement</code>
* @see Types
*/
@Override
......@@ -621,14 +596,12 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
registerOutParameter(nameToIndex(parameterName), sqlType, scale);
}
@Override
public void registerOutParameter(String parameterName, int sqlType, String typeName)
throws SQLException {
registerOutParameter(nameToIndex(parameterName), sqlType, typeName);
}
@Override
public void registerOutParameter(int parameterIndex, SQLType sqlType) throws SQLException {
registerOutParameter(parameterIndex, sqlType.getVendorTypeNumber());
......@@ -765,7 +738,6 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
setBinaryStream(nameToIndex(parameterName), inputStream, length);
}
@Override
public void setBinaryStream(String parameterName, InputStream inputStream) throws SQLException {
setBinaryStream(nameToIndex(parameterName), inputStream);
......@@ -812,7 +784,6 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
@Override
public void setBoolean(String parameterName, boolean booleanValue) throws SQLException {
setBoolean(nameToIndex(parameterName), booleanValue);
}
@Override
......@@ -891,7 +862,6 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
setTimestamp(nameToIndex(parameterName), timestamp, cal);
}
@Override
public void setObject(String parameterName, Object obj, int targetSqlType, int scale)
throws SQLException {
......@@ -919,5 +889,4 @@ public abstract class CallableProcedureStatement extends ServerSidePreparedState
throws SQLException {
setObject(nameToIndex(parameterName), obj, targetSqlType.getVendorTypeNumber());
}
}
/*
*
* MariaDB Client for Java
*
* Copyright (c) 2012-2014 Monty Program Ab.
* Copyright (c) 2015-2017 MariaDB Ab.
* Copyright (c) 2015-2019 MariaDB Ab.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -53,27 +52,19 @@
package org.mariadb.jdbc;
import java.sql.ParameterMetaData;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLSyntaxErrorException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import org.mariadb.jdbc.internal.com.read.dao.Results;
import org.mariadb.jdbc.internal.com.read.resultset.SelectResultSet;
import org.mariadb.jdbc.internal.com.send.parameters.ParameterHolder;
import org.mariadb.jdbc.internal.logging.Logger;
import org.mariadb.jdbc.internal.logging.LoggerFactory;
import org.mariadb.jdbc.internal.util.dao.ClientPrepareResult;
import org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper;
import org.mariadb.jdbc.internal.com.read.dao.*;
import org.mariadb.jdbc.internal.com.read.resultset.*;
import org.mariadb.jdbc.internal.com.send.parameters.*;
import org.mariadb.jdbc.internal.logging.*;
import org.mariadb.jdbc.internal.util.dao.*;
import org.mariadb.jdbc.internal.util.exceptions.*;
import java.sql.*;
import java.util.*;
public class ClientSidePreparedStatement extends BasePrepareStatement {
private static final Logger logger = LoggerFactory
.getLogger(ClientSidePreparedStatement.class);
private static final Logger logger = LoggerFactory.getLogger(ClientSidePreparedStatement.class);
private final List<ParameterHolder[]> parameterList = new ArrayList<>();
private ClientPrepareResult prepareResult;
private String sqlQuery;
......@@ -86,28 +77,27 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
*
* @param connection connection
* @param sql sql query
* @param resultSetScrollType one of the following <code>ResultSet</code> constants:
* <code>ResultSet.TYPE_FORWARD_ONLY</code>,
* <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
* @param resultSetScrollType one of the following <code>ResultSet</code> constants: <code>
* ResultSet.TYPE_FORWARD_ONLY</code>, <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
* <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
* @param resultSetConcurrency a concurrency type; one of <code>ResultSet.CONCUR_READ_ONLY</code>
* or
* <code>ResultSet.CONCUR_UPDATABLE</code>
* @param autoGeneratedKeys a flag indicating whether auto-generated keys should be returned;
* one of
* <code>Statement.RETURN_GENERATED_KEYS</code>
* or <code>Statement.NO_GENERATED_KEYS</code>
* or <code>ResultSet.CONCUR_UPDATABLE</code>
* @param autoGeneratedKeys a flag indicating whether auto-generated keys should be returned; one
* of <code>Statement.RETURN_GENERATED_KEYS</code> or <code>Statement.NO_GENERATED_KEYS</code>
* @throws SQLException exception
*/
public ClientSidePreparedStatement(MariaDbConnection connection, String sql,
public ClientSidePreparedStatement(
MariaDbConnection connection,
String sql,
int resultSetScrollType,
int resultSetConcurrency, int autoGeneratedKeys) throws SQLException {
int resultSetConcurrency,
int autoGeneratedKeys)
throws SQLException {
super(connection, resultSetScrollType, resultSetConcurrency, autoGeneratedKeys);
sqlQuery = sql;
if (options.rewriteBatchedStatements) {
prepareResult = ClientPrepareResult
.rewritableParts(sqlQuery, protocol.noBackslashEscapes());
prepareResult = ClientPrepareResult.rewritableParts(sqlQuery, protocol.noBackslashEscapes());
} else {
prepareResult = ClientPrepareResult.parameterParts(sqlQuery, protocol.noBackslashEscapes());
}
......@@ -136,16 +126,14 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
* Executes the SQL statement in this <code>PreparedStatement</code> object, which may be any kind
* of SQL statement. Some prepared statements return multiple results; the <code>execute</code>
* method handles these complex statements as well as the simpler form of statements handled by
* the methods <code>executeQuery</code> and <code>executeUpdate</code>.
* <br>
* the methods <code>executeQuery</code> and <code>executeUpdate</code>. <br>
* The <code>execute</code> method returns a <code>boolean</code> to indicate the form of the
* first result. You must call either the method
* <code>getResultSet</code> or <code>getUpdateCount</code>
* to retrieve the result; you must call <code>getInternalMoreResults</code> to move to any
* subsequent result(s).
* first result. You must call either the method <code>getResultSet</code> or <code>getUpdateCount
* </code> to retrieve the result; you must call <code>getInternalMoreResults</code> to move to
* any subsequent result(s).
*
* @return <code>true</code> if the first result is a <code>ResultSet</code>
* object; <code>false</code> if the first result is an update count or there is no result
* @return <code>true</code> if the first result is a <code>ResultSet</code> object; <code>false
* </code> if the first result is an update count or there is no result
* @throws SQLException if a database access error occurs; this method is called on a closed
* <code>PreparedStatement</code> or an argument is supplied to this method
* @see Statement#execute
......@@ -158,15 +146,14 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
}
/**
* Executes the SQL query in this <code>PreparedStatement</code> object and returns the
* <code>ResultSet</code> object generated by the query.
* Executes the SQL query in this <code>PreparedStatement</code> object and returns the <code>
* ResultSet</code> object generated by the query.
*
* @return a <code>ResultSet</code> object that contains the data produced by the query; never
* <code>null</code>
* @throws SQLException if a database access error occurs; this method is called on a closed
* <code>PreparedStatement</code> or the SQL statement does not return a
* <code>ResultSet</code>
* object
* <code>PreparedStatement</code> or the SQL statement does not return a <code>ResultSet
* </code> object
*/
public ResultSet executeQuery() throws SQLException {
if (execute()) {
......@@ -175,18 +162,15 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
return SelectResultSet.createEmptyResultSet();
}
/**
* Executes the SQL statement in this <code>PreparedStatement</code> object, which must be an SQL
* Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code>
* or
* Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
* <code>DELETE</code>; or an SQL statement that returns nothing, such as a DDL statement.
*
* @return either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0
* for SQL statements that return nothing
* @throws SQLException if a database access error occurs; this method is called on a closed
* <code>PreparedStatement</code> or the SQL statement returns a
* <code>ResultSet</code> object
* <code>PreparedStatement</code> or the SQL statement returns a <code>ResultSet</code> object
*/
public int executeUpdate() throws SQLException {
if (execute()) {
......@@ -203,20 +187,31 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
logger.error("Parameter at position {} is not set", (i + 1));
ExceptionMapper.throwException(
new SQLException("Parameter at position " + (i + 1) + " is not set", "07004"),
connection, this);
connection,
this);
}
}
lock.lock();
try {
executeQueryPrologue(false);
results = new Results(this, fetchSize, false, 1, false, resultSetScrollType,
resultSetConcurrency, autoGeneratedKeys,
protocol.getAutoIncrementIncrement(), sqlQuery, parameters);
results =
new Results(
this,
fetchSize,
false,
1,
false,
resultSetScrollType,
resultSetConcurrency,
autoGeneratedKeys,
protocol.getAutoIncrementIncrement(),
sqlQuery,
parameters);
if (queryTimeout != 0 && canUseServerTimeout) {
// timer will not be used for timeout to avoid having threads
protocol.executeQuery(protocol.isMasterConnection(), results, prepareResult, parameters,
queryTimeout);
protocol.executeQuery(
protocol.isMasterConnection(), results, prepareResult, parameters, queryTimeout);
} else {
protocol.executeQuery(protocol.isMasterConnection(), results, prepareResult, parameters);
}
......@@ -232,12 +227,10 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
executeEpilogue();
lock.unlock();
}
}
/**
* Adds a set of parameters to this <code>PreparedStatement</code> object's batch of send.
* <br>
* Adds a set of parameters to this <code>PreparedStatement</code> object's batch of send. <br>
* <br>
*
* @throws SQLException if a database access error occurs or this method is called on a closed
......@@ -250,10 +243,13 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
for (int i = 0; i < holder.length; i++) {
holder[i] = parameters[i];
if (holder[i] == null) {
logger.error("You need to set exactly " + prepareResult.getParamCount()
logger.error(
"You need to set exactly "
+ prepareResult.getParamCount()
+ " parameters on the prepared statement");
throw ExceptionMapper
.getSqlException("You need to set exactly " + prepareResult.getParamCount()
throw ExceptionMapper.getSqlException(
"You need to set exactly "
+ prepareResult.getParamCount()
+ " parameters on the prepared statement");
}
}
......@@ -271,9 +267,7 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
throw new SQLException("Cannot do addBatch(String) on preparedStatement");
}
/**
* Clear batch.
*/
/** Clear batch. */
@Override
public void clearBatch() {
parameterList.clear();
......@@ -281,9 +275,7 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
this.parameters = new ParameterHolder[prepareResult.getParamCount()];
}
/**
* {inheritdoc}.
*/
/** {inheritdoc}. */
public int[] executeBatch() throws SQLException {
checkClose();
int size = parameterList.size();
......@@ -354,11 +346,21 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
*/
private void executeInternalBatch(int size) throws SQLException {
executeQueryPrologue(true);
results = new Results(this, 0, true, size, false, resultSetScrollType,
resultSetConcurrency, autoGeneratedKeys, protocol.getAutoIncrementIncrement(), null, null);
if (protocol
.executeBatchClient(protocol.isMasterConnection(), results, prepareResult, parameterList,
hasLongData)) {
results =
new Results(
this,
0,
true,
size,
false,
resultSetScrollType,
resultSetConcurrency,
autoGeneratedKeys,
protocol.getAutoIncrementIncrement(),
null,
null);
if (protocol.executeBatchClient(
protocol.isMasterConnection(), results, prepareResult, parameterList, hasLongData)) {
return;
}
......@@ -369,7 +371,10 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
for (int batchQueriesCount = 0; batchQueriesCount < size; batchQueriesCount++) {
protocol.stopIfInterrupted();
try {
protocol.executeQuery(protocol.isMasterConnection(), results, prepareResult,
protocol.executeQuery(
protocol.isMasterConnection(),
results,
prepareResult,
parameterList.get(batchQueriesCount));
} catch (SQLException e) {
if (options.continueBatchOnError) {
......@@ -383,7 +388,10 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
} else {
for (int batchQueriesCount = 0; batchQueriesCount < size; batchQueriesCount++) {
try {
protocol.executeQuery(protocol.isMasterConnection(), results, prepareResult,
protocol.executeQuery(
protocol.isMasterConnection(),
results,
prepareResult,
parameterList.get(batchQueriesCount));
} catch (SQLException e) {
if (options.continueBatchOnError) {
......@@ -397,27 +405,21 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
if (exception != null) {
throw exception;
}
}
/**
* Retrieves a <code>ResultSetMetaData</code> object that contains information about the columns
* of the
* <code>ResultSet</code> object that will be returned when this <code>PreparedStatement</code>
* object is executed.
* <br>
* of the <code>ResultSet</code> object that will be returned when this <code>PreparedStatement
* </code> object is executed. <br>
* Because a <code>PreparedStatement</code> object is precompiled, it is possible to know about
* the
* <code>ResultSet</code> object that it will return without having to execute it. Consequently,
* it is possible to invoke the method <code>getMetaData</code> on a
* <code>PreparedStatement</code> object rather than waiting to execute it and then invoking the
* <code>ResultSet.getMetaData</code> method on the <code>ResultSet</code> object that is
* returned.
* the <code>ResultSet</code> object that it will return without having to execute it.
* Consequently, it is possible to invoke the method <code>getMetaData</code> on a <code>
* PreparedStatement</code> object rather than waiting to execute it and then invoking the <code>
* ResultSet.getMetaData</code> method on the <code>ResultSet</code> object that is returned.
*
* @return the description of a <code>ResultSet</code> object's columns or <code>null</code> if
* the driver cannot return a <code>ResultSetMetaData</code> object
* @throws SQLException if a database access error occurs or this method is
* called on a closed
* @throws SQLException if a database access error occurs or this method is called on a closed
* <code>PreparedStatement</code>
*/
public ResultSetMetaData getMetaData() throws SQLException {
......@@ -444,10 +446,17 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
if (parameterIndex >= 1 && parameterIndex < prepareResult.getParamCount() + 1) {
parameters[parameterIndex - 1] = holder;
} else {
String error = "Could not set parameter at position " + parameterIndex
+ " (values was " + holder.toString() + ")\n"
+ "Query - conn:" + protocol.getServerThreadId()
+ "(" + (protocol.isMasterConnection() ? "M" : "S") + ") ";
String error =
"Could not set parameter at position "
+ parameterIndex
+ " (values was "
+ holder.toString()
+ ")\n"
+ "Query - conn:"
+ protocol.getServerThreadId()
+ "("
+ (protocol.isMasterConnection() ? "M" : "S")
+ ") ";
if (options.maxQuerySizeToLog > 0) {
error += " - \"";
......@@ -466,13 +475,13 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
}
}
/**
* Retrieves the number, types and properties of this <code>PreparedStatement</code> object's
* parameters.
*
* @return a <code>ParameterMetaData</code> object that contains information about the number,
* types and properties for each parameter marker of this <code>PreparedStatement</code> object
* types and properties for each parameter marker of this <code>PreparedStatement</code>
* object
* @throws SQLException if a database access error occurs or this method is called on a closed
* <code>PreparedStatement</code>
* @see ParameterMetaData
......@@ -487,9 +496,12 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
}
private void loadParametersData() throws SQLSyntaxErrorException {
try (ServerSidePreparedStatement ssps = new ServerSidePreparedStatement(connection,
try (ServerSidePreparedStatement ssps =
new ServerSidePreparedStatement(
connection,
sqlQuery,
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY,
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY,
Statement.NO_GENERATED_KEYS)) {
resultSetMetaData = ssps.getMetaData();
parameterMetaData = ssps.getParameterMetaData();
......@@ -501,26 +513,24 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
}
}
/**
* Clears the current parameter values immediately.
*
* <P>In general, parameter values remain in
* force for repeated use of a statement. Setting a parameter value automatically clears its
* previous value. However, in some cases it is useful to immediately release the resources used
* by the current parameter values; this can be done by calling the method
* <code>clearParameters</code>.</p>
* <p>In general, parameter values remain in force for repeated use of a statement. Setting a
* parameter value automatically clears its previous value. However, in some cases it is useful to
* immediately release the resources used by the current parameter values; this can be done by
* calling the method <code>clearParameters</code>.
*/
public void clearParameters() {
parameters = new ParameterHolder[prepareResult.getParamCount()];
}
// Close prepared statement, maybe fire closed-statement events
@Override
public void close() throws SQLException {
super.close();
if (connection == null || connection.pooledConnection == null
if (connection == null
|| connection.pooledConnection == null
|| connection.pooledConnection.noStmtEventListeners()) {
return;
}
......@@ -532,9 +542,7 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
return prepareResult.getParamCount();
}
/**
* {inherit}.
*/
/** {inherit}. */
@Override
public String toString() {
StringBuilder sb = new StringBuilder("sql : '" + sqlQuery + "'");
......@@ -554,9 +562,7 @@ public class ClientSidePreparedStatement extends BasePrepareStatement {
return sb.toString();
}
protected ClientPrepareResult getPrepareResult() {
return prepareResult;
}
}
......@@ -3,7 +3,7 @@
* MariaDB Client for Java
*
* Copyright (c) 2012-2014 Monty Program Ab.
* Copyright (c) 2015-2017 MariaDB Ab.
* Copyright (c) 2015-2019 MariaDB Ab.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
......@@ -52,25 +52,19 @@
package org.mariadb.jdbc;
import java.lang.reflect.Field;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.mariadb.jdbc.internal.util.DefaultOptions;
import org.mariadb.jdbc.internal.util.Options;
import org.mariadb.jdbc.internal.util.constant.Version;
import org.mariadb.jdbc.internal.util.*;
import org.mariadb.jdbc.internal.util.constant.*;
import org.mariadb.jdbc.util.*;
import java.lang.reflect.*;
import java.sql.*;
import java.util.*;
public final class Driver implements java.sql.Driver {
static {
try {
DriverManager.registerDriver(new Driver());
DriverManager.registerDriver(new Driver(), new DeRegister());
} catch (SQLException e) {
throw new RuntimeException("Could not register driver", e);
}
......@@ -91,7 +85,6 @@ public final class Driver implements java.sql.Driver {
} else {
return MariaDbConnection.newConnection(urlParser, null);
}
}
/**
......@@ -110,25 +103,28 @@ public final class Driver implements java.sql.Driver {
*
* @param url the url to get properties for
* @param info the info props
* @return something - not implemented
* @return all possible connector options
* @throws SQLException if there is a problem getting the property info
*/
public DriverPropertyInfo[] getPropertyInfo(String url,
Properties info)
throws SQLException {
if (url != null) {
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
Options options;
if (url != null && !url.isEmpty()) {
UrlParser urlParser = UrlParser.parse(url, info);
if (urlParser == null || urlParser.getOptions() == null) {
return new DriverPropertyInfo[0];
}
options = urlParser.getOptions();
} else {
options = DefaultOptions.parse(HaMode.NONE, "", info, null);
}
List<DriverPropertyInfo> props = new ArrayList<>();
for (DefaultOptions o : DefaultOptions.values()) {
try {
Field field = Options.class.getField(o.getOptionName());
Object value = field.get(urlParser.getOptions());
DriverPropertyInfo propertyInfo = new DriverPropertyInfo(field.getName(),
value == null ? null : value.toString());
Object value = field.get(options);
DriverPropertyInfo propertyInfo =
new DriverPropertyInfo(field.getName(), value == null ? null : value.toString());
propertyInfo.description = o.getDescription();
propertyInfo.required = o.isRequired();
props.add(propertyInfo);
......@@ -139,9 +135,6 @@ public final class Driver implements java.sql.Driver {
return props.toArray(new DriverPropertyInfo[props.size()]);
}
return new DriverPropertyInfo[0];
}
/**
* gets the major version of the driver.
*
......@@ -161,12 +154,12 @@ public final class Driver implements java.sql.Driver {
}
/**
* checks if the driver is jdbc compliant (not yet!).
* checks if the driver is jdbc compliant.
*
* @return false since the driver is not compliant
* @return true since the driver is not compliant
*/
public boolean jdbcCompliant() {
return false;
return true;
}
public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException {
......