[CONJ-43] PreparedStatement.getMetaData() bug Created: 2013-06-07 Updated: 2013-06-07 Resolved: 2013-06-07 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.1.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Vladislav Vaintroub | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Chris Calender reports : There is a bug in the current release of the MariaDB Java Client v1.1.2 with usage of MySQL Server in version 5.5.25a If using prepared statements with parameters the call of PreparedStatement#getMetaData() always fails with an Exception. This error can be reproduced simply by executing the TestSQL Java class attached to this email. The Exception is always the following: Test: import java.sql.*; public class TestSQL { public static void main(String[] args) throws Exception { Class.forName("org.mariadb.jdbc.Driver"); String dbUrl = "jdbc:mysql://harley:3306/pm"; Connection con = DriverManager.getConnection(dbUrl, "pm", "pm"); System.out.println("Connected to " + dbUrl); String queryOk = "SELECT * FROM PMV_EP_QOS_CALLS WHERE IPADDR = '1.0.10.188'"; String queryFail = "SELECT * FROM PMV_EP_QOS_CALLS WHERE IPADDR = ?"; PreparedStatement prepStmt1 = con.prepareStatement(queryOk); ResultSetMetaData md1 = prepStmt1.getMetaData(); System.out.println("Got ResultSetMetaData for: " + queryOk); PreparedStatement prepStmt2 = con.prepareStatement(queryFail); prepStmt2.setString(1, "1.0.10.188"); ResultSetMetaData md2 = prepStmt2.getMetaData(); // getMetaData() fails if the query contains at least one '?' con.close(); } |