Caching PreparedStatements with DB2

I was using Statements, and my DB2 admin says that every call is invoking a prepared statement on the DB side. I learned that PreparedStatements can be cached, so I switched to using that method. However, I see ABSOLUTELY NO database performance increase. Does my DB admin need to turn caching on or do something to allow the code to use caching?

The only place where extended dynamic was mentioned was in the Application Development Guide, and it says this:
DB2 for VSE & VM extended dynamic SQL statements are rejected with -104
and syntax error SQLCODEs.

Similar Messages

  • Caching preparedstatements

    Hi,
    Wondering if there are any restrictions
    when reexecuting PreparedStatements.
    I have a PreparedStatement, which contains
    an anonymous pl/sql block, that I reexecute
    many times. Every once in a while I get
    an 'ORA-01483: invalid length for DATE or NUMBER bind variable' error. I am pretty sure
    the data is right. Also I haven't got this
    error if all the executions are in one
    transaction.
    I am using the 8.0.5 OCI driver.
    The pl/sql block is fairly large with
    about 15-20 inserts, the first couple
    of lines are:
    begin
    insert into Schedule (oid,dte,quantity,ver,createDate,modifyDate) values (?,?,?,?,?,?);
    insert into Chat (oid,accessUserOid,messageArraySIZE,ver,createDate,modifyDate) values (?,?,?,?,?,?);
    end;
    thanks,
    Harish.
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDBC Dev Team:
    Are you binding all the parameters ?
    Yes, before every execution all parameters
    are set.
    Also, try with the latest JDBC client
    drivers ?
    We cann't move to 8i drivers until OAS
    does.
    There is nothing wrong in caching
    prepared statements, but we aware
    that the bind values are going to
    fall-over to the next re-execution.
    Actually, we ourselves are adding
    Statement Caching (caching prepared
    & Callable stmts( in 8.1.7<HR></BLOCKQUOTE>
    Can you provide any information, on
    the performance implications of caching
    PreparedStatements?
    thanks,
    Harish.

  • Fact or Fiction: Caching PreparedStatements implies better performance?

    Hi,
    I've read a number of sources that claim the caching of PreparedStatements
    (on the client) leads to better performance because it eliminates the
    overhead of parsing the statement each time the
    Connection.prepareStatement() method is called. I tend to think that this
    claim is largely database server dependent and to a lesser degree JDBC
    driver dependent and I wonder whether any noticable benefit would be gained
    on databases such as Oracle, SQL Server, or Sybase.
    Oracle already caches SQL statements and associated query plans on the
    server to minimise the amount of parsing. It does this on a server wide
    basis so that ALL connections/sessions can benefit from the previously
    parsed SQL that is being executed. It also does this independent of the
    client technology that is being used (ie. Java, PL/SQL, C++, Perl, etc.) and
    has done so long before the introduction of JDBC. Why the need to cache the
    PreparedStatements on the client if they are already cached more efficiently
    on the server?
    I would be surprised if any parsed representation of the SQL (ie. the query
    plan) existed within the client side at all, as query plans tend to be
    dependent on how the data is stored and indexed, hence closely related to
    the schema (not the client).
    I would be very interested in reading other peoples comments on this and I
    am especially interested in seeing any performance data to prove that
    caching PreparedStatement objects actually does lead to better performance
    and is not just a myth.
    Regards,
    Craig.

    Hi. You are correct that the benefit of a prepared statement cache will vary,
    depending on how the driver and DBMS interact with prepared statements,
    as well as how the application uses pooled connections. In a best case scenario
    where the application has a small set of frequently used statements, to Oracle
    (in spite of the fact that Oracle does some query caching anyway) we have
    seen and customers have reported 10-40% performance improvements.
    Oracle/OCI cursor retention is a possible reason. A worst case scenario
    might be an appliaction that makes lots of unique prepared statements from
    user input in such a way that alters the query plan, using our driver to MS
    SQLServer, a cache would be useless, and might even hurt a little. This is
    because the cache might never contain a statement for the current SQL, and
    searching would slow things down, and our MS driver doesn't implement
    PreparedStatements in a way that has the DBMS caching anything ever, so
    everything is sent for parsing like fresh SQL for every execution. Other
    more recent type-4 JDBC drivers for MS SQLServer do much better
    in this regard, and would play well with a cache.
    Joe Weinstein
    Craig Munday wrote:
    Hi,
    I've read a number of sources that claim the caching of PreparedStatements
    (on the client) leads to better performance because it eliminates the
    overhead of parsing the statement each time the
    Connection.prepareStatement() method is called. I tend to think that this
    claim is largely database server dependent and to a lesser degree JDBC
    driver dependent and I wonder whether any noticable benefit would be gained
    on databases such as Oracle, SQL Server, or Sybase.
    Oracle already caches SQL statements and associated query plans on the
    server to minimise the amount of parsing. It does this on a server wide
    basis so that ALL connections/sessions can benefit from the previously
    parsed SQL that is being executed. It also does this independent of the
    client technology that is being used (ie. Java, PL/SQL, C++, Perl, etc.) and
    has done so long before the introduction of JDBC. Why the need to cache the
    PreparedStatements on the client if they are already cached more efficiently
    on the server?
    I would be surprised if any parsed representation of the SQL (ie. the query
    plan) existed within the client side at all, as query plans tend to be
    dependent on how the data is stored and indexed, hence closely related to
    the schema (not the client).
    I would be very interested in reading other peoples comments on this and I
    am especially interested in seeing any performance data to prove that
    caching PreparedStatement objects actually does lead to better performance
    and is not just a myth.
    Regards,
    Craig.

  • Directory Caching issue with Cisco Jabber client for Windows

    Hi ,
    I am facing cache issue with Cisco Jabber client for Windows. If I do any change related to modification or deletion of contacts in Active Directory/ Callmanager, it does not reflect in the Jabber. Because jabber takes the contacts from the locally stored cache file in the Windows system.
    Every time I have to remove the cache file to overcome this issue, practically it's not possible to do the same with all the Widows users. As, if any employee leaves the company and still I can see his contact appears in the "Cisco Jabber client". I have not seen this issue with Android/Apple iOS.
    Is there any automated way to remove the cache file? 
    Here is the detail of CUCM,Presence and Jabber.
    CUCM version: 9.1.x
    Presence          : 9.1.X
    Jabber              : 10.5 and 10.6

    Hello
    On our environment we had to install a dedicated Microsoft Certificate Authority "just for Cisco Jabber usage" to house the
    Network Device Enrollment Service.
    Our certificate for the CUPS were generated on this Certification Authority too.
    I discussed this certificate matter with my colleagues this afternoon and nobody seems to remember how these certificates were deployed into the
    Enterprise Trust store for the users.
    But I think they asked all 400 users to accept the 3 certificates by answering "yes" to the popup instead of using a script deployed by GPO...
    I wish you success with that deployment and really hope you have a technical partner that *Knows* this subject.
    Our partner left us alone with that unfortunately.
    Florent
    EDIT: If the "Certutil script method" works, please let me know. This could be useful in our own deployment.

  • Can't deploy content.jar on Portal 8.1 SP4 with DB2

    Greetings,
    Have installed WebLogic Portal 8.1 SP4 with DB2 8.1.8. While deplying content.jar which contains BEA's classes relatives to the content management, the following exception is raised:
    <Oct 19, 2005 2:54:32 PM MEST> <Error> <EJB> <BEA-011076> <Unable to deploy the EJB 'ValueBean' because the database table 'CMV_VALUE' is not accessible. Please ensure that this table exists and is accessible.>
    Of course, the CMV_VALUE table exists and it has records inside. Every thing seems to be okay from the point of view of connection pools, data sources and JNDI names. The deployment works properly with Oracle and PointBase.
    The JDBC driver I'm using is com.ibm.db2.jcc.Db2Driver.
    Many thanks in advance for any help.
    Kind regards,
    Nicolas DUMINIL

    Hello,
    More information is required to help you, and as James suggested, the best option would be to move to EclipseLink instead of TopLink Essentials as EclipseLink is actively being developed and is the JPA 2 RI.
    Running it on the latest EclipseLink ensures that you are not hitting an issue that has already been fixed, and both are based off TopLink.
    Are you deploying an Ear or an exploded directory? If the later, can you try using an Ear?
    Best Regards,
    Chris

  • Installation Error of SAP ERP 6.0 SR3 HA MSCS on Win2008 with DB2 9.1

    Hi,
    I am installing ERP 6.0 SR3 HA MSCS on Windows 2008 Ent. Server with DB2 9.1v. In IBM Clustered environment with 2 nodes and a SAN Storage. We are going through the SAP Installation Document.
    1. Here my problem is I am not able to install DB2 with the Domain user. and this domain user having all authorization like (domain admin, domain user, administrators...) whenever I executed this command there is no response from system..
    Drive:\Dump\DB2_LUW_9.1\WINDOWS_AMD64\ESE\image\setup.exe /i en /u Drive:\Dump\DB2_LUW_9.1\WINDOWS_AMD64\ESE\win_ese.rsp /p c:\db2\db2<SID>\db2_software /m
    But the same command I executed in the Local administrator user it is installed successfully.
    2. After this I executed this command db2icrtdummy in the Local Administrator, the command was successful then I executed next command
    C:\Users\Administrator>db2extsec -a BRPLIND\DB2ADMNS_prd -u BRPLIND\DB2USERS
    DB2EXTSEC: Logon failure: unknown user name or bad password.
    So I logged out from administrator and logged in with domain user
    and executed same command but it given following error
    C:\db2\db2prd\db2_software\BIN>db2icrt dummy
    DBI1918N An error occurred when accessing the Windows NT
              registry.
    Explanation:
    DB2 encountered an error when attempting to read or update the
    Windows NT registry of the target machine.
    User Response:
    Ensure that the current logon user account has sufficient
    authority to access the Windows NT registry of the target
    machine.  If the problem persists, contact your IBM service
    representative for assistance.
    so am I going in the correct way or doing any mistake.? from here I am not able to go ahead
    Please suggest me to clear this issue.
    Thanks
    Uday

    Hi,
    I am installing ERP 6.0 SR3 HA MSCS on Windows 2008 Ent. Server with DB2 9.1v. In IBM Clustered environment with 2 nodes and a SAN Storage. We are going through the SAP Installation Document.
    1. Here my problem is I am not able to install DB2 with the Domain user. and this domain user having all authorization like (domain admin, domain user, administrators...) whenever I executed this command there is no response from system..
    Drive:\Dump\DB2_LUW_9.1\WINDOWS_AMD64\ESE\image\setup.exe /i en /u Drive:\Dump\DB2_LUW_9.1\WINDOWS_AMD64\ESE\win_ese.rsp /p c:\db2\db2<SID>\db2_software /m
    But the same command I executed in the Local administrator user it is installed successfully.
    2. After this I executed this command db2icrtdummy in the Local Administrator, the command was successful then I executed next command
    C:\Users\Administrator>db2extsec -a BRPLIND\DB2ADMNS_prd -u BRPLIND\DB2USERS
    DB2EXTSEC: Logon failure: unknown user name or bad password.
    So I logged out from administrator and logged in with domain user
    and executed same command but it given following error
    C:\db2\db2prd\db2_software\BIN>db2icrt dummy
    DBI1918N An error occurred when accessing the Windows NT
              registry.
    Explanation:
    DB2 encountered an error when attempting to read or update the
    Windows NT registry of the target machine.
    User Response:
    Ensure that the current logon user account has sufficient
    authority to access the Windows NT registry of the target
    machine.  If the problem persists, contact your IBM service
    representative for assistance.
    so am I going in the correct way or doing any mistake.? from here I am not able to go ahead
    Please suggest me to clear this issue.
    Thanks
    Uday

  • Error in installing MySap 2004s SR1 with DB2 and IBM AIX.

    Hello Gurus,
    I am installing MySap 2004s SR1 with DB2 and IBM AIX.
    I am facing the following error :
    <b><i>ERROR 2006-11-08 18:33:01
    MDB-01101  Installed Software Level '08.02.0002' is insufficient for this installation ...</i></b>
    <b><i>ERROR 2006-11-08 18:33:01
    MUT-03025  Caught ESAPinstException in Modulecall: ESAPinstException: error text undefined.
    ERROR 2006-11-08 18:33:01
    FCO-00011  The step DB6CheckSoftwareLevel with step key |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|1|0|NW_GetSidNoProfiles|ind|ind|ind|ind|1|0|NW_getDBInfo|ind|ind|ind|ind|2|0|NW_DB6_Initialize_Db_Software_Info|ind|ind|ind|ind|3|0|DB6CheckSoftwareLevel was executed with status ERROR .</i></b>
    As this occered in the phase "Install JCE Policy".
    I have even tried to get the latest version But I am not succesfull.
    Please help.
    Regards,
    Chandra Sekhar Reddy.

    Dear Dirk,
    Thanks once again I have installed FP12 and the error is gone.
    But here I have one more error triggered, Here I am pasting the log.
    Please help me.
    <i><b>ERROR 2006-11-08 22:02:36
    FSH-00006  Return value of function getgrnam(dbdevmnt) is The process does not exist..
    ERROR 2006-11-08 22:02:36
    MUT-03025  Caught ESyException in Modulecall: ESAPinstException: error text undefined.
    ERROR 2006-11-08 22:02:36
    FCO-00011  The step createAccounts with step key |NW_Onehost|ind|ind|ind|ind|0|0|NW_Onehost_System|ind|ind|ind|ind|1|0|NW_Users_Create_Do|ind|ind|ind|ind|4|0|createAccounts was executed with status ERROR .</b></i>
    Please help me out.
    Thanks,
    Chandra Sekhar Reddy.

  • SAP ECC 6.0 installation in windows 2008 clustering with db2 ERROR DB21524E

    Dear Sir.,
    Am installing sap ECC 6.0 on windows 2008 clustering with db2.
    I got one error in the phase of Configure the database for mscs. The error is  DB21524E 'FAILED TO CREATE THE RESOURCE DB2 IP PRD' THE CLUSTER NETWORK WAS NOT FOUND .
    DB2_INSTANCE=DB2PRD
    DB2_LOGON_USERNAME=iil\db2prd
    DB2_LOGON_PASSWORD=XXXX
    CLUSTER_NAME=mscs
    GROUP_NAME=DB2 PRD Group
    DB2_NODE=0
    IP_NAME = DB2 IP PRD
    IP_ADDRESS=192.168.16.27
    IP_SUBNET=255.255.0.0
    IP_NETWORK=public
    NETNAME_NAME=DB2 NetName PRD
    NETNAME_VALUE=dbgrp
    NETNAME_DEPENDENCY=DB2 IP PRD
    DISK_NAME=Disk M::
    TARGET_DRVMAP_DISK=Disk M
    Best regards.,
    please help me since am already running late with this installation to run the db2mscs utility to Create resource.
    Best regards.,
    Manjunath G
    Edited by: Manjug77 on Oct 29, 2009 2:45 PM

    Hello Manjunath.
    This looks like a configuration problem.
    Please check if IP_NETWORK is set to the name of your network adapter and
    if your IP_ADDRESS and IP_SUBNET are set to the correct values.
    Note:
    - IP_ADDRESS is a new IP address that is not used by any machine in the network.
    - IP_NETWORK is optional
    If you still get the same error debug your db2mscs.exe-call:
    See the answer from  Adam Wilson:
    Can you run the following and check the output:
    db2mscs -f <path>\db2mscs.cfg -d <path>\debug.txt
    I suspect you may see the following error in the debug.txt:
    Create_IP_Resource fnc_errcode 5045
    If you see the fnc_errcode 5045
    In that case, error 5045 which is a windows error, means
    ERROR_CLUSTER_NETWORK_NOT_FOUND. This error is occuring because windows
    couldn't find the "public network" as indicated by IP_NETWORK.
    Windows couldn't find the MSCS network called "public network". The
    IP_NETWORK parameter must be set to an MSCS Network., so running the
    Cluster Admin GUI and expanding the Cluster Configuration->Network to
    view all MSCS networks that were available and if "public network" was
    one of them.
    However, the parameter IP_NETWORK is optional and you could be commented
    out. In that case the first MSCS network detected by the system was used.
    Best regards,
    Hinnerk Gildhoff

  • SAP ECC 6.0 SR3 Cluster failover not working in AIX with DB2 UDB V9.1 FP6

    Hi Gurus,
    We have installed the SAP ECC 6.0 SR3 High Availability  with DB2 UDB V9.1 FP6 in AIX cluster environment.
    After installation we are doing the cluster fail test.
    Node A
    Application Server
    Mount Points:
    /sapmnt/<SID>
    /usr/sap/<SID>
    /usr/sap/trans
    Node B
    Database Server
    Mount Points:
    /db2//<SID>
    The procedure followed to do the cluster failover:
    We have down the cluster on Node A and all the resources of the Node A has been moved to Node B.
    On Node B when we issued a command to start the SAP. It says u201Cno start profiles foundu201D
    WE have down the cluster on Node B and  moved the Resource from Node B to Node A .  There the db2 User IDu2019s are not available. We have crated the user Idu2019s manually on Node A. however it did not work.
    Please suggest the procedure to start the sap in cluster failover.
    Best Regards
    Sija

    Hi Sija,
    Can i have detailed scenario in your cluster configuration.
    Means you are saying that going to start cluster package manually, if it is right please make sure that you had the same copy of start, instance profiles of NodeA to Node B. Means you need to maintain two startup, two instance profiles for both nodes. In a normal situation it will picik the profile of node A to start databse from A node. But in a failover situation it will not pick node A profile to start, it should pick Node B s profiles.
    Just make a copy from node A and change the profile name accordingly to Node b. Then try to restart.
    Regards
    Nick Loy

  • ECC 6.0 installed in win 2008 server with db2 9

    Dear all.,
    I have newly installed sap erp ecc 6.0 in win 2008 server with db2.The installation is successfully finished and system is up and running.
    But the issue is i could not find anything in the control centre to take backup and to do other activities.
    I tried to add the system in control centre and i tried to run with DB2admin create command.
    Please anybody let me know how to get all the systems and all database in control centre in db2.
    ERROR returned SQL0104N
    best regards.,
    Manjunath G

    db2admin create command is for creating the DAS, I guess no need of it here
    http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/t0004960.htm
    On Windows server, start -> run -> db2cmd -> enter
    Does it open db2cmd prompt ?
    If yes, check these and paste the output here in forum
    echo %DB2INSTANCE%
    db2ilist
    db2 list db directory
    'I tried to add the system in control centre'
    Ok, I guess you are trying to add the instance. Try the following link for 'Listing available instances' and 'adding additional instances'
    http://books.google.co.in/books?id=YiO2oUNtXLQC&pg=PA118&lpg=PA118&dq=db2Listingtheinstancesinyoursystem&source=bl&ots=nvegXvy8du&sig=tnac90moH8XIpMOwiOC2RUx68K8&hl=en&ei=v1zHSvuSBY7o6gP2grGnDQ&sa=X&oi=book_result&ct=result&resnum=1#v=onepage&q=db2%20Listing%20the%20instances%20in%20your%20system&f=false

  • SAP ECC 6.0 SR3 Cluster failover not working in windows with DB2 UDB V9.1 F

    Dear Expertise,
    We have installed the SAP ECC 6.0 SR3 High Availability with DB2 UDB V9.1 FP5 in windows cluster environment.
    We have installation following instances on nodes 1 and 2.
    Node 1                                                                               
    DB2 database software                                                                       
    Central service instance for ABAP Installation on Shared drive G:          
    First MCSC node to create a cluster group u201Cpdssapgrpu201D                            
    Database group u201Cpgsdbgrpu201D(Shared Drive)                                                  
    Enqueue replication service                                                                  
    CI (central instance)(local Drive)
    Node 2
    DB2 database software
    Additional cluster node
    Enqueue replication service
    DI(dialog instance)(local Drive)
    I can login into the system using both CI and DI.
    if my SAP Cluster group is moved from one node to another i can still login into the system
    But when my DB2 group is moved from node A to node B my SAP services are getting closed
    and i am getting the message database not found
    so please Guide me as soon as possible Friends.
    Thanks and Regards,
    Ravindra
    Edited by: Ravindra Bade on Mar 6, 2009 10:22 AM

    Hi Ravidra
    Have u solved the probelm I also have the same problem when i move the groups from node1 to node2 manually my 2 servrces 00 and 01 are failed not able to bring up again. If You solve the problem please guide me the solution to solve this.
    THanks in advance

  • Java connectivity with db2 in linux

    hi all,
    i wish to know how to connect java with db2 in linux.actually which is the string that is to be included in the following:
    class.forName("//which is the string that is to be included here");
    Connection con("jdbc:????");

    hi all,
    i wish to know how to connect java with db2same as every other database and OS. JDBC is the way.
    in linux.actually which is the string that is to be
    included in the following:
    lass.forName("//which is the string that is to be
    included here");full name of the DB2 JDBD driver class.
    Connection con("jdbc:????");look at the docs for your JDBC driver to figure out what the URL needs to be.
    %

  • Authorizations for user db2 sid after systemcopy  with DB2 V9.7 on AIX

    Hello,
    I made a homogenous systemcopy from the system PRD to ENT with an redirected restore. I had the following system environment:
    AIX 5.3 TL10 SP1
    DB2 V9.7 (without any fixpack)
    After the restore and the recovery were finished, I was able to start the database manager and to activate the database.
    I tried to execute a script for cleanup some tables according to the systemcopy guide but I got the following SQL messages:
    SQL0551N, SQL0552N for the user db2ent. I checked the authorization for this user and got the following information:
    db2 => get authorizations
    Administrative Authorizations for Current User
    Direct SYSADM authority                    = NO
    Direct SYSCTRL authority                   = NO
    Direct SYSMAINT authority                  = NO
    Direct DBADM authority                     = NO
    Direct CREATETAB authority                 = NO
    Direct BINDADD authority                   = NO
    Direct CONNECT authority                   = NO
    Direct CREATE_NOT_FENC authority           = NO
    Direct IMPLICIT_SCHEMA authority           = NO
    Direct LOAD authority                      = NO
    Direct QUIESCE_CONNECT authority           = NO
    Direct CREATE_EXTERNAL_ROUTINE authority   = NO
    Direct SYSMON authority                    = NO
    Indirect SYSADM authority                  = YES
    Indirect SYSCTRL authority                 = NO
    Indirect SYSMAINT authority                = NO
    Indirect DBADM authority                   = NO
    Indirect CREATETAB authority               = NO
    Indirect BINDADD authority                 = NO
    Indirect CONNECT authority                 = NO
    Indirect CREATE_NOT_FENC authority         = NO
    Indirect IMPLICIT_SCHEMA authority         = NO
    Indirect LOAD authority                    = NO
    Indirect QUIESCE_CONNECT authority         = NO
    Indirect CREATE_EXTERNAL_ROUTINE authority = NO
    Indirect SYSMON authority                  = NO
    db2 =>
    The user db2ent was/is in the group dbentadm and the group dbentadm is configured as SYSADM:
    SYSADM group name                        (SYSADM_GROUP) = DBENTADM
    SYSCTRL group name                      (SYSCTRL_GROUP) = DBENTCTL
    SYSMAINT group name                    (SYSMAINT_GROUP) = DBENTMNT
    The only solution was to grant the authorizations with an other user to db2ent.
    For the restore I created an new instance with the following command (as user root):
    /db2/ENT/db2_software/instance/db2icrt -a SERVER_ENCRYPT -s ESE -u db2ent db2ent
    I set the correct DBM configuration and created an empty database as user db2ent with the following command
    db2 create db ENT on /db2/ENT
    The restore was executed with db2 -tvf restore_prd.clp as user db2ent.
    Is there a bug in the db2 software or is there any other solution? I did not changed the environment for the user db2ent.
    The authorization concept has been changed in DB2 V9.7
    http://www-01.ibm.com/support/docview.wss?uid=swg21385801
    Kind regards,
    Christian

    Hello All,
    I finished restore using redirect method, but i did not know about this security issue.
    Now I tried creating db2<oldsid> user and tried granting dbadm secadm priv.
    but i get this error
    db2 => GRANT DBADM to USER DB2P60
    DB21034E  The command was processed as an SQL statement because it was not a
    valid Command Line Processor command.  During SQL processing it returned:
    SQL0707N  The name "DBADM" cannot be used because the specified identifier is
    reserved for system use.  SQLSTATE=42939
    Please help me.
    I need a solution at the earliest possible.
    Thanks,
    Sree

  • Preparedstatement with multiple parameters on joined tables w/ (AND,OR)??

    Ihave a Query that reads a list of materials (1 to many) and a string of delimited numbers. I am currently going through a couple of loops to build my Query string. For example:
    WHERE (materials.material = '?' OR materials.material = '?' )........ AND (materials.ONE = '?' "; OR materials.ONE = '?' "; )........
    It also involves reading data from two tables: See Query String below:
    Query = "Select transactions.control,transactions.date_sent, transactions.date_received, transactions.sender,transactions.recipient,materials.control,materials.material,materials.R,materials.ONE,materials.parent_item,materials.sub_ctrl,materials.quanity FROM transactions LEFT JOIN materials ON transactions.control = materials.control WHERE (LOOP) materials.material = '?' AND (LOOP)materials.ONE = '?' ";
    Is it possible to use a preparedstatement with parameters when the number of parameters is unknown until the user selects them?

    Is it possible to use a preparedstatement withparameters when the number of parameters is unknown
    until the user selects them?
    masuda1967 is being too Japanese. The answer to your
    question is "No".Actually, I would take masuda-san's suggestion--sort of.
    You can do the incremental query construction he suggested, but with prepared statements. Something like this. (Note: Probably doesn't match your code exactly, but you should get the idea.)StringBuffer query = new StringBuffer("select ... whatever ...");
    for (int ix = 0; ix < numParams; ix++) {
        if (x > 0) {
            query.append(", ")
        query.append(" ? ");
    ps = con.prepareStatement(query.toString());
    for (int ix = 0; ix < numParams; ix++) {
        set the param
    } You won't get the performance benefit that can come from using PreparedStatement, but you still avoid the headache of escaping strings, formatting dates, etc.
    &#12472;

  • How to set up Tomcat4.1.24 datasource with DB2?

    Hi, Guys:
    I try to set up datasource with DB2. I got a sample, but
    I do not know exactly what some tags mean. Could anyone
    who did this show me an example? Thanks a million!
    For example, what is path? what is docBase? In
    <Resource name="jdbc/DefaultDS", what is jdbc/DefaultDS?
    I am using a servlet to call other java classes which
    access database. How do I specify these in Tomcat?
    server.xml:
    <Context path="/test" docBase="test" debug="0"
    reloadable="false" override="true">
    <Resource name="jdbc/DefaultDS" auth="Container"
    type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/DefaultDS">
    <parameter><name>user</name><value>scott</value></parameter>
    <parameter><name>password</name><value>tiger</value></parameter>
    <parameter><name>driverClassName</name>
    <value>oracle.jdbc.driver.OracleDriver</value></parameter>
    <parameter>
    <name>driverName</name>
    <value>jdbc:oracle:thin:@<YOUR HOST NAME>:1521:<YOUR DB NAME></value>
    </parameter>
    <parameter>
         <name>maxActive</name>
         <value>8</value>
    </parameter>
    <parameter>
         <name>maxIdle</name>
         <value>4</value>
    </parameter>
    </ResourceParams>
    </Context>
    web.xml:
    <resource-ref>
    <res-ref-name>jdbc/DefaultDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>

    Dear Rick,
    The answers to all of your questions are on this page:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/index.html
    Enjoy.
    Kind regards,
    Allan

Maybe you are looking for

  • Error in starting Oracle 9.2.01 on Redhat 9

    Hi, I am a novice in linux. When I tre to start Oracle Instance from terminal window when logged in as Oracle user, I get the following message. [oracle@linserver oracle]$ dbstart Can't find init file for Database "SecondDB". Database "SecondDB" NOT

  • Installing 11.2.0 Client on Redhat

    Hi! The following message appears when running the Oracle 11.2.0 Client, 32-Bit (Administrator version) installer on Redhat Enterprise Edition (64-Bit) as Oracle user. Exception in thread "main" java.lang.NoClassDefFoundError         at java.lang.Cla

  • ABAP : string take 8 charatcers

    Hi Experts , I need your help. Actually i have started working in ABAP as welll. need to know that below is the coding being done for Screen Painter and need your help  in troubleshooting error. the Error is : "Program ZSCREENPAINTER1 "TYPE LINE" or

  • When does a mountet network drive goes from green to red in colour due to low disk space?

    Hi, I have a number of network shares on MS 2008 R2 servers, that my users have mountet on their Win7 PC's. What is the limit for when a mountet network drive goes from green to red on the users PC, due to low disk space. My guess is below 10% but I

  • Any suggestions on extending operational/processing metadata for DI

    Although the DI Mgt Console has some nifty looking graphics it is a little light on providing the production or operational detail some of my clients need to check. Having a dashboard and exception reporting for regularly scheduled production is a gr