Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jul 29, 2017
2 parents e0bdf02 + 501b912 commit afb4131
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -2,6 +2,10 @@
sudo: false
language: java
services: docker
addons:
hosts:
- mariadb.example.com

before_install:
- chmod +x .travis/script.sh
- echo "MAVEN_OPTS='-Xmx384m'" > ~/.mavenrc
Expand Down
22 changes: 11 additions & 11 deletions .travis/script.sh
Expand Up @@ -11,34 +11,34 @@ export COMPOSE_FILE=.travis/docker-compose.yml

case "$TYPE" in
"REWRITE" )
urlString='jdbc:mariadb://localhost:3305/testj?user=bob&rewriteBatchedStatements=true&enablePacketDebug=true'
urlString='jdbc:mariadb://mariadb.example.com:3305/testj?user=bob&rewriteBatchedStatements=true&enablePacketDebug=true'
;;
"PREPARE" )
urlString='jdbc:mariadb://localhost:3305/testj?user=bob&useServerPrepStmts=true&enablePacketDebug=true'
urlString='jdbc:mariadb://mariadb.example.com:3305/testj?user=bob&useServerPrepStmts=true&enablePacketDebug=true'
;;
"MULTI" )
urlString='jdbc:mariadb://localhost:3305/testj?user=bob&allowMultiQueries=true&enablePacketDebug=true'
urlString='jdbc:mariadb://mariadb.example.com:3305/testj?user=bob&allowMultiQueries=true&enablePacketDebug=true'
;;
"BULK_SERVER" )
urlString='jdbc:mariadb://localhost:3305/testj?user=bob&useBatchMultiSend=true&useServerPrepStmts=true&enablePacketDebug=true'
urlString='jdbc:mariadb://mariadb.example.com:3305/testj?user=bob&useBatchMultiSend=true&useServerPrepStmts=true&enablePacketDebug=true'
;;
"NO_BULK_CLIENT" )
urlString='jdbc:mariadb://localhost:3305/testj?user=bob&useBatchMultiSend=false&enablePacketDebug=true'
urlString='jdbc:mariadb://mariadb.example.com:3305/testj?user=bob&useBatchMultiSend=false&enablePacketDebug=true'
;;
"NO_BULK_SERVER" )
urlString='jdbc:mariadb://localhost:3305/testj?user=bob&useBatchMultiSend=false&useServerPrepStmts=true&enablePacketDebug=true'
urlString='jdbc:mariadb://mariadb.example.com:3305/testj?user=bob&useBatchMultiSend=false&useServerPrepStmts=true&enablePacketDebug=true'
;;
"COMPRESSION" )
urlString='jdbc:mariadb://localhost:3305/testj?user=bob&useCompression=true&enablePacketDebug=true'
urlString='jdbc:mariadb://mariadb.example.com:3305/testj?user=bob&useCompression=true&enablePacketDebug=true'
;;
*)
if [ -n "$MAXSCALE_VERSION" ]
then
urlString='jdbc:mariadb://localhost:4007/testj?user=bob&killFetchStmtOnClose=false&enablePacketDebug=true'
urlString='jdbc:mariadb://mariadb.example.com:4007/testj?user=bob&killFetchStmtOnClose=false&enablePacketDebug=true'
mysql=( mysql --protocol=tcp -ubob -h127.0.0.1 --port=4007 )
export COMPOSE_FILE=.travis/maxscale-compose.yml
else
urlString='jdbc:mariadb://localhost:3305/testj?user=bob&enablePacketDebug=true'
urlString='jdbc:mariadb://mariadb.example.com:3305/testj?user=bob&enablePacketDebug=true'
fi
;;
esac;
Expand Down Expand Up @@ -87,8 +87,8 @@ else
if [ -n "$GALERA" ]
then
docker-compose -f .travis/galera-compose.yml up -d
urlString='jdbc:mariadb://localhost:3106/testj?user=bob&enablePacketDebug=true'
cmd+=( -DdefaultGaleraUrl="jdbc:mariadb:failover://localhost:3106,localhost:3107,localhost:3108/testj?user=bob&enablePacketDebug=true" )
urlString='jdbc:mariadb://mariadb.example.com:3106/testj?user=bob&enablePacketDebug=true'
cmd+=( -DdefaultGaleraUrl="jdbc:mariadb:failover://mariadb.example.com:3106,mariadb.example.com:3107,mariadb.example.com:3108/testj?user=bob&enablePacketDebug=true" )

fi

Expand Down
2 changes: 1 addition & 1 deletion documentation/changelog.creole
Expand Up @@ -63,7 +63,7 @@ Use dedicated [COM_STMT_BULK_EXECUTE |https://mariadb.com/kb/en/mariadb/com_stmt
(significant only if server MariaDB ≥ 10.2.7)

A new option "useBulkStmts" permit to deactivate this functionality.
|=useBulkStmts| 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//
|=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 ≥ 10.2.7)\\//Default: true. Since 2.1.0//


other evolution
Expand Down
Expand Up @@ -694,7 +694,7 @@ private void handleConnectionPhases(String host) throws SQLException {
// perform hostname verification
// (rfc2818 indicate that if "client has external information as to the expected identity of the server,
// the hostname check MAY be omitted")
if (!options.disableSslHostnameVerification) {
if (!options.disableSslHostnameVerification && !options.trustServerCertificate) {
HostnameVerifierImpl hostnameVerifier = new HostnameVerifierImpl();
SSLSession session = sslSocket.getSession();
if (!hostnameVerifier.verify(host, session)) {
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/org/mariadb/jdbc/BaseTest.java
Expand Up @@ -85,6 +85,7 @@ public class BaseTest {
protected static final String mDefUrl = "jdbc:mariadb://localhost:3306/testj?user=root";
protected static String connU;
protected static String connUri;
protected static String connDnsUri;
protected static String hostname;
protected static int port;
protected static String database;
Expand Down Expand Up @@ -208,6 +209,9 @@ private static void setUri() {
connUri = connU + "?user=" + username
+ (password != null && !"".equals(password) ? "&password=" + password : "")
+ (parameters != null ? "&" + parameters : "");
connDnsUri = "jdbc:mariadb://mariadb.example.com:" + port + "/" + database + "?user=" + username
+ (password != null && !"".equals(password) ? "&password=" + password : "")
+ (parameters != null ? "&" + parameters : "");
}

/**
Expand Down Expand Up @@ -514,6 +518,14 @@ protected Connection setConnection(String additionnallParameters, String databas
return openConnection(connUri + additionnallParameters, null);
}

protected Connection setDnsConnection(String parameters) throws SQLException {
String connU = "jdbc:mariadb://mariadb.example.com:" + port + "/" + database;
String connUri = connU + "?user=" + username
+ (password != null && !"".equals(password) ? "&password=" + password : "")
+ (parameters != null ? "&" + parameters : "");
return openConnection(connUri + parameters, null);
}

/**
* Permit to reconstruct a connection.
*
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/mariadb/jdbc/SslTest.java
Expand Up @@ -323,7 +323,7 @@ private Connection createConnection(Properties info) throws SQLException {
}

private Connection createConnection(Properties info, String user, String pwd) throws SQLException {
String jdbcUrl = connUri;
String jdbcUrl = connDnsUri;
Properties connProps = new Properties(info);
connProps.setProperty("user", user);
if (pwd != null) {
Expand Down

0 comments on commit afb4131

Please sign in to comment.