Thread: not supported exception getting parameter metadata in prepared statements


Permlink Replies: 14 - Pages: 1 - Last Post: Jul 29, 2009 6:52 PM Last Post By: user8679716
mazzam

Posts: 27
Registered: 08/20/00
not supported exception getting parameter metadata in prepared statements
Posted: Nov 14, 2007 6:24 AM
Click to report abuse...   Click to reply to this thread Reply
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
moshebs

Posts: 1
Registered: 11/15/07
Re: not supported exception getting parameter metadata in prepared statements
Posted: Nov 15, 2007 1:21 AM   in response to: mazzam in response to: mazzam
Click to report abuse...   Click to reply to this thread Reply
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)

mazzam

Posts: 27
Registered: 08/20/00
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Nov 16, 2007 5:13 AM   in response to: moshebs in response to: moshebs
Click to report abuse...   Click to reply to this thread Reply
hei oracle guys any news???
is there any realease plan for this feature???
migueltt

Posts: 4
Registered: 09/19/98
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Dec 27, 2007 6:27 AM   in response to: mazzam in response to: mazzam
Click to report abuse...   Click to reply to this thread Reply
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.
mazzam

Posts: 27
Registered: 08/20/00
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Jan 10, 2008 4:38 AM   in response to: migueltt in response to: migueltt
Click to report abuse...   Click to reply to this thread Reply
up!!!

do we have to buy data direct drivers????
hermez

Posts: 6
Registered: 12/04/07
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Jan 10, 2008 7:46 AM   in response to: mazzam in response to: mazzam
Click to report abuse...   Click to reply to this thread Reply
Hi.

Is it a kind of joke? How can it be unsupported-feature??

But anyway I have the same problem.

Regards
hrmz
joe@bea.com

Posts: 271
Registered: 01/26/04
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Jan 10, 2008 10:09 AM   in response to: hermez in response to: hermez
Click to report abuse...   Click to reply to this thread Reply
I have verified that for a simple case, the DataDirect driver works:

PreparedStatement stmt = c.prepareStatement("select 'qwe' from dual where 1 = ?");

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);
}

I get:
3 number
Alexandre Barbosa

Posts: 1
Registered: 01/11/08
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Jan 11, 2008 5:20 AM   in response to: mazzam in response to: mazzam
Click to report abuse...   Click to reply to this thread Reply
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
bbsjose

Posts: 5
Registered: 08/04/99
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Jan 28, 2008 11:44 AM   in response to: Alexandre Barbosa in response to: Alexandre Barbosa
Click to report abuse...   Click to reply to this thread Reply
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?
sandrots

Posts: 1
Registered: 01/30/08
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Jan 30, 2008 2:58 AM   in response to: bbsjose in response to: bbsjose
Click to report abuse...   Click to reply to this thread Reply
i have the same problem, any news?
hermez

Posts: 6
Registered: 12/04/07
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Jan 30, 2008 4:57 AM   in response to: sandrots in response to: sandrots
Click to report abuse...   Click to reply to this thread Reply
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
tbee

Posts: 135
Registered: 04/12/07
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Feb 26, 2008 2:58 AM   in response to: hermez in response to: hermez
Click to report abuse...   Click to reply to this thread Reply
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.
spankycarbowski

Posts: 1
Registered: 04/25/08
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Apr 25, 2008 7:46 AM   in response to: tbee in response to: tbee
Click to report abuse...   Click to reply to this thread Reply
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
chamlin

Posts: 1
Registered: 03/07/99
Re: not supported exception getting parameter metadata in prepared statemen
Posted: Oct 23, 2008 12:19 PM   in response to: hermez in response to: hermez
Click to report abuse...   Click to reply to this thread Reply
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.
user8679716

Posts: 1
Registered: 07/29/09
Re: not supported exception getting parameter metadata in prepared statements
Posted: Jul 29, 2009 6:52 PM   in response to: mazzam in response to: mazzam
Click to report abuse...   Click to reply to this thread Reply
Same problem.
CallableStatement.getParameterMetaData().getParameterType(i) is unsupported feature.

Any updates?
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums