java.sql.SQLException: Parameter metadata not available for the given statement

转】java.sql.SQLException: Parameter metadata not available for the given statement
这是在测试数据库元数据时产生的,数据库为MySql.
解决的方法不难,就是在连接数据库时的URL后面加上可以返回的元数据类型
例如:
出异常时的我的URL是这样子写的:
url=“jdbc:mysql://127.0.0.1:3306/demo?user=root&password=root&useUnicode=true”
正确写法应该是:
url ="jdbc:mysql://127.0.0.1:3306/demo?user=root&password=root&useUnicode=true&generateSimpleParameterMetadata=true"

更改后,程序运行正常!

猜你喜欢

转载自wangqiaowqo.iteye.com/blog/1987969