Tuesday, December 10, 2013

ORA-03115: unsupported network datatype or representation

In a code written by another developer I was trying to replace JDBC statement code with prepared statements

So I was trying to do something like
   
PreparedStatement preparedStatement=con.prepareStatement(sql);
preparedStatement.setString(1, START_DT);

preparedStatement.setString(2, END_DT);

    
ResultSet set = preparedStatement.executeQuery(sql);

but all the queries being executed by above code were giving me the below exception


"ORA-03115: unsupported network datatype or representation"

I found that mistakenly I was calling the executeQuery method and passing it the sql again (this happend because I changed the code to use PreparedStatements instead of Statement , and if you are using statement you need to pass sql to execute query) , which is wrong I needed to call the function like

ResultSet set = preparedStatement.executeQuery();

and this resolved the problem :).