Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MySQL metadata when prepared statement caching is enabled #559

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@
"allPublicConstructors": true,
"name": "com.mysql.cj.exceptions.InvalidConnectionAttributeException"
},
{
"condition": {
"typeReachable": "com.mysql.cj.jdbc.ConnectionImpl"
},
"allPublicConstructors": true,
"name": "com.mysql.cj.PerConnectionLRUFactory"
},
{
"condition": {
"typeReachable": "com.mysql.cj.protocol.ExportControlled"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.Duration;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNoException;

/**
* This test uses docker to start a MySQL database to test against.
Expand All @@ -40,9 +43,14 @@ public class MySQLTests {
private static Process process;

private static Connection openConnection() throws SQLException {
return openConnection(Collections.emptyMap());
}

private static Connection openConnection(Map<String, String> additionalProperties) throws SQLException {
Properties props = new Properties();
props.setProperty("user", USERNAME);
props.setProperty("password", PASSWORD);
props.putAll(additionalProperties);
return DriverManager.getConnection(JDBC_URL, props);
}

Expand Down Expand Up @@ -139,4 +147,10 @@ void simpleDatatypes() throws Exception {
}
}
}

@Test
void preparedStatementCaching() {
assertThatNoException().isThrownBy(() -> openConnection(Map.of("cachePrepStmts", "true")).close());
}

}
Loading