This discussion is archived
4 Replies Latest reply: Sep 24, 2013 1:21 AM by masijade RSS

does oracle JDBC support ParameterMetaData?

seago Newbie
Currently Being Moderated

I whant to get SQL's parameter type,see below:

 

     pstmt = conn.prepareStatement("select * from table_name where name=?");

     parameterMetaData = pstmt.getParameterMetaData();

     System.out.println(parameterMetaData.getParameterType(1));

 

It raise Exception:

Exception in thread "main" java.sql.SQLException: 不支持的特性(not supported feature)

at oracle.jdbc.driver.OracleParameterMetaData.getParameterType(OracleParameterMetaData.java:166)

  • 1. Re: does oracle JDBC support ParameterMetaData?
    masijade Explorer
    Currently Being Moderated

    Well, seemingly, since you can call it at all without getting a NoSuchMethodException (or something) it IS defined in JDBC, but JDBC, in and of itself, is ONLY an interface.  Whether or not those calls actually DO something depends on the IMPLEMENTATION, and, seemingly, Oracle does NOT implement it.

  • 2. Re: does oracle JDBC support ParameterMetaData?
    rp0428 Guru
    Currently Being Moderated
    does oracle JDBC support ParameterMetaData?

    Yes - it does. And the level of that support depends on the version of the JDBC jar file that you are using.

     

    Since you didn't post ANY information about your Oracle DB version, Java version or JDBC version no specific help can be provided.

     

    The ojdbc7.jar file provides complete support for that object type. Earlier jars, including ojdbc6.jar, support only the 'getParameterCount' method.

  • 3. Re: does oracle JDBC support ParameterMetaData?
    seago Newbie
    Currently Being Moderated

    thanks.

    I change from ojdbc6.jar to ojdbc7.jar,and from JDK6 to JDK7.

    It can support getParameterType now.

  • 4. Re: does oracle JDBC support ParameterMetaData?
    masijade Explorer
    Currently Being Moderated

    rp0428 wrote:

     

    does oracle JDBC support ParameterMetaData?

    Yes - it does. And the level of that support depends on the version of the JDBC jar file that you are using.

     

    Since you didn't post ANY information about your Oracle DB version, Java version or JDBC version no specific help can be provided.

     

    The ojdbc7.jar file provides complete support for that object type. Earlier jars, including ojdbc7.jar, support only the 'getParameterCount' method.

    Of course, I MEANT "the version of the Oracle implementation you're using" not just "Oracle".  Doh!