`

请使用Oracle新版本驱动

    博客分类:
  • Java
阅读更多

今天使用apache dbutils连接oracle10G时,后台报错提示

不支持的属性...

,比较纳闷,查看一下源代码,发现有这么一句:

ParameterMetaData pmd = stmt.getParameterMetaData();

 执行这句话报错了。

 

经排查发现,原来是Oracle jdbc驱动的问题。

我用的oracle驱动文件时ojdbc14.jar,但是我打印出驱动版本是

DatabaseMetaData.getDriverVersion()等于9

查看里面的MANIFEST.MF发现Specification-Version项也是9的信息。

 

最后从oracle10g安装目录下重新拷贝了一个ojdbc14.jar,覆盖后问题解决。不要被名字所迷惑阿。

 

所以大家使用oracle时一定要注意jdbc驱动版本,为了避免不必要的麻烦,请及时更换成最新版本的阿~~~~~

========================

 

分享到:
评论
2 楼 nw_lvjuntao 2012-06-29  
和jdk什么的没有关系的,是oracle11.1之前数据库本身就不支持,没有实现jdbc3.0的规范
1 楼 nw_lvjuntao 2012-06-29  
Applies to:
JDBC - Version: 10.1.0.1 to 11.1
Information in this document applies to any platform.

Goal
Does the Oracle JDBC driver support all method calls using PreparedStatement.getParameterMetaData ?


Solution

No, the driver does not support all methods under this package, because the Oracle database does
not currently allow drilling into SQL and its metadata in the way required to return this kind of
information. When aspects of the JDBC 3.0 specification conflict with Oracle database
restrictions, the database restrictions necessarily take precedence.

Specifically, the following method calls fail:

getParameterMode()
getParameterType()
getParameterTypeName()
getParameterClassName()


oracle11.2才支持此方法,不是驱动包的问题,大家不要纠结了

相关推荐

Global site tag (gtag.js) - Google Analytics