Statements in Connection Object

Hi All,
I am using Oracle 8i as my database and JDBC 2.0 for connecting my Java program to Oracle.
I know that from single connection object I can create multiple statements and execute them. But can any one say me what is the maximum no. of statements which can be created from a single connection object? Or is there no limit on that?
..Raj

Only limited by your memory, no theoritical limit

Similar Messages

  • Trying to close Statement from its Connection object

    Hi, I am having difficulty finding information regarding how to find and kill a Statement for a given Connection. Unfortunately I do not have direct access to the Statement as the Connection object has been handed off and used externally.
    What I am doing is playing around with a connection pool and the effort to replace it with another at this point is not feasible, so basically what I am attempting to do is forcefully release a Connection after a specified timeout period but am finding that the Statement that it is running still persists. Waht I need to know is how I would be able to track down the Statement and .close() it as there does not seem to be any obvious way using the Connection object alone. Any ideas?
    Any help or suggestion about how to address this issue would be appreciated.

    Wrap the connection before handing it off to external code. Your wrapper will be responsible for tracking statement instances.

  • Error_27_Error occurred in deployment step 'Activate Features': Operation is not valid due to the current state of the object.

    I created a SharePoint 2013 farm solution project in Visual Studio 2013 (running on the same machine where SharePoint 2013 server is running) with
    event receiver.  I added web.config at project root level to store connection string (I'm working off external SQL DB) and got the following error during deployement:
    Error 27
    Error occurred in deployment step 'Activate Features': Operation is not valid due to the current state of the object.
    When I commented out the ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString; the error went away.  Am I missing something or not supposed to add my own App.config to SharePoint project solution? 

    Hi,
    From your description, you might want to store your connection string in web.config and there is an error during deployment.
    It is recommended to store the configuration data of SharePoint solution in either property bags or hierarchical object store.
    The links below will provide more information about this:
    http://blogs.msdn.com/b/zwsong/archive/2012/03/27/where-should-you-store-your-sharepoint-solution-s-configuration-data.aspx
    http://msdn.microsoft.com/en-us/library/ff647766.aspx
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they
    help and unmark them if they provide no help. If you have feedback for TechNet
    Subscriber Support, contact [email protected]
    Patrick Liang
    TechNet Community Support

  • Advantages of connection object

    Could someone explain the advantages or rather difference in passing the Connection object from a JSP to a servlet instead of creating one (and returning to the pool) in the servlet itself?
    Thanking you

    Do you mean the advantage of holding onto a connection over multiple requests versus making a new one each request?
    There it usually comes down to 2 things:
    1) Faster response time if new connections don't have to be made, or you don't have to wait for another connection to be freed for the pool
    2) Probably more importantly you can maintain multi-request transactions. If you have a transaction with the DB that may take several steps of user interaction, if you maintain the same connection then if you need to you can roll back all the changes (cancel) that the user made. If you make/get new connections each time then it is harder to roll back and you could leave the DB in an unwanted state.
    If you mean in the same request... then I don't know - other than it is easier to handle all the exceptions in a servlet then in a JSP (nature of working with Java code directly)

  • Connection object is getting closed before the stored procedure is complete

    Hi Everyone,
    I am facing an issue where by the java connection object is closed before the stored procedure it is connected to is complete.
    I am not sure if the fault is in SP or Connection pool.
    After spending some time, i could able to figure out that the procedure is taking a tad more time for processing as there are over 1000 records in the database tables it is dealing with.
    Would that be a potential cause ? or Am i required to handle it in Java only ?
    I want to know what could be possible causes for this issue ?
    Please Help.
    FYI,
    The following are the logs which says,
    XYZ (Stored Procedure) : Start Time is 1349217771302 Procedure started here
    INFO >2012-10-02 18:43:09,935 [ConnectionPool]: Closing connection: DataSource [ABC](684)
    INFO >2012-10-02 18:46:03,512 DAO[main]: XYZ : End Time is 1349217963512 Procedure ended here
    Thanks in Advance.

    Hi ,
    Thank you all for your quick response.
    Well it's my bad i dint provide you any code to look into thinking that i am dealt with a gen issue and also i am too paranoid to post any code i am dealing with in the forum (i am sorry).
    But here is some information for you,
    Database : Oracle 10g
    Java: 1.5 version
    We are using only One connection object for the entire java backend process .
    The SP is of over 1000 lines of code which for obvious reasons i can't past it here but this morning i figured out an issue in SP where by a query taking way more than usual time to execute which led to SP's poor performance and also the reason for why it is taking very long time than usual.
    This query is a simple SELECT query where it is trying fetch over 2000 records from a table of over 3 million records. The execution time is over 30-40 seconds which is the root cause of SP's poor performance.
    When i eliminated this from the logic and ran the query it could able process (inserting huge volume around 5000 records of data) in 1 second instead of 3-4 minutes earlier.
    I tried to replicate this issue (which occurred in our production server) in my local system but no luck as there was no connection issue here but only the substantial time difference.
    We are using a customized connection pool which is as follows,
    I am not sure what's going on here because it seems to be greek and latin to me.
    What we are doing in our DAO is we are using method of the below ConnectionPool.getInstance(SCHEMA) to get the connection object.
    Looking forward to seeking advice from you on how connection pool in general works.
    public class ConnectionPool extends Thread
         private static final ConnectionPool me = new ConnectionPool();
         private Hashtable dataSources = new Hashtable();
         private static final int MIN_TIMEOUT = 0;
         private long timeOut;
         private Hashtable cons = new Hashtable();
         private Hashtable active = new Hashtable();
        private boolean trace = false;
         private ConnectionPool()
              registerDataSources();
              this.timeOut = PropertyManager.getIntProperty("connectionPool.timeOut", MIN_TIMEOUT);
              setName("ConnectionPool");
              setPriority(MIN_PRIORITY);
              if (timeOut > 0)
                   start();
         private void registerDataSources()
            dataSources.clear();
              Properties props = System.getProperties();
              String app = props.getProperty("X", "Y");
              for(Enumeration e = props.keys(); e.hasMoreElements();)
                   String key = (String) e.nextElement();
                   if (key.startsWith(app + ".connectionPool.dataSources.") && key.endsWith(".selector"))
                        String ds = key.substring((app + ".connectionPool.dataSources.").length(), key.length() - ".selector".length());
                        LogManager.logStatus("Registering [" + ds + "] (selector) " +
                                  props.getProperty(app + ".connectionPool.dataSources." + ds + ".selector"));
                        dataSources.put(ds,
                             new GenDataSource(
                                  ds,
                                  props.getProperty(app + ".connectionPool.dataSources." + ds + ".selector")));
                        continue;                    
                   if (!key.startsWith(app + ".connectionPool.dataSources.") || !key.endsWith(".server"))
                        continue;
                   String ds = key.substring((app + ".connectionPool.dataSources.").length(), key.length() - ".server".length());
                   try
                        LogManager.logStatus("Registering [" + ds + "] " +
                                  props.getProperty(app + ".connectionPool.dataSources." + ds + ".url"));
                        loadDriver(props.getProperty(app + ".connectionPool.dataSources." + ds + ".driver"));
                   catch (Exception se)
                        LogManager.logException(se);
                   GenDataSource genDataSource = new GenDataSource(
                             ds,
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".useMatrix", "false").equals("true"),
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".server"),
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".url"),
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".user"),
                             props.getProperty(app + ".connectionPool.dataSources." + ds + ".password"));
                   // Set the schema if schema is defined in settings.xml file
                   if (genDataSource != null && props.getProperty(app + ".connectionPool.dataSources." + ds + ".schema") != null ) {
                        genDataSource.setSchema(props.getProperty(app + ".connectionPool.dataSources." + ds + ".schema"));
                   dataSources.put(ds, genDataSource);
         public static Connection getConnection(String dataSource) throws SQLException
              GenDataSource ds = (GenDataSource) me.dataSources.get(dataSource);
              if (me.timeOut <= 0)
                   if (ds.getSchema() != null )
                        return updateSchema ( ds);
                   else
                        return DriverManager.getConnection(ds.url(), ds.user(), ds.password());
              String key = dataSource;
              Stack free;
              GenPooledConnection pc = null;
              synchronized (me)
                   if ((free = (Stack) me.cons.get(key)) == null)
                        free = new Stack();
                        me.cons.put(key, free);
                   if (!free.empty())
                        pc = (GenPooledConnection) free.pop();
                   if (pc == null)
                        if (ds.getSchema() != null )
                             pc = new GenPooledConnection("DataSource [" + key + "]",
                                                 updateSchema ( ds), free, me.active, me.timeOut, me.trace);
                        else
                             pc = new GenPooledConnection("DataSource [" + key + "]",
                                       DriverManager.getConnection(ds.url(), ds.user(), ds.password()), free, me.active, me.timeOut, me.trace);
                   else
                        pc.touch();
              LogManager.logStatus("Using " + pc);
              me.active.put(pc.id(), pc);
              return pc;
         public void run()
              for(;;)
                   try
                        sleep(60 * 1000);
                        synchronized (me) {
                             for(Enumeration e = cons.elements(); e.hasMoreElements();)
                                  Stack stack = (Stack) e.nextElement();
                                  for (int i = stack.size()-1; i >= 0; i--)
                                       GenPooledConnection pc = (GenPooledConnection) stack.elementAt(i);
                                       if (pc.isExpired())
                                            stack.removeElementAt(i);
                   catch (Exception e)
                        GenUtil.reportException(e);
         private static Connection updateSchema ( GenDataSource ds) throws SQLException {
              Connection con = DriverManager.getConnection(ds.url(), ds.user(), ds.password());
              if (ds.getSchema() != null ) {
                   String sql = "SET SCHEMA  " + ds.getSchema()+ ";";
                   LogManager.logDebugMessage("updating the Schema with sql statement " + sql);
                   PreparedStatement ps = con.prepareStatement(sql);
                   ps.execute();
                   ps.close();
              return con;
    }Thanks.
    Edited by: EJP on 5/10/2012 14:09: added {noformat}{noformat} tags. Please use them.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Connection object creation

    Hello
    We are developing a website using the java technologies.
    We are not using the connection pooling for connecting to the database. We use a static connection object and calling it in all the pages.
    Is there any other good method for connecting to a database?

    Writing to memory purpose is storing memory
    Static connection should not use for data entry operation (if there is any common insert, update or delete statement exists). If any one of the client gives a commit cases all the database entries of the particular connection will be committed. In the case of display purpose static connection will not cause any problem.
    If u r requirement is for data entry then try to use one method.. Whenever user logged in create a unique id and create a connection for this particular user. Then store this connection as well as id in a static hashmap in servlet. This id should be attach in all the further requests for retrieving the connection..
    If anymore clarification needed
    Mail me
    [email protected]

  • CONNECTION OBJECT NOT REPLICATING IN IsU

    Hello experts ,
    i have problem regarding creation of techincal data ,
    when i am creating connection object in crm web ui ,data is getting saved in crm , but it is not fetting replicated into isu .
    althoug the bdoc are in green state .
    awaiitng your valuable suggestion
    regards
    hemsap

    Have you created the MDT?
    If no Please create the MDT with category CRMTECHCONNOBJ  for connection object
    Regards,
    Siva

  • Connection object in one method not accessible to another method

    Hi ,
    I have a method init() which contains the following:
    PropagatedDatabaseTransactionService.getInstance().getPropagatedDatabaseTransaction().begin();
              java.sql.Connection connection = PropagatedDatabaseTransactionService.getInstance().getPropagatedDatabaseTransaction().getConnection();
    try {
    Statement stmt = connection.createStatement() ;
    and so on
    I have 2 other methods in which i wish to use the "connection" object and also "stmt". I dont think I can place the connection code outside a method (also it throws an exception).
    How do i change the code so that the other 2 methods can also access the connection to the database?
    Thanks

    Either pass them as parameters or make them into member variables.

  • Dump Error in ES55 Connection Object

    Dear Experts,
    I am getting the error when I am saving the connection object.
    Error in the ABAP Application Program
    The current ABAP program "CL_EEWA_RFC_CONTAINER_LOCATIONCP" had to betTerminated. because it has come across a statement that unfortunately cannot be executed.
    The following syntax error occurred in program
    "CL_EEWA_RCI_COMMON============CP " in include
    "CL_EEWA_RCI_COMMON============CM003 " in line 145:
    "The data object "LS_EQUI" does not have a component called "LOGIKNR_WA"
    It seems, I am missing some config settings.
    Please help me to close this issue.
    Thanks
    Aswin

    Hi Aswin
    The problem is not caused by the number ranges, but an inconsistency between the Data Dictionary and the code.
    The code for method GET_SERVLOC_BY_CONTAINER of class CL_EEWA_RCI_COMMON (in the shortdump as CL_EEWA_RCI_COMMON============CM003), selects information from view V_EQUI_WASTE and tries to populate an internal structure using the fieldname LOGIKNR_WA of the view.
    Please check the view V_EQUI_WASTE contains an append called EEWA_EQUI_WASTE (transaction SE11, the append should be at the bottom of tab "View Flds." (probably not). Afterwards check if append view EEWA_EQUI_WASTE exists (again use transaction SE11).
    If EEWA_EQUI_WASTE is missing altogether or if the view V_EQUI_WASTE doesn't contain the APPEND, there was a problem with the SAP installation or an upgrade. Please check with Basis and SAP to get this fixed.
    Are you by any chance using waste management? Or are you a stock standard power company?
    I wouldn't expect this code to be called, when you don't use waste management, so there might be some customising someone (ab)used: IMG: SAP Utilities: Waste Management.
    Yep
    Jürgen

  • Obteain connection object from application module

    Hello
    I am working with ADF 10g using BC4j , I am in application module implementation class, how can I obtain the java.sql.connection object used by my application module?

    to execute prepared statements follow
    http://download-uk.oracle.com/docs/html/B25947_01/bcadvgen005.htm#sm0297
    to access the SQL connection itself (for whatever reason)
    Re: how to get connection from adf bc?
    Frank

  • Access to java.sql.Connection objects

    Hi,
    The Kodo JDO developers guide states 2 methods to obtain a Connection
    object for the database.
    The first method makes use of a function getStoreManager(), which
    doesn't seem to exist anywhere and which is certainly not mentioned
    anywhere in the documentation.
    The second method makes use of a class DataSource, which also does not
    exist anywhere. I am aware that this class is present in JDK1.4 but we
    are using 1.3 and it states Kodo works on this version.
    Can anybody please clarify how I obtain a connection using these two
    methods?
    Lars

    On 7/1/02 9:15 AM, "Lars" <[email protected]> wrote:
    Hi,
    The Kodo JDO developers guide states 2 methods to obtain a Connection
    object for the database.
    The first method makes use of a function getStoreManager(), which
    doesn't seem to exist anywhere and which is certainly not mentioned
    anywhere in the documentation.getStoreManager() is a Kodo-specific method in
    com.solarmetric.kodo.runtime.PersistenceManagerImpl. The JavaDoc for this
    class is not available in Kodo JDO 2.2.x; it is available in Kodo JDO 2.3.0.
    The second method makes use of a class DataSource, which also does not
    exist anywhere. I am aware that this class is present in JDK1.4 but we
    are using 1.3 and it states Kodo works on this version.DataSource is part of the Java SQL standard extensions, in javax.sql. See
    http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/sql/DataSource.html for
    more documentation on it.
    Note that we do not require that you use a JDBC 2.0 driver (one that
    supports javax.sql). We provide our own implementation of DataSource that is
    used whenever a connection URL is specified. If you want to use your own
    connection pooling etc. with a JDBC 1.0 driver, then you will have to
    implement the DataSource interface on your own; we assume that the
    ConnectionFactory object implements the DataSource interface.
    -Patrick
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • How to store Connection object and call it from other programs.

    Hi,
    I am trying to connect to the database, store the connection object and use this connection object from other standalone java programs.
    Can any one tell me how to do this? I've tried in the following way:
    In the following program I am connecting to the database and saving the connection object in a variable.
    public class GetKT2Connection {
       public static void main(String[] args) {
          String url = "jdbc:odbc:SQLDsn;
          String dbUser = "sa";
          String dbPwd = "sa";
          Connection kt2conn = Connection connection = java.sql.DriverManager.getConnection(url, dbUser, dbPwd);
          if(kt2conn == null) {
             System.out.println("Database Connection Failure!");
          else {
             System.out.println("Connected to Database...");
         GetKTConnectionObj.storeKT2ConnectionObj(kt2conn);
    } Here is the program to save connection object in a variable.
    public class GetKTConnectionObj {
       static Connection kt2Connection = null;
       public static void storeKT2ConnectionObj(Connection conn) {
       kt2Connection = conn;
       public static Connection getKT2ConnectionObj() {
       try {
          return kt2Connection;
       catch(Exception e){
          System.out.println(e);
      return null;
    }Now from the following code I am trying to get the connection object that is stored. But this is throwing NullPointerException.
    public class Metrics_Migration {
      public static void main(String args[]) {
         try {
        java.sql.Connection connection_1 =   GetKTConnectionObj.getKT6ConnectionObj();
         catch(Exception e){
    }

    kt2Connection is null. You need to store it first, to make it not null. Otherwise it will stay null forever. And why on earth are you trying to do this THIS way?
    If you are running the two applications separately, it wont work either.

  • Error in creating connection object

    Dear Experts
    When I am creating connection object using ES55 , I get Stop message saying : " Alternate ID not supported" and when i see Help it indicates : An alternative indicator is active in Customizing of the functional location. This functionality is not supported for connection objects and device locations
    what could be going wrong
    Plesae suggest me the solution
    Thanking you in advance
    warm regards
    narasimha

    Hi,
    Please check the following settings in SPRO:
    Plant Maintenance & Customer Service - -Master Data in Plant Maintenance & Customer Service --Technical Objects --Functional Locations --Alternate Labeling of Functional Locations - - Activate Alternative Labeling --
    In this setting pls inactive the setting for Alt.Label.Then go to ES55 and try.It will work.
    Thanks,
    Banasri Mitra

  • Error occurred in deployment step 'Add Solution': Operation is not valid due to the current state of the object

    hi,
      when i was trying to deploy a SP  solution from my vs 2012 solution. this error  is displayed.
    i tried many things like
    1) get the wsp and apply power shell cmds to add and deploy, here also it failed:
    Add-SPSolution -LiteralPath d:\mywsp.wsp
    Install-SPSolution mywsp.wsp -GacDeployment -AllWebApplications -Local
    2) restart the timer services and  do  iisreset and  reboot the server. etc .as mentioned in one of the  the below  blogs:
    http://sharepoint1on1.blogspot.in/2014/04/sharepoint-error-occurred-in-deployment.html
    http://suehernandez.wordpress.com/2011/03/31/error-occurred-in-deployment-step-activate-features-operation-is-not-valid-due-to-the-current-state-of-the-object/
    http://www.dotnetsharepoint.com/2014/04/error-occurred-in-deployment-step-add.html
    http://social.msdn.microsoft.com/Forums/en-US/63adde23-03cf-4b65-923e-1219da94a780/error-occurred-in-deployment-step-add-solution-operation-is-not-valid-due-to-the-current-state-of?forum=sharepointdevelopmentprevious
    http://www.shakirmajeed.com/error-occurred-in-deployment-step-activate-features-operation-is-not-valid-due-to-the-current-state-of-the-object/
    but even after doing all these steps, the  error still persists!. and am not deploying into a remote server, the dev env is in a VM, where sp 2013, vs 2012, sql 2012  are installed.
    just wanna share one  note:   there is a isue in my search admin component. index was reset due to some reason. and from that time onwards my search full/incremental crawls were not working!
    will this cause an issue in my wsp deployment ? i hope  it wont, still  asking...
    can anyone help me how to resolve this error.because this is a  show stopper for me for the last few days!
    help is highly appreciated!

    This issue cause because of feature activation failure while WSP deployment.
    when you create a WSP using visual studio, it creates WSP package with default deployment configuration settings.
    Please restrict feature activation configuration, this will help you to troubleshoot this issue.
    - Click on Project in WSP and press F4, it will open "Project Properties"
    - set "Active deployment Configuration" - as "No Activation"
    - you can activate this features in required sequence after deployment using Activate-SPFeature
    If my contribution helps you, please click Mark As Answer on that post and Vote as Helpful
    Thanks, ShankarSingh(MCP)

  • Duplicate check for Connection Objects in CRM

    Hi,
    I want to implement a duplicate check for connection objects in CRM. The duplicate check shall use the address of the connection object and perhaps additonal attributes. I have found a duplicate check for business partners using the basis address service and TREX as index pool. However, I couldn't find a similar functionality for connection objects. Does somebody know:
    1) How to implement a duplicate check for connection objects which is based on the address of the connection object?
    2) Is there a way to use the TREX-based duplicate check which is integrated into the basis address service for connection objects?
    Thanks in advance!
    Best regards,
    Frank

    I also have a requirement to check for duplicate address at connection object level and we are using SAP data servies to validate the address. Can anyone share their experience.

Maybe you are looking for

  • How to enter a "to do" in mail

    In  Lion MAIL - one could clik on the body of an email and a window would pop up allowing you to enter a "to do" and or reminder date so it appeared on the callendar or reminder lists. How do you do this in mountain lion mail?

  • Not receiving inbox messages & one email I've sent keeps bouncing back bogging up my i

    Hello. I have a new MACBOOK PRO and I love it BUT..... I have been having one specific email bounce back into my inbox (recovered messages section) over 1,000x's a day. I keep deleting the messages and emptying the trash to try to stop it but its not

  • JDBC connection in 10.1.3

    Hello, I'm migrating from jDeveloper 10.1.2 to 10.1.3. I'm using the data-sources.xml to define databases to connect to. A code in a servlet could be for example: InitialContext ic = new InitialContext(); DataSource ds = (DataSource) ic.lookup("jdbc/

  • Nokia Messaging 6303i classic - no e-mail alerts

    Hi all, I have a problem with Nokia Messaging on my new phone - Nokia 6303i classic. The problem is that I can't enable the e-mail alert option - when I tick the "Alert me for new e-mail" option, it says "E-mail alerts not available. Alerts option ot

  • Creating an eprint account?

    the ePrint website will not allow me to create an account in order to access ePrint. The error message is Ajax submit failed: error = 403, Forbidden