aspose file tools*
The moose likes JDBC and the fly likes Retrieving CLOB data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Retrieving CLOB data" Watch "Retrieving CLOB data" New topic
Author

Retrieving CLOB data

geetla srujana
Greenhorn

Joined: Jan 28, 2009
Posts: 5
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

Joined: Mar 28, 2007
Posts: 403
Could you please paste down the detailled exception ?


Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
geetla srujana
Greenhorn

Joined: Jan 28, 2009
Posts: 5
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

Joined: Jan 10, 2002
Posts: 61226
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
geetla srujana
Greenhorn

Joined: Jan 28, 2009
Posts: 5
sorry for my mistake..
i won't repeat it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieving CLOB data