Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Not a Bug
-
3.1.4
-
None
-
Java
Description
After upgrading the Database server from 10.11.4 and in java change the connector to MariaDB Connector i get the following error in my application:
Caught SQL exception
|
java.sql.SQLSyntaxErrorException: (conn=11282) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?"%") AND rooms.state NOT LIKE '' ORDER BY rooms.users, rooms.id DESC LIMIT 035' at line 1 |
The code in Java:
public THashMap<Integer, List<Room>> findRooms(NavigatorFilterField filterField, String value, int category, boolean showInvisible) { |
THashMap<Integer, List<Room>> rooms = new THashMap<>(); |
String query = filterField.databaseQuery + " AND rooms.state NOT LIKE " + (showInvisible ? "''" : "'invisible'") + (category >= 0 ? "AND rooms.category = '" + category + "'" : "") + " ORDER BY rooms.users, rooms.id DESC LIMIT " + (page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + "" + ((page * NavigatorManager.MAXIMUM_RESULTS_PER_PAGE) + NavigatorManager.MAXIMUM_RESULTS_PER_PAGE); |
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement(query)) { |
// Get the search expresion : "'%" + value + "%'" |
statement.setString(1, (filterField.comparator == NavigatorFilterComparator.EQUALS ? value : "%" + value + "%" )); |
This works fine with:
MariaDB 10.11.4 + MySQL Connector
MySQL 8.1.0 + MySQL Connector
This fails with:
MariaDB 11.1.1 + MySQL Connector, this results in error:
Unknown system variable 'transaction_isolation'"
MariaDB 11.1.1 + MariaDB Connector/J 4.3.1, this results:
java.sql.SQLSyntaxErrorException: (conn=11282) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?"%") AND rooms.state NOT LIKE '' ORDER BY rooms.users, rooms.id DESC LIMIT 035' at line 1
If i run the Select in HeidiSQL then i get the result, so that looks fine
Attachments
Issue Links
- is blocked by
-
CONJ-1097 JSON类型字段在select union中返回列类型错误
- Closed