PreparedStatement issue.

I just started using PreparedStatements insted of statements. Is there any reason why I would be getting a "Not all variables bound" exception from the DB Driver. Thanks..
sql = "UPDATE LL_TIMESHEET SET DISP = ? WHERE VOLUMEID = ?";
try
m_Statement = m_Connection.prepareStatement(sql);
m_Statement.setString(1, approved);
m_Statement.setInt(2, theEmployee.workflowId);
m_Statement.executeUpdate(sql);
catch(SQLException e)
System.out.println(e.getMessage());
}

This is a simple one....
Get rid of the sql argument in the executeUpdate() call. This is the method of Statement (the parent class of PreparedStatement). The PreparedStatement.executeUpdate() doesn't take any arguments.
In a PreparedStatement, you pass the SQL when creating the PreparedStatement.
Cheers,
--Arnout                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • PreparedStatement issue in weblogic 8.1

    stmt.setTimestamp(num,<Timestamp>) inserts junk values into other fileds in the table.
    This is an occurence in weblogc 8.1.
    Anybody with a similar issue and a solution
    thnaks in advance
    suraj

    I'm sure it has nothing to do with WebLogic. It's a matter of your code, the JDBC driver, and your database.

  • PreparedStatements - issue with grabbing metadata with Spring

    Hi ,
    I am new to SQLite. I am trying to run the statements on Spring
    using SQLite data source in a web application. When i am trying to
    connect to database it's giving the following problem.
    16 Nov 2009 18:34:41,554 WARN [Thread-1] XSnapshotRegistry | No such
    snapshot or helper class: com.signifo.webapp.form.UserForm,
    com.signifo.webapp.form.UserFormHelper
    16 Nov 2009 18:34:42,726 WARN [Thread-1] SQLErrorCodesFactory | Error
    while extracting database product name - falling back to empty error
    codes
    org.springframework.jdbc.support.MetaDataAccessException: Could not
    access DatabaseMetaData method 'getDatabaseProductName'; nested
    exception is java.lang.IllegalAccessException: Class
    org.springframework.jdbc.support.JdbcUtils$1 can not access a member
    of class org.sqlite.MetaData with modifiers "public"
    java.lang.IllegalAccessException: Class
    org.springframework.jdbc.support.JdbcUtils$1 can not access a member
    of class org.sqlite.MetaData with modifiers "public"
    at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.jdbc.support.JdbcUtils$1.processMetaData
    (JdbcUtils.java:209)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData
    (JdbcUtils.java:174)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData
    (JdbcUtils.java:204)
    at org.springframework.jdbc.support.SQLErrorCodesFactory.getErrorCodes
    (SQLErrorCodesFactory.java:185)
    at
    org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource
    (SQLErrorCodeSQLExceptionTranslator.java:126)
    at
    org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.<init>
    (SQLErrorCodeSQLExceptionTranslator.java:92)
    at
    org.springframework.orm.hibernate3.SessionFactoryUtils.newJdbcExceptionTranslator
    (SessionFactoryUtils.java:133)
    at
    org.springframework.orm.hibernate3.HibernateAccessor.getJdbcExceptionTranslator
    (HibernateAccessor.java:235)
    at org.springframework.orm.hibernate3.HibernateTemplate.getSession
    (HibernateTemplate.java:412)
    at org.springframework.orm.hibernate3.HibernateTemplate.execute
    (HibernateTemplate.java:354)
    at org.springframework.orm.hibernate3.HibernateTemplate.loadAll
    (HibernateTemplate.java:515)
    at com.signifo.dao.hibernate.BaseDAOHibernate.getObjects
    (BaseDAOHibernate.java:59)
    at com.signifo.service.impl.BaseServiceImpl.getObjects
    (BaseServiceImpl.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at
    org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection
    (AopUtils.java:335)
    at
    org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint
    (ReflectiveMethodInvocation.java:181)
    at
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
    (ReflectiveMethodInvocation.java:148)
    at
    org.springframework.transaction.interceptor.TransactionInterceptor.invoke
    (TransactionInterceptor.java:96)
    at
    org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
    (ReflectiveMethodInvocation.java:170)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke
    (JdkDynamicAopProxy.java:176)
    at $Proxy4.getObjects(Unknown Source)
    at com.signifo.webapp.listener.StartupListener.setupContext
    (StartupListener.java:104)
    at com.signifo.webapp.listener.StartupListener.contextInitialized
    (StartupListener.java:90)
    at org.apache.catalina.core.StandardContext.listenerStart
    (StandardContext.java:3843)
    at org.apache.catalina.core.StandardContext.start
    (StandardContext.java:4342)
    at org.apache.catalina.core.ContainerBase.addChildInternal
    (ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:
    771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:
    525)
    at org.apache.catalina.startup.HostConfig.deployDescriptor
    (HostConfig.java:627)
    at org.apache.catalina.startup.HostConfig.deployDescriptors
    (HostConfig.java:553)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:
    488)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent
    (HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent
    (LifecycleSupport.java:117)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
    1053)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:
    1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:
    443)
    at org.apache.catalina.core.StandardService.start
    (StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:
    710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    If any body knows how to solve this problem please help me on
    this. Here i am using spring - hibernate - sqlite.
    i have strucked in middle because of this.
    Thanks in advance,
    Sailaja

    I suggest you try a simpilier direct approach as follows and verifiy it works. Often, the JDBC driver does not support getting meta data.
    This example uses DatabaseMetaData to get data from an Oracle database. You will have to find an equivalent object to work with the database you are using.
    DatabaseMetaData dbmd=      null;     
    ResultSet resultSet=     null;
              try{
                   dbmd=          connection.getMetaData();          
                   resultSet=  dbmd.getColumns(null,schemaName,tableName,null);
                   while(resultSet.next()){
                        System.out.println(resultSet.getString("COLUMN_NAME"));
              

  • PreparedStatement cache issue

    1. I have a SELECT query with Explain Plan cost as 39 with some specific inputs.
    2. When this query is run with same inputs directly on Oracle DB through PL/SQL client or TOAD,
    for first run it takes around 13 seconds. Later runs take less than 1 second.
    Query outputs 94 Rows.
    2. When this query is run with java.sql.Statement with same inputs hard coded in query string,
    it takes less than 1 second consistently.
    3. When this query is run with java.sql.PreparedStatement with same inputs bound,
    it takes 12 minutes - 25 minutes consistently.
    4. This increased query execution time is only for specific input values.
    For other other inputs query execution time is normal within 0 - 2 seconds.
    5. With PreparedStatement, when a query string is modified by adding single space in
    between, query executes in around 13 seconds.
    Every time query string is modified by adding space, next query execution takes around 13 seconds.
    But when it is called successively without query string modification, query execution goes beyond 12
    minutes.
    What could be the reason for PreparedStatement execution taking so much time ?
    Is it something related to PreparedStatement cached ?
    Edited by: 872289 on Jul 13, 2011 9:54 AM
    Edited by: 872289 on Jul 13, 2011 9:54 AM

    We are using JDBC through JBoss App server Datasource i.e. oracle-ds.xml
    Content of oracle-ds.xml
    <datasources>
    <!-- Uncomment the following two blocks and put appropriate SERVERNAME, SID, User and password -->
    <local-tx-datasource>
    <jndi-name>JNDI_ORADS</jndi-name>
    <connection-url>jdbc:oracle:thin:@scorpio:1521:devdb</connection-url>
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <user-name>prod64</user-name>
    <password>prod64</password>
    <min-pool-size>10</min-pool-size>
    <max-pool-size>50</max-pool-size>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
    <metadata>
    <type-mapping>Oracle9i</type-mapping>
    </metadata>
    </local-tx-datasource>
    </datasources>
    Content of JSP Code where PreparedStatement is used :
    <%@ page import = "java.util.*, java.sql.Timestamp,java.sql.*,java.io.*"%>
    <%@ page import ="com.prod.db.utils.*"%>
    <%!
    public void testMethod() throws Exception
         Connection w_conn = ConnectionHelper.getConnection();
         String w_query =
              "SELECT usv.timesheetid, ts.weekstartdate, ts.userid, ts.STATUS, ts.timesubmitted, " +
              "usv.projectid, usv.projectname, usv.projectcode, " +
              "usv.itemtype, usv.itemid, usv.itemname, usv.itemcode, usv.itemcategory, " +
              "usv.STATUS, usv.billable, usv.hoursremaining, usv.percentcomplete, " +
              "usv.billable_prev, usv.hoursremaining_prev, usv.percentcomplete_prev, " +
              "ptl.startdate, ptl.timesheetid,ptl.actualhours, ptl.actualhours_prev, usv.orderofselection, " +
              "usv.billable_sub, usv.hoursremaining_sub, usv.percentcomplete_sub, ptl.actualhours_sub, usv.itemmodified, " +
              "usv.startdate, ptl.breakupavailable, ptl.commentavailable, ptl.rejectionstatus, " +
              "ptl.tl_billablehours, usv.pstatus,usv.SEQNUMBER, usv.TSITEMTYPE, " +
              "usv.CanEdit, usv.isHidden, usv.actualenddate, " +
              "nvl(w.wbscode, '99999.99999.99999') as prjWBS,ptl.dailyremhours, usv.enterpriseId,ptl.dailyremhours_changed " +
              "FROM timesheet ts, (TIMESHEET_VIEW_ROUTE usv Left Outer Join projecttimelogs ptl " +
              "on usv.projectid = ptl.projectid " +
              "AND usv.itemtype = ptl.itemtype " +
              "AND usv.itemid = ptl.itemid " +
              "AND usv.startdate <= ptl.startdate " +
              "AND trunc(usv.enddate) >= trunc(ptl.enddate) " +
              "AND usv.timesheetid = ptl.timesheetid " +
              "AND (nvl(ptl.actualHours, 0) > 0 OR nvl(ptl.dailyRemHours, 0) > 0)) " +
              "left outer join wbshierarchy w on usv.enterpriseid = w.ownerid " +
              "AND usv.projectid = w.itemid and w.ownertype = 'Ent' " +
              "AND w.itemtype = 'Prj' " +
              "WHERE ts.userid = usv.userid " +
              "AND usv.userid = ? " +
              "AND (usv.timesheetid = ? OR usv.timesheetid = -1) " +
              "AND (ts.timesheetid = usv.timesheetid or usv.timesheetid = -1) " +
              "AND ts.weekstartdate = ? " +
              "AND usv.startdate < ts.weekstartdate + 7 " +
              "AND (usv.enddate >= ts.weekstartdate OR usv.enddate IS NULL) " +
              "AND (usv.projectid = ? OR -1 = ?) " +
              "AND (usv.STATUS != 'Deleted' OR usv.STATUS IS NULL) " +
              "AND (usv.actualfinish IS NULL OR usv.actualfinish >= ts.weekstartdate) " +
              "AND ('All' = ? OR USV.ITEMTYPE = ?) " +
              "AND (-1 = ? OR USV.ITEMID = ?) " +
              "ORDER BY prjWbs, projectid DESC, TSITEMTYPE, itemcode, itemtype, itemid, orderofselection, 21 ";          
         PreparedStatement w_stmt = w_conn.prepareStatement(w_query);
         w_stmt.setInt(1, 50000);
         w_stmt.setInt(2, 121540);
         w_stmt.setTimestamp(3, Utilities.getTimestamp("11-JUL-2011","dd-MMM-yyyy"));
         w_stmt.setInt(4, -1);
         w_stmt.setInt(5, -1);
         w_stmt.setString(6, "All");
         w_stmt.setString(7, "All");
         w_stmt.setInt(8, -1);
         w_stmt.setInt(9, -1);
         System.out.println("_____******_____ preparedstatement start ");
         long t = System.currentTimeMillis();
         ResultSet w_result = w_stmt.executeQuery();
         t = System.currentTimeMillis() - t;
         int i = 0;
         while(w_result.next()) i++;
         System.out.println("resultset rows" + i);
         System.out.println("_____******_____ preparedstatement finish t=" + t);
         w_result.close();
         w_stmt.close();
         w_conn.close();
    %>
    <%
    testMethod();
    %>

  • Issue in Invoking an Updatable View with Instead of Trigger

    Hi,
    I am trying to insert a record using Updatable View with Instead of Trigger. When i try to save the data, i get the below error:
    java.sql.SQLException: ORA-01403: no data found
    ORA-06512: at line 1
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:889)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:540)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:213)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1075)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1466)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3752)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3887)
    at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallableStatement.java:9323)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1508)
    at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:172)
    at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:432)
    at oracle.jbo.server.EntityImpl.doDMLWithLOBs(EntityImpl.java:8566)
    Can someone help me resolve this issue?
    Also it would be great if you can share Sample codes for Invoking an updatable view with instead of trigger on Save/commit.
    Regards,
    Jeevan

    As a trigger is executed in the db and not in your app it's really hard to help as you did not give any useful information.
    Have you read this blog http://stegemanoracle.blogspot.com/2006/03/using-updatable-views-with-adf.html ?
    Timo
    Edited by: Timo Hahn on 22.09.2011 09:15
    And my friend google also found http://technology.amis.nl/blog/1447/adf-business-components-resfresh-after-insertupdate-and-instead-of-triggers

  • Timed out issue in jsp page!

    Dears,
    It is really amazing for me to see this issue in my application which I deployed in Oracle Application Server 10g r2.
    I am using JDeveloper 10g to create jsp pages.
    On one jsp page i am displaying 15 html tables for a report.
    All tables have 1 query to get records from oracle 10g database.
    Am opening one connection and than one by one running queries just before each table and rendering data through ResultSet
    (which is scrollable).
    If I test this page from JDeveloper, it is displaying fine.
    But when I deploy this page in Oracle Application Server 10g,
    and create a portlet and show this jsp page in portlet and open this page,
    this page most of the time giving 'TIMED OUT', and a few times displaying report properly.
    I tried PreparedStatement to run multiple queries for Oracle DB, but couldn't make it successfully.
    BTW,
    I checked my OAS log, it shows following error:
    09/03/16 18:39:08 hrwfapp: [instance=(null), id=(null)] ERROR: Request has exceeded its warning timeout Time[elapsed=61046ms.
    Warning timeout=20000ms.] Request[id=5003532663665,3 providerId=493501 portletId=117 portletName=AttritionReports
    portletInstance=35555_ATTRITIONREPORTS_493501 user=PUBLIC] Thread[ name=AJPRequestHandler-ApplicationServerThread-6
    priority=5 alive=true interrupted=false groupName=ApplicationServerThreadGroup]
    Please help me in this regard, what should I do to avoid Timed out issue.
    Best Regards

    Hi,
    if this occurs only in combination with portlets then I would try the Oracle Portal forum for help or use customer support to help you analyzing the issue
    Frank

  • How to retrieve a SQL query (in String format) from a PreparedStatement

    Hello all,
    I am in the process of unit testing an application accessing a Oracle 9i 9.2 RDBMS server with JDBC.
    My query is:
    As I have access to PreparedStatement and CallableStatement Java objets but not to the source queries which help create those objects?
    Is thtere a simple way by using an API, to retrieve the SQL command (with possible ? as placeholders for parameters).
    I have already looked at the API documentation for those two objets (and for the Statement and ResultSetmetaData objects too) but to no avail.
    Thank you for any help on this issue,
    Best regards,
    Benoît

    Sorry for having wasted your time... and for not understanding what you meant in your first reply.
    But the codlet was only to show the main idea:
    Here is the code which compiles OK for this approach to reach its intended goal:
    main class (file TestSuiteClass.java):
    import java.sql.*;
    import static java.lang.Class.*;
    * Created by IntelliJ IDEA.
    * User: bgilon
    * Date: 15/03/12
    * Time: 10:05
    * To change this template use File | Settings | File Templates.
    public class TestSuiteClass {
    public static void main(final String[] args) throws Exception {
    // Class.forName("oracle.jdbc.OracleDriver");
    final Connection mconn= new mConnection(
    DriverManager.getConnection("jdbc:oracle:thin:scott/tiger@host:port:service"));
    * final Statement lstmt= TestedClass.TestedMethod(mconn, ...);
    * final String SqlSrc= mconn.getSqlSrc(lstmt).toUpperCase(), SqlTypedReq= mconn.getTypReq(lstmt);
    * assertEquals("test 1", "UPDATE IZ_PD SET FIELD1= ? WHERE FIELDPK= ?", SqlSrc);
    Proxy class (file mConnector.java):
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Map;
    import java.util.Properties;
    * Created by IntelliJ IDEA.
    * User: bgilon
    * Date: 15/03/12
    * Time: 10:05
    * To change this template use File | Settings | File Templates.
    * This file should be compiled with JDK 1.6, but can be used with previous JDK versions.
    * See OKwith1pN booleans usage for not throwing Exceptions as Unknown methods by the conn object...
    public final class mConnection implements Connection {
    private final Connection conn;
    private final List<Statement> Stmts= new ArrayList<Statement>();
    private final List<String> SqlSrcs= new ArrayList<String>();
    private final List<Integer> TypSrcs= new ArrayList<Integer>();
    private final static String jvmv= System.getProperty("java.specification.version");
    private static final boolean OKwith1p2;
    private static final boolean OKwith1p4; /* OKwith1p5, */
    private static final boolean OKwith1p6;
    static {
    /* jvmv= System.getProperty("java.version");
    System.out.println("jvmv = " + jvmv);
    jvmv= System.getProperty("java.vm.version");
    System.out.println("jvmv = " + jvmv); */
    System.out.println("jvmv = " + jvmv);
    OKwith1p2= (jvmv.compareTo("1.2") >= 0);
    OKwith1p4= (jvmv.compareTo("1.4") >= 0);
    // OKwith1p5= (jvmv.compareTo("1.5") >= 0);
    OKwith1p6= (jvmv.compareTo("1.6") >= 0);
    public String getSqlSrc(final Statement pstmt) {
    int ix= 0;
    for(Statement stmt : this.Stmts) {
    if(stmt == pstmt) return SqlSrcs.get(ix);
    ix+= 1;
    return null;
    static private final String[] TypeNames= new String[] { "Statement", "PreparedStatement", "CallableStatement" };
    public String getTypReq(final Statement pstmt) {
    int ix= 0;
    for(Statement stmt : this.Stmts) {
    if(stmt == pstmt) return TypeNames[TypSrcs.get(ix)];
    ix+= 1;
    return null;
    private void storedStatement(
    final Statement stmt,
    final String sqlSrc,
    final Integer typReq
    Stmts.add(stmt);
    SqlSrcs.add(sqlSrc);
    TypSrcs.add(typReq);
    public Connection getDecoratedConn() {
    return conn;
    mConnection(final Connection pconn) {
    this.conn= pconn;
    public boolean isClosed() throws SQLException {
    return conn.isClosed();
    public void rollback(Savepoint savepoint) throws SQLException {
    if(OKwith1p4) conn.rollback(savepoint);
    public boolean isReadOnly() throws SQLException {
    return conn.isReadOnly();
    public int getTransactionIsolation() throws SQLException {
    return conn.getTransactionIsolation();
    public void setTransactionIsolation(int level)throws SQLException {
    conn.setTransactionIsolation(level);
    public Properties getClientInfo() throws SQLException {
    return OKwith1p6 ? conn.getClientInfo() : null;
    public <T> T unwrap(Class<T> iface)
    throws SQLException {
    return conn.unwrap(iface);
    public void setAutoCommit(boolean auto) throws SQLException {
    conn.setAutoCommit(auto);
    public boolean getAutoCommit() throws SQLException {
    return conn.getAutoCommit();
    public Map<String,Class<?>> getTypeMap() throws SQLException {
    if(!OKwith1p2) return null;
    return conn.getTypeMap();
    public void setTypeMap(Map<String,Class<?>> map) throws SQLException {
    if(!OKwith1p2) return;
    conn.setTypeMap(map);
    public void setHoldability(final int holdability) throws SQLException {
    if(OKwith1p4) conn.setHoldability(holdability);
    public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
    return conn.createStruct(typeName, attributes);
    public void commit() throws SQLException {
    conn.commit();
    public void rollback() throws SQLException {
    conn.rollback();
    public boolean isValid(int timeout) throws SQLException {
    return OKwith1p6 && conn.isValid(timeout);
    public void clearWarnings() throws SQLException {
    conn.clearWarnings();
    public int getHoldability() throws SQLException {
    if(!OKwith1p4) return -1;
    return conn.getHoldability();
    public Statement createStatement() throws SQLException {
    return conn.createStatement();
    public PreparedStatement prepareStatement(final String SqlSrc) throws SQLException {
    if(!OKwith1p2) return null;
    final PreparedStatement lstmt= conn.prepareStatement(SqlSrc);
    storedStatement(lstmt, SqlSrc, 1);
    return lstmt;
    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
    if(!OKwith1p4) return null;
    final PreparedStatement lstmt= conn.prepareStatement(sql, columnNames);
    storedStatement(lstmt, sql, 1);
    return lstmt;
    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
    final PreparedStatement lstmt= conn.prepareStatement(sql, resultSetType, resultSetConcurrency);
    storedStatement(lstmt, sql, 1);
    return lstmt;
    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
    final PreparedStatement lstmt= conn.prepareStatement(sql, columnIndexes);
    storedStatement(lstmt, sql, 1);
    return lstmt;
    public void setClientInfo(String name, String value) throws SQLClientInfoException {
    if(OKwith1p6)
    conn.setClientInfo(name, value);
    public PreparedStatement prepareStatement(final String SqlSrc,
    int resultType,
    int resultSetCurrency,
    int resultSetHoldability) throws SQLException {
    final PreparedStatement lstmt= conn.prepareStatement(SqlSrc, resultType, resultSetCurrency);
    storedStatement(lstmt, SqlSrc, 1);
    return lstmt;
    public PreparedStatement prepareStatement(final String SqlSrc,
    int autogeneratedkeys) throws SQLException {
    if(!OKwith1p4) return null;
    final PreparedStatement lstmt= conn.prepareStatement(SqlSrc, autogeneratedkeys);
    storedStatement(lstmt, SqlSrc, 1);
    return lstmt;
    public CallableStatement prepareCall(final String SqlSrc) throws SQLException {
    final CallableStatement lstmt= conn.prepareCall(SqlSrc);
    storedStatement(lstmt, SqlSrc, 2);
    return lstmt;
    public CallableStatement prepareCall(final String SqlSrc,
    int resultType,
    int resultSetCurrency,
    int resultSetHoldability) throws SQLException {
    if(!OKwith1p4) return null;
    final CallableStatement lstmt= conn.prepareCall(SqlSrc, resultType, resultSetCurrency, resultSetHoldability);
    storedStatement(lstmt, SqlSrc, 2);
    return lstmt;
    public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
    return OKwith1p6 ? conn.createArrayOf(typeName, elements) : null;
    public CallableStatement prepareCall(final String SqlSrc,
    int resultType,
    int resultSetCurrency) throws SQLException {
    if (!OKwith1p2) return null;
    final CallableStatement lstmt= conn.prepareCall(SqlSrc, resultType, resultSetCurrency);
    storedStatement(lstmt, SqlSrc, 2);
    return lstmt;
    public SQLXML createSQLXML() throws SQLException {
    return OKwith1p6 ? conn.createSQLXML() : null;
    public DatabaseMetaData getMetaData() throws SQLException {
    return conn.getMetaData();
    public String getCatalog() throws SQLException {
    return conn.getCatalog();
    public void setCatalog(final String str) throws SQLException {
    conn.setCatalog(str);
    public void setReadOnly(final boolean readonly) throws SQLException {
    conn.setReadOnly(readonly);
    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
    return conn.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
    if(!OKwith1p2) return null;
    return conn.createStatement(resultSetType, resultSetConcurrency);
    public String nativeSQL(final String sql) throws SQLException {
    return conn.nativeSQL(sql);
    public void     releaseSavepoint(Savepoint savepoint) throws SQLException {
    if(OKwith1p4) conn.releaseSavepoint(savepoint);
    public Savepoint setSavepoint() throws SQLException {
    return OKwith1p4 ? conn.setSavepoint() : null;
    public Savepoint setSavepoint(final String str) throws SQLException {
    return OKwith1p4 ? conn.setSavepoint(str) : null;
    public boolean isWrapperFor(Class iface) throws SQLException {
    return conn.isWrapperFor(iface);
    public String getClientInfo(final String str) throws SQLException {
    return OKwith1p6 ? conn.getClientInfo(str) : null;
    public void setClientInfo(final Properties pro) throws SQLClientInfoException {
    if (OKwith1p6) conn.setClientInfo(pro);
    public Blob createBlob() throws SQLException {
    return OKwith1p6 ? conn.createBlob() : null;
    public Clob createClob() throws SQLException {
    return OKwith1p6 ? conn.createClob() : null;
    public NClob createNClob() throws SQLException {
    return OKwith1p6 ? conn.createNClob() : null;
    public SQLWarning getWarnings() throws SQLException {
    return conn.getWarnings();
    public void close() throws SQLException {
    conn.close();
    Final word:
    The final word about this is: there is currently three ways to obtain source SQL queries from compiled statement objects.
    a) Use a proxy class the mConnector above;
    b) Use a proxy JDBC driver as Log4JDBC;
    c) Use the trace facility of the driver (however, post analyzing the logs would depend upon the driver selected).
    Thank you for reading,
    Benoît

  • Admin server running into issues in SOA.

    Hi All,
    Can anyone help me.
    I have recently  installed Oracle SOA suite on Linux box. While I was running the Admin Server I am running into Some issues. Though Admin Server is running fine but all that I am running out of memory because of the Logs. Can anyone help me find the issue and solve. I can do some other arrangements to save memory. IF you could help me for any issue I would be so happy. One more thing SOA suite installed on Admin server instead soa_server1 or soa_server2. I still need to SOA-infra setup onto soa_server1 or soa_server2(on different remote machines) [if this info could help also.]
    This issue is repeating every 5 secs.
    <Jul 16, 2013 5:35:21 PM EDT> <Error> <oracle.soa.mediator.common.listener> <BEA-000000> <DBLocker caught exception while retrieving locked messages. Will retry retrieval after 2 seconds
    Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.6.0) (Build 111018)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00904: "TENANT_ID": invalid identifier
    Error Code: 904
    Call: SELECT CASE_ID, CONTAINER_ID, DUMMY1, MSG_ID, COMPONENT_DN, OPERATION, CREATION_DATE, PRIORITY, COMPONENT_STATUS, QNAME_LOCAL_PART, CASE_INFO, QNAME_NAMESPACE, LOCK_TIME, SOURCE_URI, TENANT_ID, INSTANCE_CREATED, IS_EVENT, STATUS FROM MEDIATOR_DEFERRED_MESSAGE WHERE (((STATUS = ?) AND (LOCK_TIME = ?)) AND (CONTAINER_ID = ?))
            bind => [1, 2013-07-16 17:23:12.814, A8424220EE5D11E2BF9C6D1C72885086]
    Query: ReadAllQuery(oracle.tip.mediator.common.persistence.MediatorDeferredMessage)
            at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:305)
            at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:614)
            at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:468)
            at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:447)
            at oracle.toplink.internal.sessions.IsolatedClientSession.executeCall(IsolatedClientSession.java:117)
            at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
            at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:179)
            at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:250)
            at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:583)
            at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2500)
            at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2458)
            at oracle.toplink.queryframework.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:467)
            at oracle.toplink.queryframework.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:874)
            at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:679)
            at oracle.toplink.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:835)
            at oracle.toplink.queryframework.ReadAllQuery.execute(ReadAllQuery.java:445)
            at oracle.toplink.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2265)
            at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1079)
            at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1063)
            at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1037)
            at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1009)
            at oracle.tip.mediator.dispatch.db.DBAccess.getMessageFromDB(DBAccess.java:800)
            at oracle.tip.mediator.dispatch.db.DBAccess.getDeferredMessages(DBAccess.java:821)
            at oracle.tip.mediator.dispatch.db.DeferredDBLocker.getLockedMessages(DeferredDBLocker.java:153)
            at oracle.tip.mediator.common.listener.DBLocker.getLockedMessages(DBLocker.java:173)
            at oracle.tip.mediator.common.listener.DBLocker.run(DBLocker.java:93)
            at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
            at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:184)
            at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)
    Caused By: java.sql.SQLSyntaxErrorException: ORA-00904: "TENANT_ID": invalid identifier
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
            at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
            at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
            at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
            at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
            at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
            at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
            at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:947)
            at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1283)
            at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1441)
            at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
            at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3823)
            at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1671)
            at weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:135)
            at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:814)
            at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:540)
            at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:468)
            at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:447)
            at oracle.toplink.internal.sessions.IsolatedClientSession.executeCall(IsolatedClientSession.java:117)
            at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
            at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:179)
            at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:250)
            at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:583)
            at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2500)
            at oracle.toplink.internal.queryframework.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2458)
            at oracle.toplink.queryframework.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:467)
            at oracle.toplink.queryframework.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:874)
            at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:679)
            at oracle.toplink.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:835)
            at oracle.toplink.queryframework.ReadAllQuery.execute(ReadAllQuery.java:445)
            at oracle.toplink.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2265)
            at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1079)
            at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1063)
            at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1037)
            at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1009)
            at oracle.tip.mediator.dispatch.db.DBAccess.getMessageFromDB(DBAccess.java:800)
            at oracle.tip.mediator.dispatch.db.DBAccess.getDeferredMessages(DBAccess.java:821)
            at oracle.tip.mediator.dispatch.db.DeferredDBLocker.getLockedMessages(DeferredDBLocker.java:153)
            at oracle.tip.mediator.common.listener.DBLocker.getLockedMessages(DBLocker.java:173)
            at oracle.tip.mediator.common.listener.DBLocker.run(DBLocker.java:93)
            at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
            at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:184)
            at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)
    Thank you all.

    Hi Ravi,
    You are much appreciated for your valuable time and knowledge..
    Then delete old domain. Its corrupted. You can clean it by manually updating jdbc datasource files under config/jdbc folder. But I will NOT recommend this. Just delete this domain folder and from user_projects/appliations also delete the folder with same domain name.
    Create a brand new domain using config wizard. Select SOA or BPM whichever you want, and also Enterprise Manager. Then at database, carefully select 11.7 Schemas that you created earlier.
    Though I have not created a new domain. (still Ravi is correct)
    Issues were resolved by updating the new RCU schema with latest version of RCU 11.1.1.7.
    Here What I did is ran the rcu.bat on my local and connected to remote DB.created new schema for each components namely soa-infra,orabam,owsm,MDS. with a new prefix.
    I did not drop the previous schema for SOA.
    went to  *Domain-home*/config/jdbc/
    took the back up for all the *.xml files excluding read.xml(anyway its just an info file).
    Now edited the schema component. Someone might change their schema component password. but my suggestion is not to give any new passwords to the schema components while creating new RCU schema for SOA.
    What I did is changed the component passwords (I know how to mess up and also know how to fix if it's messed up) and ended up with errors.
    So I have now started the server with the command
    ./startWebLogic.sh -Dweblogic.configuration.schemaValidationEnabled=false
    Still I had errors coming up. But I least bothered about the errors because these errors can be solved once get to know what you are doing.
    My server started. Happy then
    Went to admin-url:port/console
    then  Home>Summary of JDBC Data Sources
    next lock & edit
    select each jdbc component and changed the password and confirm password for each
    then save each time for each  next  activate the changes.
    (as I changed all components passwords like <password-encrypted>asdl;lasdfadf=<password-encrypted/>   to <password>welcome1=<password/> in each *.xml file at *domain-home/config/jdbc*)
    I have restarted the Admin server from Command prompt. Expecting that I was doing correct.
    Succeeded. I did not believe that I have seen not even a single error.
    My sincere request that don't mess up with any *.xml file if you are not sure and make sure to take a back up
    Thank you.
    Thanks a lot.
    -Seshikanth

  • Slow performance of PreparedStatement

    I am having difficulty with extremely slow performance or a relatively simply Microsoft SQL Server 2000 call from my Java applet. Most of the application runs fine, but there are certain parts that are repeatedly giving me a long delay before completing their execution. The code is as follows:
    // Create the try block for the execution of the SQL code
            try{
                // Create the command to be executed
                String command = new String( "select Description, Enabled " );
                command += "from tLineInfo where( Line = ? )";
                // Create the SQL text to be executed
                PreparedStatement get = _connection.prepareStatement( command );
                get.setInt( 1, lineNo );
                // Execute the SQL command
                ResultSet lineInfo = get.executeQuery();
                // Display the information accordingly
                if( lineInfo.next() ){
                    // Populate the user data fields
                    description.setText( lineInfo.getString( "Description" ) );
                          <! more display code here >
    }   // End of if statment
                else{
                    // Clear the user data fields
                    description.setText( " " );
                           <! more display code here >
                }   // End of else statements
                // Close the result set in preparation for the next query
                lineInfo.close();
            }   // End of try block
            catch( Exception e ){
                // Display a dialog box informing the user of the problem
                Object[] options = { "     OK     " };
                JOptionPane.showOptionDialog( null, e.getMessage(),
                        "Error",
                        JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE,
                        null, options, options[ 0 ] ); 
            }   // End of Exception catch
            // Get the related area information
            populateAreaCombo( lineNo );       
    private void populateAreaCombo( int lineNo ){
            // Format the areaComboBox
             try{
                // Create a command to get the devices from the database
                String command = new String( "select Area, [Name], [Description] " );
                command += "from tAreas where( Line = ? )";
                // Create the SQL statement to grab the information, and
                // populate the search parameter
                PreparedStatement getAreas =
                        _connection.prepareStatement( command );
                getAreas.setInt( 1, lineNo );
                // Execute the command
                ResultSet areas = getAreas.executeQuery();
                // Loop through the result set, and add collect the areas
                Vector< String > controlAreas = new Vector();
                while( areas.next() ){
                    // Add the area to the comboBox
                    controlAreas.add( Integer.toString( areas.getInt( "Area" ) ) +
                            " - " + areas.getString( "Name" ) + ": " +
                            areas.getString( "Description" ) );
                }   // End of while loop
                      <! more display code here >
                    The application always seem to pause at the second PrepraredStatement call:
    PreparedStatement getAreas =
                        _connection.prepareStatement( command );This seems to be a very simple operation, and it is not even the execution of the query where the long delay is realized. Rather, it is in the actual creation of the object prior to the execution.
    The delay is very repeatable at this exact statement each time.
    Additionally, of interest, is that the delay is only realized on computers remotely connected to the database. If I run this code on the localhost, then there is no delay. As soon as I distribute it, then the delay is incurred. That being said, there is not a network related issue that I can identify here. I have even isolated the server to be on the network with just one other PC, and the delay still persisted.
    Does anyone have any ideas?
    Thanks

    I can determine where the delay occurs by adding
    dialog boxes at a bunch of different steps, then
    monitoring them for when they appear; a little
    archaic, of course, but an easy way to find this
    out.You should
    1. Get the start time
    2. Get the current time at each step.
    3. Print the results at the end.
    4. Repeat a number of times to average.
    >
    When you say that I should not mix database code with
    display code... What exactly do you mean? To be
    more precise in my description, I was simply setting
    a bunch of different text fields and/or check boxes,
    etc., based on the result set returned. It was not
    as if I was creating a portion of the GUI there or
    something. I am assuming that is an allowable
    practice...
    You should have a class that does nothing but the database work. That class should be used by other classes (like classes that do GUI.)
    I have made little effort to close my resources, and
    sometimes they are not closed at all. When you say
    "resources", what exactly do you mean by that? Are
    you referring to the result sets, for example? I do
    not know of other resources that need to be closed,
    except for the connection to the DB itself. This, I
    have as persistent throughout the duration of the
    user's session.
    You must close result sets, statements and connections. They must be closed in that order.
    I am not running this code on the Internet, but it
    has been designed to be run on a small corporate
    network ( < 10 users). This is why I opted for the
    applet to run the entire application through instead
    of doing more HTML work.That is ok.

  • AbstractMethodError while calling PreparedStatement.setBinaryStream()

    I am getting AbstractMethodError while calling PreparedStatement.setBinaryStream(int, InputStream) for a BLOB column
    I am using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit
    JDBC Driver ojdbc6.jar (downloaded from oracle website corresponding to 11.2.0.2 version)
    JDK 6
    I understand this error is due to my code calling abstract method which is not available in JDBC 3.x and it requires JDBC 4.0
    But I am not able to find any traces of usage of earlier version of driver.
    Debugging steps performed with results are as below
    1) I enabled -verbose:class VM argument that outputs all the classes loaded along with jar from which it loads. Everywhere i see ojdbc6.jar (No reference to older or any other jdbc driver jar file)
    2) Below is code segment and its output
    Connection con = getConnection(); // get connection
    DatabaseMetaData d= con.getMetaData();
    d.getDatabaseProductName(); // output: Oracle
    d.getDatabaseProductVersion(); // output: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    d.getDatabaseMajorVersion(); // output: 11
    d.getDatabaseMinorVersion(); // output: 2
    d.getDriverName(); // output: Oracle JDBC driver
    d.getDriverVersion(); // output: 11.2.0.2.0
    d.getDriverMajorVersion(); // output: 11
    d.getDriverMinorVersion(); // output: 2
    d.supportsGetGeneratedKeys(); // output: true
    3) I updated code (its third party component, so not suppose to update :( )
    Added third argument whick works fine (it means at runtime it is using older jdbc driver???)
    PreparedStatement.setBinaryStream(int, InputStream, (int)length
    Please let me know if i am missing anything here... how can i solve this issue?
    Thanks!

    From my initial post
    I am getting AbstractMethodError while calling PreparedStatement.setBinaryStream(int, InputStream) for a BLOB column
    3) I updated code (its third party component, so not suppose to update )
    Added third argument whick works fine (it means at runtime it is using older jdbc driver???)(3) will not work if correct ojdbc6.jar is used. Because third argument is int and not long. long will work with ojdbc6 but will not work with older version.
    I am using third party component and they are using - PreparedStatement.setBinaryStream(int, InputStream)
    It should work with JDK 6, Oracle 11g and ojdbc6.jar driver.
    I am sure its simple classpath issue or some configuration mismatch - just couldn't see it right now.
    I will probably create new workspace / or test on other system now
    Thanks!

  • Transaction Attribute issue in weblogic 8.1

    Hi,
    I have problem with the transaction attribute of my session bean in Weblogic8.1 and SQLServer. Following is the description.
    I have two beans, say SampleBeanOne and SampleBeanTwo. The transaction attribute of SampleBeanOne is "Required" and that of the SampleBeanTwo is "RequiresNew".
    In SampleBeanOne i am trying the execute the a batch of insert quires using PreparedStatement.addBach() and PreparedStatement.executBatch() in a loop that runs of 5 times.
    Inside the loop i am calling a method in SampleBeanTwo to get the next sequence. In that method i am updating the squence and selecting the new value.
    Now the problem i am facing is that when i call the executeBatch() in the PreparedStatement only the final insert statement added to the batch is called and the insert statement added gets vanished.
    If i change the transaction attribute of the SampleBeanTwo to "Required" the code is working fine. But i can't do that since the SampleBeanTwo is accessed throught out my application.
    The same peace of code is working properly with Websphere5 and SQL server combination.
    Kindly help me out in this issue.
    Regards

    Hi
    ThanX for your reply. I raised the issue to the BEA support, they said that the issue is the driver that i am using. It got resolved when i tried with the BEA provided driver. They call it the BEA branded driver for SQL Server.
    Regards
    Muthu

  • Connection Reset issue in Weblogic 8.1

    Hi,
    We have an application running on weblogic 8.1. Please let men explain the steps that we carried out:
    1. A new user was being enrolled through the applciation.
    2. To make the connection object the value of the properties DriverClass, ConnectionURL, UserId and Password was obtained from the config.xml.
    3. preparedStatement.executeUpdate() inserted data in the database.
    This works fine initially but when i leave the system idle for an hour or so and then try to access the application we get an error:
    java.sql.SQLException: Io exception: Connection reset
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)
    at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3675)
    at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:618)
    at oracle.jdbc.driver.OracleStatement.open(OracleStatement.java:575)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2803)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
    at workout.security.weblogic.realm.rdbms.RDBMSDelegate.addGroupMember(RDBMSDelegate.java:757)
    at workout.security.weblogic.realm.rdbms.RDBMSRealm.addGroupMember(RDBMSRealm.java:446)
    at workout.security.weblogic.RDBMSSecurityRealm.add(RDBMSSecurityRealm.java:84)
    at workout.util.LDAPClientHelper.add(LDAPClientHelper.java:39)
    at workout.ejb.Enrollment.EnrollmentBean.enroll(Unknown Source)
    at workout.ejb.Enrollment.Enrollment_q1qync_EOImpl.enroll(Enrollment_q1qync_EOImpl.java:206)
    at workout.ejb.Enrollment.Enrollment_q1qync_EOImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:166)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
    at workout.ejb.Enrollment.Enrollment_q1qync_EOImpl_812_WLStub.enroll(Unknown Source)
    at workout.beans.UserProfile.enroll(Unknown Source)
    at jsp_servlet._customer_service._consumer_enrollment.___processall._jspService(___processall.java:1524)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    After some more attempts the system appears to work fine.
    If anyone can advise then it will be of great help.
    Thanks & Regards
    Neeraj Kanodia

    For those interested, I have some updates on this subject and someone out there sent me a mail asking if I ever found anything out.
    Basically, when I encountered this issue the first time, I was working on a SP2 Portal. We were having numerous small bugs like this one with SP2 that centered around the back button or refresh button. BEA gave us a "super patch" back in July or so that when applied to our SP2 project, fixed our issue. I have sense moved onto SP3, and I did not see the compression issue (so I think SP3 must have the patches correctly setup...like I would assume it would).

  • JDBC PreparedStatement with Oracle 8.0.5 on Linux

    As the subject stated, I am using Oracle 8.0.5 on a Linux machine.
    When I am using a PreparedStatement, somehow, the binded variables are reversed in order.
    E.g.
    String sql = "INSERT INTO TABLE1 (X, Y) VALUES (?, ?)";
    PreparedStatement ps = conn.prepareStatement(sql);
    ps.setString(1, "1");
    ps.setString(2, "2");
    ps.executeUpdate();
    When I run the above, the insertion is successful. However, when I select the table, this is what I get.
    X Y
    2 1
    The values are reversed.
    This is the same for update statement too.
    If I do this,
    "UPDATE TABLE1 SET X = ? WHERE Y = ?"
    ps.setString (1, "3");
    ps.setString (2, "1");
    The above will not be successful.
    If I do this,
    ps.setString (2, "3");
    ps.setString (1, "1");
    The above is successful.
    Somehow the order of the binded variable get messed up.
    Does anyone has any idea why?

    The datatype of X and Y are both VARCHAR2(10) in this case.
    Even if they are numbers, they have the same problem. The order get reversed and the data inserted is incorrect.
    E.g. I have column M VARCHAR2(10) and column N NUMBER (2) in TABLE2.
    String sql = "INSERT INTO TABLE2 (M, N) VALUES (?, ?)";
    PreparedStatement ps = conn.prepareStatement(sql);
    ps.setString(1, "one");
    ps.setInt(2, 1);
    ps.executeUpdate();
    The insert operation is still successful. But when you select it becomes,
    M N
    ? 0
    This is because the order of the variables get reversed again.
    Forgot to mention that if we have used Statement instead of PreparedStatement, we will not have such problem.
    E.g. Statement stmt = conn.createStatement();
    String sql = "INSERT INTO TABLE2 (M, N) VALUES ('one', 1)";
    stmt.executeUpdate(stmt);
    The above will insert fine and when we do a select, the result is correct.
    M N
    one 1
    Though the above works fine, I still prefer to use PreparedStatement because of performance issue. So anyone has any idea what exactly is happening?
    Hmmm, this ones a strange one.
    What type are X and Y in the database? If they are of
    type NUMBER why not try something like.
    ps.setInt(1, 1);
    OR
    ps.setLong(2, 2);
    and see if that makes any difference.

  • Corruption in PreparedStatement

    We are finding that doing an UPDATE using a PreparedStatement was leading to corruption of some character in the updated data. Re-arranging the the elements in the statement to place the TIMESTAMP first fixed the corruption. Is there an issue or limitation that might cause this?
    We are using the latest release of Oracle JDBC drivers but are having issues against the Oracle 8i (8.1.7) Enterprise environment we are testing against.
    Is this a common problem?

    Brian,
    It's not clear to me what you mean by "corruption". Are you getting an error message? Perhaps you could post the entire error message and stack trace, as well as the part of your code that you think is causing the error?
    Good Luck,
    Avi.

  • A question about PreparedStatement and ORA-03115 error

    Dear all,
    I have an issue with JDBC and I would appreciate if you could kindly give me a hand.
    I'm using:
    - Oracle Database 11g Enterprise (Release 11.1.0.6.0)
    - JDBC thin driver version: ( 11.1.0.7.0-Production)
    - JDK 1.6
    - Operating system: Linux (Ubuntu 8.10)
    Here is my code
    import java.sql.*;
    public class Main
        public static void main(String[] args)
            String dbURL = "jdbc:oracle:thin:@localhost:1521:mydatabase";
            String username = "scott";
            String user_password = "tiger";
            try
                Connection connection = DriverManager.getConnection(dbURL, username, user_password);
                String query_text = "SELECT * FROM mytable";
                Statement statement = connection.createStatement();
                ResultSet query_result = statement.executeQuery(query_text);
                connection.close();
            catch (SQLException e)
                for (Throwable t: e)
                    t.printStackTrace();
    }This works pretty well without any problem. But when I want to use PreparedStatement instead of Statement I receive the ORA-03115 error message, that is, when I replace the Statement with PreparedStatement in the following way:
    String query_text =
            "SELECT first_name, ?, id, ?, job_title, salary  FROM mytable "+
            "WHERE id IN ('id14', ?, 'id17', 'id18')";
    PreparedStatement prepared_statement =  connection.preparedStatement(query_text);
    prepared_statement.setString(1, "last_name");
    prepared_statement.setString(2, "birthday");
    prepared_statement.setString(3, "id02");
    ResultSet query_result = prepared_statement.executeQuery(query_text);I get the following:
    java.sql.SQLException: ORA-03115: unsupported network datatype or representation
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
         at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
         at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1377)
         at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:387)
         at mysqlpackage.Main.main(Main.java:33)Therefore, right after
    ResultSet query_result = prepared_statement.executeQuery(query_text);the exception is thrown,
    why it works with Statement but not with PreparedStatement? I tested with several other queries, insert a new row, delete a row, everytime it works well, but when I want to use PreparedStatement instead of Statement, again I have this error message.
    Any idea?
    Thanks in advance,

    OK, I found myself the answer.
    First error, I had use ? also for column names, which is not accepted as the SQL query has to be precompiled.
    Second error: Instead of writing
    ResultSet query_result =  prepared_statement.executeQuery(query_text);I had to write:
    ResultSet query_result =  prepared_statement.executeQuery();I tested with the following
    String query_text =
                  "SELECT first_name, last_name, id, birthday, job_title, salary "+
                  "FROM myenterprise "+
                  "WHERE id IN (?, ?, ?, ?) ";
                PreparedStatement prepared_statement =
                        connection.prepareStatement(query_text);
                prepared_statement.setString(1, "id02");
                prepared_statement.setString(2, "id04");
                prepared_statement.setString(3, "id08");
                prepared_statement.setString(4, "id09");
                ResultSet query_result =  prepared_statement.executeQuery();And it works pretty well now! :)

Maybe you are looking for