Skip to content

Commit

Permalink
[CONJ-802] version parser correction
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Jul 22, 2020
1 parent fe21e66 commit aa8cdc6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<artifactId>mariadb-java-client</artifactId>
<packaging>jar</packaging>
<name>mariadb-java-client</name>
<version>2.6.1</version>
<version>2.6.2-SNAPSHOT</version>
<description>JDBC driver for MariaDB and MySQL</description>
<url>https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/</url>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,24 @@ public final class Version {

static {
InputStream inputStream = null;
String tmpVersion = "5.5.0";
String tmpVersion = "2.6.2";
try {
Properties prop = new Properties();
inputStream = Version.class.getClassLoader().getResourceAsStream("mariadb.properties");
inputStream = Version.class.getResourceAsStream("/mariadb.properties");
if (inputStream != null) {
prop.load(inputStream);
// get the property value and print it out
tmpVersion = prop.getProperty("version");
} else {
System.out.println("property file 'mariadb.properties' not found in the classpath");
}

// get the property value and print it out
tmpVersion = prop.getProperty("version");
} catch (Exception e) {
// eat
} finally {
try {
inputStream.close();
if (inputStream != null) {
inputStream.close();
}
} catch (IOException ioe) {
// eat
}
Expand Down
19 changes: 19 additions & 0 deletions src/test/java/org/mariadb/jdbc/ConnectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1006,4 +1006,23 @@ public void readOnly() throws SQLException {
connection.setReadOnly(false);
stmt.execute("DROP TABLE testReadOnly");
}


@Test
public void connectionAttributes() throws SQLException {

try (MariaDbConnection conn = (MariaDbConnection) setConnection("&connectionAttributes=test:test1")) {
Statement stmt = conn.createStatement();
ResultSet rs1 = stmt.executeQuery("SELECT @@performance_schema");
rs1.next();
if ("1".equals(rs1.getString(1))) {
ResultSet rs = stmt.executeQuery("SELECT * from performance_schema.session_connect_attrs where processlist_id="
+ conn.getServerThreadId() + " AND ATTR_NAME='test'");
while (rs.next()) {
assertEquals("test1", rs.getString("ATTR_VALUE"));
}
}
};
}

}
3 changes: 1 addition & 2 deletions src/test/resources/conf.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=testj
DB_USER=root
DB_PASSWORD=

DB_PASSWORD=

0 comments on commit aa8cdc6

Please sign in to comment.