This discussion is archived
11 Replies Latest reply: Nov 17, 2011 3:56 PM by 796440 RSS

not supported exception getting parameter metadata in prepared statements

9481 Newbie
Currently Being Moderated
I've been using OpenESB and I've got this problem using oracle jdbc thin drivers.
Is there any work around?
I've tryed several versions including ojbc6.jar...
Thank's in advance
Mauro
  • 1. Re: not supported exception getting parameter metadata in prepared statements
    608689 Newbie
    Currently Being Moderated
    Hi,

    I got the same problem. I downloaded the latest drivers (10.2.0.3.0) and I work with version 10.2.0.3.0 of DB. when I try to get parameterMetaData from preparedStatement, I get the "unsupported feature" exception. The Oracle docs clearly state that all JDBC 3.0 features are supported...

    Following is the code and exception:

    Class.forName("oracle.jdbc.OracleDriver");
    String url = "jdbc:oracle:thin:@pluto:1521:octlnx";
    Connection connection = DriverManager.getConnection(url,"qa2sponsor1","qa2sponsor1");

    String qs = " select * "
    + " from user_information bt "
    + " where bt.user_information_id > :userInformationId ";

    PreparedStatement stmt = connection.prepareStatement(qs);

    stmt.setLong(1, 1);

    ResultSet rs = stmt.executeQuery();

    ParameterMetaData parameterMetaData = stmt.getParameterMetaData();;
    int parameterCount = parameterMetaData.getParameterCount();
    for (int i=1 ; i <= parameterCount ; i++){
         String parameterClassName = parameterMetaData.getParameterClassName(i);
         int parameterType = parameterMetaData.getParameterType(i);
         String parameterTypeName = parameterMetaData.getParameterTypeName(i);
                        System.out.println(/*parameterClassName + "\t\t" */ parameterType "\t\t" + parameterTypeName);
    }

    Exception

    java.sql.SQLException: Unsupported feature
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
         at oracle.jdbc.driver.DatabaseError.throwUnsupportedFeatureSqlException(DatabaseError.java:499)
         at oracle.jdbc.driver.OracleParameterMetaData.getParameterClassName(OracleParameterMetaData.java:198)
         at JdbcTest.main(JdbcTest.java:40)
  • 2. Re: not supported exception getting parameter metadata in prepared statemen
    9481 Newbie
    Currently Being Moderated
    hei oracle guys any news???
    is there any realease plan for this feature???
  • 3. Re: not supported exception getting parameter metadata in prepared statemen
    446894 Newbie
    Currently Being Moderated
    It looks like the PreparedStatement.getParameterMetaData(...) method is not properly implemented, despite the fact that Oracle states that the JDBC driver complies with 3.0 spec.
    If so, this 10g JDBC driver shouldn't be published as 3.0 compliant.
  • 4. Re: not supported exception getting parameter metadata in prepared statemen
    617184 Newbie
    Currently Being Moderated
    In my case those features work when I retrieve ParameterMetaData from a PreparedStatement Object. But when I try to retrieve it from a CallableStatement, it also gives me an "Unsupported Feature Exception".

    I'm using the thin driver, with the ojdbc14.jar of the 10.2.0.3.0 version.

    Alexandre
  • 5. Re: not supported exception getting parameter metadata in prepared statemen
    37922 Newbie
    Currently Being Moderated
    Hi,

    I'm having the same problem, but event in PreparedStaement, with 10.2.0.3

    PreparedStatement psmt = con.prepareStatement("select * from dual t where dummy=?"); //OK
    ParameterMetaData pd = psmt.getParameterMetaData(); //OK
    System.out.println(pd.getParameterCount()); //OK - 1
    System.out.println(pd.getParameterType(1)); //Error: ORA-17023
    System.out.println(pd.getParameterTypeName(1)); //Error: ORA-17023

    Could you copy your working sample here?
  • 6. Re: not supported exception getting parameter metadata in prepared statemen
    611867 Newbie
    Currently Being Moderated
    Well, I needed PMD for setting null parameter value in a query. My workaround:

    i - query parameter count,
    clazz - Java parameter type (Class),

    statement.setNull (i, SQLUtil.getSQLType (clazz));

    where SQLUtil.getSQLType simply maps Java classes to java.sql.Types. This is enough so far but I will propably need different solution soon (taking my requirements into consideration).

    Anyway this "unsupported feature" sucks :( and I think Oracle should do sth with it.
    Good luck.
    hermez/

    Message was edited by:
    hermez
  • 7. Re: not supported exception getting parameter metadata in prepared statemen
    572079 Newbie
    Currently Being Moderated
    Well, add me to the list. I'm using Oracle 11's JDBC driver for java 6 with debug info (11.1.0.6.0-Production+). This amazes me, coming from a Java savy organisation as Oracle.
  • 8. Re: not supported exception getting parameter metadata in prepared statemen
    636157 Newbie
    Currently Being Moderated
    Yes, Add me to the list as well!

    .... in the meantime though.... how on earth can I execute a prepared statement where I don't know the types of the parameters at runtime, I need the meta data information.

    I could use setObject(...); But then I end up with issues on the CLOB's over 4000 charcters...

    Anyone have a solution to this?

    Thanks,

    Jules
  • 9. Re: not supported exception getting parameter metadata in prepared statemen
    199221 Newbie
    Currently Being Moderated
    hermez wrote:
    Well, I needed PMD for setting null parameter value in a query. My workaround:

    i - query parameter count,
    clazz - Java parameter type (Class),

    statement.setNull (i, SQLUtil.getSQLType (clazz));

    where SQLUtil.getSQLType simply maps Java classes to java.sql.Types. This is enough so far but I will propably need different solution soon (taking my requirements into consideration).
    I'm on 10.2(thin). Same problem. statement.getParameterMetaData().getParameterType(i) is unsupported. My current (not extensively tested) workarounds are as follows.

    If I query then I can use resultSet.getMetaData().getColumnType(i) to find the sql type for a returned value.

    If I'm inserting or updating a (possibly) null value it seems like checking for null and using ps.setObject(i, null) works OK and you don't need the type like you do for setNull.
  • 10. Re: not supported exception getting parameter metadata in prepared statements
    412845 Newbie
    Currently Being Moderated
    How about this problem after two years? No Oracle answer???
  • 11. Re: not supported exception getting parameter metadata in prepared statements
    796440 Guru
    Currently Being Moderated
    rtrzicky wrote:
    How about this problem after two years? No Oracle answer???
    This is not an Oracle support site, nor was it previously a Sun support site. Everybody who answers questions here is a volunteer who does so for his own reasons. There are some respondents who happen to work for Oracle, but there's no reason to assume that any Oracle employee will ever see any given thread.