• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieving CLOB data

 
geetla srujana
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam getting the problem in retrieving CLOB data from database
It's giving SQL Exception General error when iam using CLOB attribute in select statement.
Iam able to store the data upto 4KB
can anyone help me in getting this?
thank you!!
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you please paste down the detailled exception ?

 
geetla srujana
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you
here is my code

<%@ page import="java.sql.*"%>
<%
String url="jdbcdbc:demo";
String username="system";
String password="tiger";
Connection con=null;
Statement st1=null;
PreparedStatement ps1=null;
ResultSet rs=null;
String classpath="sun.jdbc.odbc.JdbcOdbcDriver";
String query1="insert into doubts_demo values(1,empty_clob(),empty_clob())";
String query2="select doubt,answer from doubts_demo where id=?";
Clob clob1=null;
Clob clob2=null;
try
{
Class.forName(classpath);
con=DriverManager.getConnection(url,username,password);
st1=con.createStatement();
con.setAutoCommit (false);
st1.executeUpdate(query1);
ps1=con.prepareStatement(query2);
ps1.setInt(1,1);
rs=ps1.executeQuery();
while(rs.next())
{
clob1 = ((ResultSet)rs).getClob(1);
clob2=((ResultSet)rs).getClob(2);
}
con.commit();
con.close();
}
catch(Exception e)
{
out.println(e.toString());
e.printStackTrace();
}
%>



and exception iam getting


java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLPrepare(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.prepareStatement(Unknown Source)
at org.apache.jsp.demo_jsp._jspService(demo_jsp.java:65)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65123
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on JSP.

For more information, please read this.

This post has been moved to a more appropriate forum.

 
geetla srujana
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry for my mistake..
i won't repeat it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic