原文地址:http://www.023java.com/476618316-1253151534 转载请注明出处
Exception in thread "main" java.sql.SQLException: Parameter metadata not available for the given statement at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910) at com.mysql.jdbc.
Exception in thread "main" java.sql.SQLException: Parameter metadata not available for the given statement
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.MysqlParameterMetadata.checkAvailable(MysqlParameterMetadata.java:65)
at com.mysql.jdbc.MysqlParameterMetadata.getParameterClassName(MysqlParameterMetadata.java:138)
at jdbc.ParameterMetaTest.read(ParameterMetaTest.java:25)
at jdbc.ParameterMetaTest.main(ParameterMetaTest.java:12)
解决办法:
连接数据库时加上一个参数,像这样配置:
String url="jdbc:mysql://localhost:3306/jdbc?generateSimpleParameterMetadata=true";
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.MysqlParameterMetadata.checkAvailable(MysqlParameterMetadata.java:65)
at com.mysql.jdbc.MysqlParameterMetadata.getParameterClassName(MysqlParameterMetadata.java:138)
at jdbc.ParameterMetaTest.read(ParameterMetaTest.java:25)
at jdbc.ParameterMetaTest.main(ParameterMetaTest.java:12)
解决办法:
连接数据库时加上一个参数,像这样配置:
String url="jdbc:mysql://localhost:3306/jdbc?generateSimpleParameterMetadata=true";