This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: ORA-03115: unsupported network datatype or representation

 
sirisha alam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I trying to retrieve the results from a cursor in java and am getting the following error.

java.sql.SQLException: ORA-03115: unsupported network datatype or representation

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.v8Odscrarr.receive(v8Odscrarr.java:191)
at oracle.jdbc.ttc7.TTC7Protocol.describe(TTC7Protocol.java:586)
at oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:484)
at oracle.jdbc.driver.OracleStatement.getCursorValue(OracleStatement.java:2661)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4189)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4123)
at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:541)
at server.SessionManager.createSession(SessionManager.java:57)
at server.MMServer.doPost(MMServer.java:74)
at server.MMServer.doGet(MMServer.java:47)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)


Here's the snippet of my java code:

cstmt = sqlUtil.createCallableStatement(query.toString());

cstmt.setString(1, userId);
cstmt.registerOutParameter(2, OracleTypes.CURSOR);
cstmt.execute();
rs = (ResultSet) cstmt.getObject(2); // error is pointing to this statement.

And i am using Oracle thin driver.

Your help is highly appreciated.

Thanks,
Sirisha
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just for my clarification ! are you sure that you are using thin driver, can you put your connection string ?

Shailesh
 
sirisha alam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's my connection string

dbURL = "jdbc racle:thin:";
dbURL = dbURL + dbUser + "/" + dbPasswd + "@" + dbMachine + ":";
dbURL = dbURL + dbPort + ":" + dbServer;
con = DriverManager.getConnection (dbURL);

And i forgot to mention in my original posting that i am using Oracle 10G Database.

Sirisha
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you using classes12.zip to connect with oracle ?

Shailesh
 
sirisha alam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried with classes12.jar as well as ojdbc14.jar which was listed as thin driver (classes for use with jdk1.4) at http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc101040.html

Both the jars are returning the same error.

Sirisha
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oracle 10 requires ojdbc14.jar to connect, i am assuming that you are also registering or loading driver beacause i can not see this in snippet.
generally this error occurs when there is mismatch in driver and oracle.

are other operation successful except calling stored procedure.

Shailesh
[ April 26, 2005: Message edited by: Shailesh Chandra ]
 
sirisha alam
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

yes, I am registering the driver. I am able to call the stored procedures also succesfully, if the out parameter is not a cursor. The only issue i have is with the cursors.
 
Yogesh Gandhi
Ranch Hand
Posts: 226
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The mistake I was doing and getting the same exception was
While preparing the PreparedStatement Object, i was passing the query like this



And while executing it, again I was giving the query in the overloaded method.



Use the executeUpdate method without arguments and not the one with a String argument

After making this change, I didn't get this exception.

Exact root cause is still unknown to me as well.

If someone understands it better, please explain it to me as well.


Also to set the clob data in the database you can use the following
 
Sujoy Choudhury
Ranch Hand
Posts: 136
Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason is very simple.

You have already created the prepared statement using your sql. And then you have replaced all "?" using setters.
After that again you are passing your old sql (which has "?" char/s inside) to the method.
If you pass your old sql it will use that sql to fire the query and obviously "?" char/s didn't get replaced so you get the error.

I hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic