0 Replies Latest reply on Jun 27, 2014 4:42 AM by Debapriya Patra

    Error While Creating Clob Object

    Debapriya Patra Newbie

      Hi All.

       

      I am using JDBC connection to store value in DB. I am getting an error when i am trying to create a CLOB object.

      I need help to resolve this issue. Thanks in advance.

       

      Thanks,

      Deba

       

      Java Version : 1.6.0_25

      OJDBC JAR: ojdbc6-11.2.0.1.0.jar

      WHP Jboss 5.0.1

       

      Here is my code :

      PreparedStatement ps = null;

              ResultSet rs = null;

              Connection con = null;

              int i = 1;

              StringReader strReader = null;

              try {

                  con = DBUtil.getCentralDBConnection();

                  String query = Query.getQuery(Query.ID.UPDATE_TPV_CONFIG_TEMPLATE);

                  if(StringUtils.isBlank(query)){

                      LOGGER.error("SQL query for updateTemplate not found in query.xml ");

                      return;

                  }

                  String sql =  replaceSchemaName(query);

                  LOGGER.trace("SQL : " + sql);

                  LOGGER.trace("Connection Class Name : " + con.getClass().getName());

                  Clob templateFtl = con.createClob(); //--------> This line is throwing error

                  templateFtl.setString(1, template);

                 

                  ps = con.prepareStatement(sql);

                  ps.setString(i++, updatedBy);

                  ps.setDate(i++, new java.sql.Date(new java.util.Date().getTime()));

                  ps.setClob(i++, templateFtl);

                  ps.setString(i++, tpvName);

       

       

                  int result  = ps.executeUpdate();

                  con.commit();

                  if(result != 1){

                      LOGGER.error("NUMBER OF ROWS UPDATED "+result);

                      throw new IOException("Template update failed.");

                  }

              }catch (Exception e){

                  LOGGER.error("Error while updating Template on APP ", e);

                  try {

                      if(con != null){

                          con.rollback();

                      }

                      if(null != strReader){

                          strReader.close();

                      }

                  } catch (SQLException e1) {

                       LOGGER.error("Error while rollback in TPV config DAO", e);

                  }

                  throw e;

              } finally {

                  DBUtil.closeAndIgnore(rs, ps, con);

                 

              }

       

       

      Here is the exception which i am getting:

       

      java.sql.SQLFeatureNotSupportedException: Method is not implemented by JDBC driver

          at org.jboss.resource.adapter.jdbc.WrappedConnection.checkException(WrappedConnection.java:866) [jboss-common-jdbc-wrapper.jar!/:5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028)]

          at org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6.createClob(WrappedConnectionJDK6.java:132) [jboss-common-jdbc-wrapper.jar!/:5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028)]

          at com.intuit.tpv.utils.TPVConfigDAOImpl.updateTemplate(TPVConfigDAOImpl.java:192) [classes:na]

          at com.intuit.tpv.controller.SAMLConfigController.updateSAMLConfigTemplate(SAMLConfigController.java:310) [classes:na]

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.6.0_25]

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [na:1.6.0_25]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [na:1.6.0_25]

          at java.lang.reflect.Method.invoke(Method.java:597) [na:1.6.0_25]

          at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176) [spring-web-3.0.5.RELEASE.jar:3.0.5.RELEASE]

          at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]

          at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]

          at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]

          at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]

          at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]

          at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:571) [spring-webmvc-3.0.5.RELEASE.jar:3.0.5.RELEASE]

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:640) [servlet-api.jar!/:na]

          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) [servlet-api.jar!/:na]

          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [jbossweb.jar!/:na]

          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [jbossweb.jar!/:na]

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) [jbossweb.jar!/:na]

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [jbossweb.jar!/:na]

          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183) [jboss-web-service.jar!/:5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028)]

          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95) [jboss-web-service.jar!/:5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028)]

          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) [jboss-web-service.jar!/:5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028)]

          at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) [jboss-web-service.jar!/:5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028)]

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [jbossweb.jar!/:na]

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb.jar!/:na]

          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [jboss-web-service.jar!/:5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028)]

          at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:383) [jbossweb.jar!/:na]

          at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567) [jbossweb.jar!/:na]

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb.jar!/:na]

          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) [jbossweb.jar!/:na]

          at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:436) [jbossweb.jar!/:na]

          at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:384) [jbossweb.jar!/:na]

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451) [jbossweb.jar!/:na]

          at java.lang.Thread.run(Thread.java:662) [na:1.6.0_25]

      Caused by: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.createClob()Ljava/sql/Clob;

          at org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6.createClob(WrappedConnectionJDK6.java:128) [jboss-common-jdbc-wrapper.jar!/:5.1.0 (build: SVNTag=JBPAPP_5_1_0 date=201009150028)]

          ... 34 common frames omitted