Weblogic and prepared statement

We had an odd situation in production. We had a situation where we would always get a ORA-00904 Invalid Column name when running the following bit of code (via the prepared statement):
               preparedStatement = con.prepareStatement("select * from KO_USER where GLOBAL_ID=?");
               preparedStatement.setInt(1,thisGlobalId);
               rs = preparedStatement.executeQuery();
But when we simply converted it to a regular statement, as below, it ran fine.
               preparedStatement = con.createStatement();
               rs = preparedStatement.executeQuery("select * from KO_USER where GLOBAL_ID="+thisGlobalId);
Can anyone explain this behavior? We use prepared statements throughout our codebase and never had a problem with it before.
Thanks for any insight.
Sara

Poornima wrote:
Is the prepared statement cache common to all the Connection objects in the Connection Pool or is there a separate cache for each statement in the Connection Pool?There is a separate statement cache for each connection in the pool.
Joe

Similar Messages

  • Statement and Prepared Statement

    if i write a same query with statement and preparedStatement
    like
    Select * from emp_detail where emp_id =20;
    stmt= con.createStatment();
    rs = stmt.executeQuery(query);
    and using preparedStatement
    Select * from emp_detail where emp_id =?;
    pstmt= con.prepareStatement();
    pstmt.setInt(1,20);
    rs = stmt.executeQuery(query);
    Using which statment(Statement or Prepared Statement) the data will retrive fast and why.... in these case ????

    Statement should be quicker than Prepared Statement, because
    Statment do only one thing: send that sql to server or run that sql directly.
    Prepared Statement should do two (or more than two)things:
    1. parse your sql first, prepare a store procedure, then call that store procedure.
    Or
    2. prase your sql first, then use your value to replace "?" for getting a new sql, then work like Statement.
    Prepared Statement is quiker when you use it repeatedly.

  • Help with streaming result sets and prepared statements

    hi all
    I create a callable statement that is capable of streaming.
    statement = myConn2.prepareCall("{call graphProc(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}",java.sql.ResultSet.TYPE_FORWARD_ONLY,
    java.sql.ResultSet.CONCUR_READ_ONLY);
    statementOne.setFetchSize(Integer.MIN_VALUE);
    the class that contains the query is instantiated 6 times the first class streams the results beautifully and then when the second
    rs = DatabaseConnect.statementOne.executeQuery();
    is executed I get the following error
    java.sql.SQLException: Can not use streaming results with multiple result statements
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
    at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1370)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1688)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3031)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:943)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1049)
    at com.mysql.jdbc.CallableStatement.executeQuery(CallableStatement.java:589)
    the 6 instances are not threaded and the result set is closed before the next query executes is there a solution to this problem it would be greatly appreciated
    thanks a lot
    Brian

    Database resources should have the narrowed scope
    possible. I don't think it's a good idea to use a
    ResultSet in a UI to generate a graph. Load the data
    into an object or data structure inside the method
    that's doing the query and close the ResultSet in a
    finally block. Use the data structure to generate
    the graph.
    It's an example of MVC and layering.
    Ok that is my bad for not elaborating on the finer points sorry, the results are not directly streamed into the graphs from the result set. and are processed in another object and then plotted from there.
    with regards to your statement in the beginning I would like to ask if you think it at least a viable option to create six connections. with that said would you be able to give estimated users using the six connections under full usage.
    just a few thoughts that I want to
    bounce off you if you don't mind. Closing the
    statement would defeat the object of of having a
    callable statement How so? I don't agree with that.
    %again I apologise I assumed that since callable statements inherit from prepared statements that they would have the pre compiled sql statement functionality of prepared statements,well If you consider in the example I'm about to give maybe you will see my point at least with regards to this.
    The statement that I create uses a connection and is created statically at the start of the program, every time I make a call the same statement and thus connection is used, creating a new connection each time takes up time and resources. and as you know every second counts
    thanks for your thoughts
    Brian.

  • Date objects and prepared statements

    Hi, I am trying to parse a String into a Date object with format "dd/MM/yyyy hh/mm/ss". Anyway, i have a method in a separate class which reads in a String and converts it to a formatted Date object.
    static public Date convertToDate(String t) throws ParseException {
    Date dd = new Date();
    ParsePosition p = new ParsePosition(0);
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
    //y, M, etc are retrieved as substrings of String t. I know these methods are deprecated as well
    dd.setYear(y);
    dd.setMonth(M);
    dd.setDate(d);
    dd.setHours(h);
    dd.setMinutes(m);
    dd.setSeconds(s);
    String formattedDate = formatter.format(dd);
    Date theDate = formatter.parse(formattedDate);
    return theDate;
    Anyway, I am trying to use this in an SQL statement because I am using an Access DB which has a field of Date/Time value. Is this correct to use a Date object then? I have a prepared statement -
    PreparedStatement query = connection.prepareStatement(
    "SELECT FText FROM wnioutput WHERE Id = ? AND Section = ? AND Start = " +
    "? AND Field = ?");
    //start is the Date object returned from the previous method in a separate class
    query.setInt(1, id);
    query.setInt(2, section);
    query.setDate(3, formattedStart); - with this part, i get a setDate method not found, or something
    query.setString(4, ch);
    Can anybody tell me what the problem is? I know there are Date objects of java.util and java.sql. Should i be using an sql Date object? And if so, how, and where do I do this? Thank you!

    ok, i just tried
    query.setTimestamp(3, new java.sql.Timestamp(formattedStart.getTime()));
    where formattedStart is a java.util.Date object
    and I get the following error message -
    Error occured in getting endDateAndTime: java.sql.SQLException: Exception in databaseDisplay: the error message is:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    java.lang.NullPointerException
    where endDateAndTime is
    // takes in the startDateAndTime as a formatted String (before it is converted into a Date object)
    public String getEndTime(int s, int ID, String stDateAndTime) {
    String end = null;
    gui g = new gui();
    try {
    String sql = "SELECT End FROM wnioutput WHERE Id = " + ID +
    " AND Section = " + s +
    " AND Start = '" + stDateAndTime + "' AND Field = 'Wind50m'";
    ResultSet result = g.queryDatabase(sql);
    if (result.next())
    end = result.getString("End");
    } catch (SQLException sqlex) {
    System.out.println("Error occured in getting endDateAndTime: " + sqlex.toString());
    return end;
    Although this method worked fine before. So the error is in setting the date object in the prepared statement. Anymore suggestions??

  • CF 8 and  prepared statement RETURN_GENERATED_KEYS

    It seems that for CF 8 is using RETURN_GENERATED_KEYS when
    creating prepared statements. Is there any way to change this
    behavior?

    It seems that for CF 8 is using RETURN_GENERATED_KEYS when
    creating prepared statements. Is there any way to change this
    behavior?

  • Help with calling stored procedure and preparing statement

    hi guys help please..I want to call a procedure set the ResultSet to TYPE_SCROLL_INSENSITIVE and CONCUR_UPDATABLE in order for me to scroll thru the resultset from 1st row to end row and vice-versa..but currently, my code has an error becuase im hot sure on how to do this..Can you please help me guys to solve this? Thanks in advance!
    CODE:
                int c = 0;
                String searchArg = txtSearch.getText();
                String studName, mInitial;
                searchArg = searchArg.replace('*', '%');           
                con = FuncCreateDBConnection();
                con.prepareCall("{call dbsample.usp_StudentInfo_SEARCH(?, ?)}");
                *cStmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);*
                cStmt.setString("searchArg", searchArg);
                cStmt.setString("searchType", cmboSearchBy.getSelectedItem().toString());           
                rs = cStmt.executeQuery();           
                if (rs != null){
                    listModel = new DefaultListModel();           
                    lstSearchResult.setModel(listModel);
                    while (rs.next()){                                      
                          mInitial = rs.getString(4).substring(0, 1).toUpperCase();
                          studName = rs.getString(3) + ", " + rs.getString(2) + " " + mInitial + ".";                     
                          listModel.addElement(studName);
                    System.out.println("Rows:"+ rs.getString(2));                                                     
                          c++;
    ERROR:
    Incompatible Types
    Found : java.sql.Statement
    Required: java.sql.CallableStatement

    Nevermind guys..i got it..
    CODE:
                int c = 0;
                String searchArg = txtSearch.getText();
                String studName, mInitial;
                searchArg = searchArg.replace('*', '%');           
                con = FuncCreateDBConnection();           
                cStmt = con.prepareCall("{call dbsample.usp_StudentInfo_SEARCH(?, ?)}",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
                cStmt.setString("searchArg", searchArg);
                cStmt.setString("searchType", cmboSearchBy.getSelectedItem().toString());           
                rs = cStmt.executeQuery();           
                if (rs != null){
                    listModel = new DefaultListModel();           
                    lstSearchResult.setModel(listModel);
                    while (rs.next()){                                      
                          mInitial = rs.getString(4).substring(0, 1).toUpperCase();
                          studName = rs.getString(3) + ", " + rs.getString(2) + " " + mInitial + ".";                     
                          listModel.addElement(studName);
                    System.out.println("Rows:"+ rs.getString(2));                                                     
                          c++;
                }     Edited by: daimous on Jan 31, 2008 6:04 PM

  • Connection/ResultSets/Prepared Statement opening and closing

    Hi all another question that was sparked by a thread that I recently read. I believe it was duffmo who got the code from jverd. The code I am referring to is to have an open and close connection specified in a Utility or Database class. I wanted to know if there was any issues with having methods that open and close connections/result sets/ preparedStatements. Currently I am putting the finally blocks inside each of my methods. There is obvious benefits to putting the methods in a class on their own (namely code re-use) but I wanted to know if there are any dangers. (This may seem like a dumb question, but I've found from experience it's the things that you don't know that will cost you loads of time).
    thanks again.

    Hi all another question that was sparked by athread
    that I recently read. I believe it was duffmo who
    got the code from jverd. Generally speaking it's fine.
    But as always you may have some long term design
    issues to think about. If you build a simple
    framework that consists of one class and that does
    all that your program does then great.
    Once you start add more complexity though you'll want
    to be careful that you aren't reinventing the Spring
    wheel or even ending up implementing your own
    connection pool. Both of which, judging from posts
    here seem to happen from time to time.
    So I guess all in all, yes it's much better than
    scattering the code all about but depending on what
    you are going to be doing with it you may want to
    look at the various ORM frameworks to see if they are
    really the direction you should be going in.Thanks for the information cotton. I just wanted to make certain that it was a sensible thing to do. When I had first asked about connections I was told they should be opened an closed in the same spot, unfortunately I took that explanation a little too much to heart, and started opening and closing every connection resultset and prepared statement in each of the DAO classes that I was using.
    Guess it's going to be a bit of work to refactor, but worth it for the cleaner code that will result.

  • Prepared Statement and Stored Procedure difference?

    For SQL in my web applications I use PreparedStatement object alot in my JDBC working with Oracle 9i.
    I also heard the term Stored Procedure. What is the difference between Stored Procedure and Prepared Statement?

    I am new to java programming, can anybody explain
    what exactly precompiled means
    Thank you
    PalspaceWhat does you subject line have to do with your question?
    The difference between a stored proc and a prepared statement is mainly this.
    A stored proc is stored in the database server permanently and can be used and re-used from a different connections.
    A PreparedStatement is not valid across connections.
    Stored procs are almost always precompiled. (I am just hedging a bit here just in case but you can consider it 100%)
    PreparedStatements MAY be precompiled. Hard to say.
    Precompiling means at least one of and perhaps all of the following depending on the database
    - The parsing of the SQL statement
    - The checking of the SQL against the data dictionary to ensure that the tables and columns referenced actually exist
    - The preparation of a query plan
    Last but not least Stored procedures may (and often do) contain more than simple queries but are in fact relatively complex programs written in a DB specific language (an offshoot of SQL of some sort).

  • Prepared statement cache & Oracle

    Hi -
    Does Weblogic's prepared statement caching only work when using their
    type-2 Oracle driver? Are there any documents about using this
    Weblogic feature? I have only found small references in the Weblogic
    documentation so far -- nothing with much detail.
    Thanks for any help,
    - Mark

    "Joseph Weinstein" <[email protected]> wrote in message
    news:[email protected]..
    >
    >
    Mark Cassidy wrote:
    Hi -
    Does Weblogic's prepared statement caching only work when using their
    type-2 Oracle driver?No. It is generic to JDBC. Any JDBC driver should allow re-use ofPreparedStatements,
    and our pool will cache for any driver.
    Are there any documents about using this
    Weblogic feature? I have only found small references in the Weblogic
    documentation so far -- nothing with much detail.You are correct that there is too little documentation at this time.
    Thanks for any help,
    - Mark
    Thanks Joe!
    Do you know if each connection's cache is FIFO? Or do you use
    least-recently-used algorithm?
    I found one comment you made regarding XA pools. That means that if we are
    doing 2-phase commit processing that some of these benefits could erode? I
    didn't understand why. If we assume that the connections in a given pool
    after a time get a good sampling of popular prepared statements, would their
    being XA or not matter? Maybe I missed your point entirely.
    - Mark

  • Batch updates with callable/prepared statement?

    The document http://edocs.bea.com/wls/docs70/oracle/advanced.html#1158797 states
    that "Using Batch updates with the callableStatement or preparedStatement is
    not supported". What does that actually mean? We have used both callable and prepared
    statements with the batch update in our current project (with the Oracle 817 db).
    It seems to run ok anyway.

    So the documentation should state that batch updates do not work ok in old versions
    of JDriver for Oracle, BUT work correctly with newer version. Additionally, batch
    updates work ok when used with Oracle supplied jdbc-drivers?
    "Stephen Felts" <[email protected]> wrote:
    Support for addBatch and executeBatch in the WLS Jdriver for Oracle was
    added in 7.0SP2.
    It was not available in 6.X or 7.0 or 7.0SP1.
    "Janne" <[email protected]> wrote in message news:3edb0cdc$[email protected]..
    The document http://edocs.bea.com/wls/docs70/oracle/advanced.html#1158797
    states
    that "Using Batch updates with the callableStatement or preparedStatementis
    not supported". What does that actually mean? We have used both callableand prepared
    statements with the batch update in our current project (with the Oracle817 db).
    It seems to run ok anyway.

  • Performance of Stored procedures against Prepared Statements

    What will be the exact difference in the performance between implementing stored procedures and prepared statements ?

    Short answer: it depends.
    There will probobaly be very little difference in performance difference for a sipmle insert / update etc.
    Multiple inserts / updates etc you will probobaly find faster with a stored procedure rather than n prepared statments as you only have to contact the database once vs n times.
    Hope this helps!

  • Weblogic generated finder method not setting parameters in prepared statement

    Hi,
    I am using weblogic 6.1 sp2 and have a CMP bean with a finder defined as follows:
    <query>
    <query-method>
    <method-name>findByPcPayclass</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql>SELECT DISTINCT OBJECT(p) FROM Payments p, PaymentType
    t WHERE p.paymentType.pcPayClass = '?1'</ejb-ql>
    </query>
    The weblogic generated code follwos:
    public java.util.Collection ejbFindByPcPayclass(java.lang.String param0) throws
    javax.ejb.FinderException
    if(__WL_verbose) {
    Debug.say("called findByPcPayclass");
    java.sql.Connection __WL_con = null;
    java.sql.PreparedStatement __WL_stmt = null;
    java.sql.ResultSet __WL_rs = null;
    __WL_pm.flushModifiedBeans();
    try {
    __WL_con = __WL_pm.getConnection();
    } catch (java.lang.Exception e) {
    __WL_pm.releaseResources(__WL_con, __WL_stmt, __WL_rs);
    throw new javax.ejb.FinderException("Couldn't get connection: " + EOL +
    e.toString() + EOL +
    RDBMSUtils.throwable2StackTrace(e));
    try {
    java.lang.String __WL_query = "SELECT WL0.DEPOSIT_UID, WL0.GLA_ID, WL0.MARKET_CODE,
    WL0.ORIGINAL_PAYMENT_ID, WL0.PAYMENT_ACCT_NUMBER, WL0.PAYMENT_ACK, WL0.PAYMENT_AMOUNT,
    WL0.PAYMENT_CARD_CHECK_NUM, WL0.PAYMENT_CARE_SITE, WL0.PAYMENT_CUST_NAME, WL0.PAYMENT_DESIGNATOR,
    WL0.PAYMENT_EFFECTIVE_DATE, WL0.PAYMENT_ID, WL0.PAYMENT_INV_ID, WL0.PAYMENT_MOBILE_NUMBER,
    WL0.PAYMENT_SPLIT, WL0.PC_PAYCLASS, WL0.PT_UID, WL0.TT_UID FROM payment_type
    WL2, payment_type WL1, payments WL0 WHERE (WL2.PC_PAYCLASS = '?1') AND WL0.PT_UID
    = WL2.PT_UID " + __WL_pm.selectForUpdate();
    if(__WL_verbose) {
    Debug.say("Finder produced statement string " + __WL_query);
    __WL_stmt = __WL_con.prepareStatement(__WL_query);
    // preparedStatementParamIndex reset.
    __WL_rs = __WL_stmt.executeQuery();
    } catch (java.lang.Exception e) {
    __WL_pm.releaseResources(__WL_con, __WL_stmt, __WL_rs);
    throw new javax.ejb.FinderException(
    "Exception in findByPcPayclass while preparing or executing " +
    "statement: '" + __WL_stmt + "'" + EOL +
    e.toString() + EOL +
    RDBMSUtils.throwable2StackTrace(e));
    The parameter is never set in the prepared statement before it executes. This
    causes the finder to return an empty result set. Is this a bug or is there some
    configuration that I missed. I am using ant 1.5 to do the ejbc. the ant target
    follows:
    <target name="ccas.ejbc" depends="ccas.compile, ccas.stage, dd.combine">
    <ejbjar srcdir="${buildClasses}/"
    descriptordir="${buildOutput}/ear_dd"
    basejarname="CCAS"
    flatdestdir="true"
    dependency="full">
    <support dir="${buildClasses}">
    <include name="CCAS/**/*.class"/>
    </support>
    <weblogic destdir="${ear.stage.dir}"
    rebuild="false"
    keepgenerated="true"
    jvmdebuglevel="16">
    <classpath refid="classpath"/>
    <wlclasspath refid="classpath"/>
    </weblogic>
    <include name="ejb-jar.xml"/>
    <exclude name="**/*-weblogic*.xml"/>
    </ejbjar>
    </target>

    replace '?1' with ?1
    "Eugene Stephens" <[email protected]> wrote in message
    news:[email protected]...
    >
    Hi,
    I am using weblogic 6.1 sp2 and have a CMP bean with a finder defined asfollows:
    <query>
    <query-method>
    <method-name>findByPcPayclass</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </query-method>
    <ejb-ql>SELECT DISTINCT OBJECT(p) FROM Payments p,PaymentType
    t WHERE p.paymentType.pcPayClass = '?1'</ejb-ql>
    </query>
    The weblogic generated code follwos:
    public java.util.Collection ejbFindByPcPayclass(java.lang.String param0)throws
    javax.ejb.FinderException
    if(__WL_verbose) {
    Debug.say("called findByPcPayclass");
    java.sql.Connection __WL_con = null;
    java.sql.PreparedStatement __WL_stmt = null;
    java.sql.ResultSet __WL_rs = null;
    __WL_pm.flushModifiedBeans();
    try {
    __WL_con = __WL_pm.getConnection();
    } catch (java.lang.Exception e) {
    __WL_pm.releaseResources(__WL_con, __WL_stmt, __WL_rs);
    throw new javax.ejb.FinderException("Couldn't get connection: " +EOL +
    e.toString() + EOL +
    RDBMSUtils.throwable2StackTrace(e));
    try {
    java.lang.String __WL_query = "SELECT WL0.DEPOSIT_UID, WL0.GLA_ID,WL0.MARKET_CODE,
    WL0.ORIGINAL_PAYMENT_ID, WL0.PAYMENT_ACCT_NUMBER, WL0.PAYMENT_ACK,WL0.PAYMENT_AMOUNT,
    WL0.PAYMENT_CARD_CHECK_NUM, WL0.PAYMENT_CARE_SITE, WL0.PAYMENT_CUST_NAME,WL0.PAYMENT_DESIGNATOR,
    WL0.PAYMENT_EFFECTIVE_DATE, WL0.PAYMENT_ID, WL0.PAYMENT_INV_ID,WL0.PAYMENT_MOBILE_NUMBER,
    WL0.PAYMENT_SPLIT, WL0.PC_PAYCLASS, WL0.PT_UID, WL0.TT_UID FROMpayment_type
    WL2, payment_type WL1, payments WL0 WHERE (WL2.PC_PAYCLASS = '?1') ANDWL0.PT_UID
    = WL2.PT_UID " + __WL_pm.selectForUpdate();
    if(__WL_verbose) {
    Debug.say("Finder produced statement string " + __WL_query);
    __WL_stmt = __WL_con.prepareStatement(__WL_query);
    // preparedStatementParamIndex reset.
    __WL_rs = __WL_stmt.executeQuery();
    } catch (java.lang.Exception e) {
    __WL_pm.releaseResources(__WL_con, __WL_stmt, __WL_rs);
    throw new javax.ejb.FinderException(
    "Exception in findByPcPayclass while preparing or executing " +
    "statement: '" + __WL_stmt + "'" + EOL +
    e.toString() + EOL +
    RDBMSUtils.throwable2StackTrace(e));
    The parameter is never set in the prepared statement before it executes.This
    causes the finder to return an empty result set. Is this a bug or is theresome
    configuration that I missed. I am using ant 1.5 to do the ejbc. the anttarget
    follows:
    <target name="ccas.ejbc" depends="ccas.compile, ccas.stage,dd.combine">
    <ejbjar srcdir="${buildClasses}/"
    descriptordir="${buildOutput}/ear_dd"
    basejarname="CCAS"
    flatdestdir="true"
    dependency="full">
    <support dir="${buildClasses}">
    <include name="CCAS/**/*.class"/>
    </support>
    <weblogic destdir="${ear.stage.dir}"
    rebuild="false"
    keepgenerated="true"
    jvmdebuglevel="16">
    <classpath refid="classpath"/>
    <wlclasspath refid="classpath"/>
    </weblogic>
    <include name="ejb-jar.xml"/>
    <exclude name="**/*-weblogic*.xml"/>
    </ejbjar>
    </target>

  • Pooling Prepared Statement and Resultset

    Is their any mechanism in Weblogic by which we can pool prepared statements and
    resultset.

    Yes you can cache prepared statements. The connection pool will
    automatically cache the prepared statements (10 prepared statement was the
    limit in previous so you may want to write some startup class to load the
    imp prepared statements.). When you reuse the prepared statement the
    connection pool will pick it from its prepared statement cache. In 6.1 you
    can configure the number of prepared statements that you want to cache.
    But you cannot have multiple resultsets open for the same statement object.
    You can have cache rows though.
    Please search the bea newsgroups for more info. There are a bunch of posts
    that will be helpful to you.
    http://search.bea.com/weblogic/gonews/
    sree
    "hogan" <[email protected]> wrote in message
    news:3bd9cf88$[email protected]..
    >
    Is their any mechanism in Weblogic by which we can pool preparedstatements and
    resultset.

  • Handling ' and " in a Prepared Statement

    Hi,
    I am using a prepared statement (WebLogic Portal Server having JDBC communication with MS SQL server)
    I HAVE to pass a string like '"*ABC*"'
    i.e. <single quote><double quote>*ABC<double quote><single quote>
    If i hard code this value within the prepared statement it works.
    If i try to pass it as argument it fails.
    In my case the user may submit any string value in the place of ABC
    Kindly advise
    regards
    -Ramudu

    You're probably trying to include the quotes in the prepared statement and pass the ABC as the text to substitute for the question mark. It doesn't really work like that. It's all or nothing. Create your parameter like this:
    public String quoteWrapper(final String unwrappedParameter) {
       return "'\"*"+unwrappedParameter+"*\"'";
    }

  • MS SQL Server 7 - Performance of Prepared Statements and Stored Procedures

    Hello All,
    Our team is currently tuning an application running on WL 5.1 SP 10 with a MS
    SQL Server 7 DB that it accesses via the WebLogic jConnect drivers. The application
    uses Prepared Statements for all types of database operations (selects, updates,
    inserts, etc.) and we have noticed that a great deal of the DB host's resources
    are consumed by the parsing of these statements. Our thought was to convert many
    of these Prepared Statements to Stored Procedures with the idea that the parsing
    overhead would be eliminated. In spite of all this, I have read that because
    of the way that the jConnect drivers are implemented for MS SQL Server, Prepared
    Statments are actually SLOWER than straight SQL because of the way that parameter
    values are converted. Does this also apply to Stored Procedures??? If anyone
    can give me an answer, it would be greatly appreciated.
    Thanks in advance!

    Joseph Weinstein <[email protected]> wrote:
    >
    >
    Matt wrote:
    Hello All,
    Our team is currently tuning an application running on WL 5.1 SP 10with a MS
    SQL Server 7 DB that it accesses via the WebLogic jConnect drivers.The application
    uses Prepared Statements for all types of database operations (selects,updates,
    inserts, etc.) and we have noticed that a great deal of the DB host'sresources
    are consumed by the parsing of these statements. Our thought was toconvert many
    of these Prepared Statements to Stored Procedures with the idea thatthe parsing
    overhead would be eliminated. In spite of all this, I have read thatbecause
    of the way that the jConnect drivers are implemented for MS SQL Server,Prepared
    Statments are actually SLOWER than straight SQL because of the waythat parameter
    values are converted. Does this also apply to Stored Procedures???If anyone
    can give me an answer, it would be greatly appreciated.
    Thanks in advance!Hi. Stored procedures may help, but you can also try MS's new free type-4
    driver,
    which does use DBMS optimizations to make PreparedStatements run faster.
    Joe
    Thanks Joe! I also wanted to know if setting the statement cache (assuming that
    this feature is available in WL 5.1 SP 10) will give a boost for both Prepared Statements
    and stored procs called via Callable Statements. Pretty much all of the Prepared
    Statements that we are replacing are executed from entity bean transactions.
    Thanks again

Maybe you are looking for