SQL Plugin - connection pool & retries

People-

We use vCO workflows which a lot of CRUD operations on the database. In light of these are long-running workflows with a decent amount of load, we want to make sure that this solution we have in place is efficient and reliable. To this end:

1. we want to ensure that we are able to reuse the database connections - y at - it the notion of Pools of connections or equivalent.

2 How about reconnecting to the db when it falls down? Is that something it will take the code in the workflow through say managers of exceptions etc..

I'm sure that others have encountered similar problems - would appreciate all comments that you may have.

See you soon.

Hello

Unfortunately does not support the plugin SQL connection pooling. We have never considered it. We will discuss it and may include in the next version of the plugin update.

Regarding your second question - we don't keep connection open for a long time and call evry DB is atomic. When you run workflows CRUD a new conncetion is created, the corresponding SQL query is executed / clerk and the connection is closed. If there is a problem, as the disconnection of the server Oracle, the right way to ensure that your operation has passed is to write a custom error handling by using the Scripting of the Orchestrator features. In pseudo-code:

var hasPassed = false;
for (i = 0; i< maxretries="" -1="" &&="" !haspassed="" ;="" i++)="">

hasPassed = false;

try {}

Execute the statement using the JDBC API exposed or by using CRUD actions

hasPassed = true;

} catch (error) {}

Save the problem

}

}

Hope this helps you. Any additional comments will be great.

Best regards

Boyan

Tags: VMware

Similar Questions

  • JDeveloper PL/SQL WebService deployment to use the connection pool

    Hello

    JDeveloper/OAS 10.1.3.4

    We have generated Web Services based on package/procs of PL/SQL by using wizard. When we deploy, it generates a new pool of connections and the connection on the OAS. If change us the Web Service in JDev to use a connection Pool existing and redeployment, it always creates a new connection/connection pool.

    Change: oracle - webservices.xml, web.xml, and < ServiceName > base.java files

    Anyone know how to get around this without using WebServicesAssembler?

    Thank you

    When you deploy the server, don't include any local data sources. In JDeveloper:
    1. choose Tools > Preferences to display the Preferences dialog box.
    2. Select the deployment on the left side.
    3 uncheck data - sources.xml during deployment of default package.
    This can be changed later for other projects if you do not want to deploy the data source.
    Daren

  • connection pool and inefficient query plan

    There is a single query that covers almost 90% of cpu DB.

    Select * from employee e, Department d where e.departement_id = d.department_id

    Us will gather statistics for this table in two, and the issues is resolved.

    This occurs every 2 weeks. That said, the query runs fine for 2 weeks and then we have questions... we will bring together the statistics of these two tables... and things are good for another 2 weeks.

    This query is a proc to store oracle pl - sql, which is called by the JDBC code. I introduced 2 months behind connection pooling, and today, we are facing this problem.

    The query has been accounting for 5 years with no problems.

    Before that I presented the connection pool, the jdbc code created a new connection before calling the store proc.

    Do you think that my connection to the connection pool has introduced this problem.

    The DBA tell me that the query runs a bad plan. Oracle recovers not the more effective plan (and that leads to this high CPU utilization).

    I guess that after 2 weeks Oracle begins to pick up plans that are effective in.

    Do you think all that this question never has nothing to do with my connection pooling code.

    I use Oracle 10 G.

    Hi Mike and ground beach thanks for your response.

    It was just a doubt... that you guys allowed.

    Thank you

    m

  • vRO (vCO) HTTP-REST Workflow - connection pool closing

    Hi all - I've recently upgraded to vRealize Automation 6.2 and works collaboratively with vRealize Orchestrator to create workflows.  I created HTTP and REST workflows for request/release an IP address from our system IPAM (VitalQIP) and it seems to be failing with the description / the following exception:

    Connection pool stop (workflow: demand-IP-du-QIP / Scripting (item3) #14)

    vRO-1.pngvRO-2.png

    Looking for the schema > script line #14 is in red below:

    prepare the application

    Do not edit

    var inParamtersValues = [subnet, hostname, ddns, mac, type, w2kdom, comment];

    var request = restOperation.createRequest (inParamtersValues, null);

    Set the type of content query

    request.contentType = "";

    System.log ("request:" + request);

    System.log ("the request URL:" + request.fullUrl);

    Customize the request here

    request.setHeader ("HeaderName", "headerValue");

    run the query

    Do not edit

    var response = request.execute ();

    prepare the output parameters

    System.log ("response:" + response);

    statusCode = response.statusCode;

    statusCodeAttribute = statusCode;

    System.log ("status code:"+ statusCode ');

    contentLength = response.contentLength;

    headers = response.getAllHeaders ();

    contentAsString = response.contentAsString;

    System.log ("content in the string:" + contentAsString);

    Grep for IPaddress

    Patt var = ('forward IP");

    IPAddress = contentAsString.match (patt) m:System.NET.SocketAddress.ToString () var;

    IPAddress = ipaddress.split (/ [\s,] + /);

    IPAddress = ipaddress [2];

    System.log ("IP address: =" + ipaddress);

    vRO-3.png

    I'm not sure how to work around this problem and I'm looking for assistance because I'm fairly new to vRO.  Thank you very much!




    There is now an official fix for this problem: Technical preview of REST plugin version

    Please provide your comments.

  • API - POST - REST VCO connection pool closing

    Hello

    I'm working on an automation scenario where I need a VCO A workflow to start another workflow VCO B using the VCO REST Plugin (1.0.2) on VCO 5.1.1.

    I did it with success while creating a multitude of REST and surgery REMAINS by using the appropriate workflow. However, my approach is a lot of static and I need to create REST operations on the fly. I have had a look at workflows Plugin and try to do the same thing in my workflow.

    However I am stuck with the error 'Connection Pool close' when you try to run the POST request.

    My approach is to store the host REMAINS as a static attribute with VCO configuration object and retrieve it from there. I can run GET operations without any problem with the owner, i.e.


    restRequest = restHost.createRequest (restType, restUrl, restContent);

    restResponse = restRequest.execute ();

    My problem is actually running a POST operation. I prepared the content in XML format, which is

    " <-xmlns = execution context" http://www.VMware.com/VCO "> "
    < Parameters >

    < name parameter = "param1" type = "string" >

    < string > 1 < / string >

    < / parameter >

    < name parameter = "param2" type = "string" >

    < string > value2 < / string >

    < / parameter >

    < / Parameter >

    < / execution context >

    and use the content type "application/xml". Earlier in my code, I run a query GET to retrieve my ID for workflow target to create a Url like this:

    flow of work/98c3b8ee-9569-4940-acc1-b8fbc2e64649 / executions.

    This is code that I use to make the POST while creating an operation of REST when needed and delete it later.


    var restOperation = new RESTOperation (System.nextUUID ());

    restOperation.method = restType;

    restOperation.urlTemplate = restUrl;

    restOperation.defaultContentType = restContentType;

    restHost.addOperation (restOperation);

    RESTHostManager.updateHost (restHost);

    inputParameters var = [];

    var restRequest = restOperation.createRequest (inputParameters, restContent);

    restRequest.contentType = restContentType;

    var restResponse = restRequest.execute ();

    restHost.removeOperation (restOperation.id);

    RESTHostManager.updateHost (restHost);

    My code does not work when calling for the lifting of restRequest.execute: ' InternalError: connection pool arrested "." If anyone else has tried a similar scenario or has any idea what I may be missing?

    Thank you

    Bernd

    Thanks chap - update the objects did the trick.

    In my case, that initially caused the problem travel of COULD happen. Of course store the restHost object in the configuration of VCO leads to an out-of-date version at run time. I'm now store the ID of restHost only. Then, copy the following code works:

    var restHostId is System.getModule("my.library").myGetConfigAttr ("Folder", "VCO", "restHostId");.

    var restHost = RESTHostManager.getHost (restHostId);

    If (restType == 'GET') {}
    try {}
    restRequest = restHost.createRequest (restType, restUrl, restContent);
    restResponse = restRequest.execute ();
    }
    catch (exp) {throw ("request REST to run: cannot run '" + restType + "' '" + restUrl + "' request-reason = '" + exp + "'") ;}}
    }
    else {}
    try {}
    var restOperation = new RESTOperation (System.nextUUID ());
    restOperation.method = restType;
    restOperation.urlTemplate = restUrl;
    restOperation.defaultContentType = restContentType;
     
    restHost.addOperation (restOperation);
    RESTHostManager.updateHost (restHost);
     
    restHost = RESTHostManager.getHost (restHost.id);
    restOperation = restHost.getOperation (restOperation.id);

    inputParameters var = [];
    var restRequest = restOperation.createRequest (inputParameters, restContent);
    restRequest.contentType = restContentType;

    var restResponse = restRequest.execute ();

    restHost.removeOperation (restOperation.id);
    RESTHostManager.updateHost (restHost);
    }
    catch (exp) {throw ("request REST to run: cannot run '" + restType + "' '" + restUrl + "' request-reason = '" + exp + "'") ;}}
    }

  • the connection of WebLogic connection pool timeout issue too soon

    We are having a problem with the connection to weblogic pool. Our web application is based on the Spring Framework, deploy to Weblogic using the data source to connect to Oracle. We use a duration of 1 min and max setting of connection pool 15 on weblogic. But the problem that we face is that the pool does not manage any connection as a pool. Each request makes a new connection to the Oracle server and right closed within a few seconds of connection. The number of new connections could be easily up to more than 100 within 10 minutes.

    Is there a timeout parameter to check the living connection? Could someone please share your thoughts how to solve the problem? Your help is really appreciated.

    Framework Spring (2.5.3), Weblogic (10.3), Oracle (11 g 2)

    This is the setting on our data source:

    -----------------------
    Driver class: oracle.jdbc.OracleDriver

    Initial capacity: 30
    Maximum capacity: 30
    Ability to increment: 1
    Type of instruction Cache: LRU
    Statement Cache Size: 10

    Test the connections on the reserve: checked
    Test frequency: 120
    Name of the test Table: SQL SELECT 1 FROM DUAL
    Seconds to trust an idle connection pool: 10
    Reduce the frequency: 900
    The login retry frequency: 0
    Connect time: 0
    Timeout:0 connection inactive
    Maximum pending connection: 2147483647
    Timeout:10 store login
    Reporting deadline:-1
    Ignore the connections in use: checked
    Pins-wire: unchecked
    Remove Infected connections Enabled: checked
    ---------------------
    Of the tracking tool, we have seen the following statistics:

    Average number of active connections: 0
    Current number of active connections: 0
    High number of active connections: 1
    Total number of connections: 1523
    Current capacity: 1
    Doesn't have a number of requests for reserve: 46
    More high Num available: 30
    Number of connections leak: 0
    Wait for the high number of seconds: 0
    Number of requests for reserve: 1531

    Other parameters are all 0.

    --------------------------
    For the adjustment of the spring:

    < bean id = "ourdatasource" class = "org.springframework.jndi.JndiObjectFactoryBean" >
    < property name = "jndiName" > < value > weblogic.datasource < / value > < / property >

    <!-adds the following to the question if debugging caused by cluster or not->
    < property name = "cache" value = "false" / >
    < property name = "lookupOnStartup" value = "false" / >
    < property name = "proxyInterface" value="javax.sql.DataSource"/ >
    < / bean >

    Try to uncheck ' delete infected enabled connections "and let me know...

  • OBIEE 11 g - connection Pool &gt; Execute before application procedural error.

    Hello

    I am trying to run a stored procedure before running a query. Thus in the Connection Pool > Login Scripts > before Execute Query, I have the following code.
    BEGIN PRC_RUN_MV_JOBS();  
    END;
    I call a DBMS_JOB. RUN the PRC_RUN_MV_JOBS procedure (NUMBER of JOBS). It works fine when I run using Toad or SQL Developer.

    And I run a scan, I get the following error.
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119]
     Query Failed: [nQSError: 17001] Oracle Error code: 6550, message: ORA-06550: line 1, column 27: PLS-00103: Encountered the symbol "" when expecting one of the following: 
    begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> 
    << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe The symbol "" was ignored. at OCI call OCIStmtExecute: BEGIN 
    PRC_RUN_MV_JOBS(); END;. [nQSError: 17011] SQL statement execution failed. (HY000)
    Can someone make me please how to fix this? Thanks in advance.

    Try this:

    BEGIN PRC_RUN_MV_JOBS;  END;
    

    Best regards
    Kalyan Chukkapalli
    http://123obi.com

  • Connection pool with the OAS and the optimal value of min/max

    Hello world


    I have ", works with admin app to implement under oracle application server connection pool. The current value is min = 0, max = unlimited which I think means not implemented connection pool.

    Anyway I don't have a lot of information on connection pooling, I searched the forums, but I'm not able to find any useful information.


    My Manager would like to know what is the optimal value for min/max for the database, is there a specific formula or a tool that can help me on this issue?


    Thanks in advance.

    Hello

    It's a specific formula or a tool that can help me on this issue?

    The value that you specify for the number of connections and connections Min depends on a combination of factors, including the size and configuration of your database server and the type of the SQL operations that
    your application runs.

    For connection pooling,.
    First, check what is the value of 'process' located on the end of DB (for your current value, check v$ resource_limit at the end of db)...
    for example if the process is set to "1000", you cannot set the maximum value of the connection pool to the end server application above 1000 it will crash your database.

    now on the server side Application.
    As a best practice, set the maximum number of open connections and Minimum of connections open to the same value.

    For more details on connection pool and its settings.
    Check "Setting Up Data Sources - Performance Issues" of the link pdf below

    docs.oracle.com/cd/B14099_19/core.1012/b14001.pdf

    Hope that it would be useful

    Concerning
    Fabian

  • How to compile the connection pool java example code

    I recently bought David Knox of 'Effective Oracle Database 10' g security by Design and worked through his examples with identifiers of customers and how to exploit the database security with anonymous connections pools.

    The side of the things database I totally understand and have implemented, but I now want to compile / the java run the examples of code, but do not know what is required to compile this.

    I am running Oracle 10.2.0.4 (64-bit) Enterprise Edition on a Linux (RHEL 5) PC. Version Java is 1.6.0_20. .Bash_profile relevant environment variables are:
    export LD_LIBRARY_PATH = $ORACLE_HOME/lib: / lib: / usr/lib
    Export CLASSPATH = $ORACLE_HOME/jre: $ORACLE_HOME/jlib: $ORACLE_HOME/rdbms/jlib
    export PATH = $ORACLE_HOME/bin: $ORACLE_HOME/OPatch: / usr/kerberos/bin: / usr/local/bin: / bin: / usr/bin

    When I try to compile, I get:
    Oracle Java: DB10204$ FastConnect.java
    Exception in thread "main" java.lang.NoClassDefFoundError: java/FastConnect
    Caused by: java.lang.ClassNotFoundException: FastConnect.java
    in java.net.URLClassLoader$ 1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged (Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    to Sun.misc.Launcher$appclassloader$ AppClassLoader.loadClass (Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    The main class is not found: FastConnect.java. Program ends.

    Below is an example java source code. Is anyone able to point me in the right direction as to how to get this to compile? I have just a configuration syntax change and/or the environment to do, or there it more for this example doesn't work? Any help much appreciated.
    oracle:DB10204$   cat FastConnect.java 
    package OSBD;
    import java.sql.*;
    import oracle.jdbc.pool.OracleDataSource;
    
    public class FastConnect
    {
      public static void main(String[] args)
      {
        long connectTime=0, connectionStart=0, connectionStop=0;
        long connectTime2=0, connectionStart2=0, connectionStop2=0;
        ConnMgr cm = new ConnMgr();
        // time first connection. This connection initializes pool.
        connectionStart = System.currentTimeMillis();
        Connection conn = cm.getConnection("SCOTT");
        connectionStop = System.currentTimeMillis();
        String query = "select ename, job, sal from person_view";
        try {
          // show security by querying from View
          Statement stmt = conn.createStatement();
          ResultSet rset = stmt.executeQuery(query);
          while (rset.next()) {
            System.out.println("Name:   " + rset.getString(1));
            System.out.println("Job:    " + rset.getString(2));
            System.out.println("Salary: " + rset.getString(3));
        }
          stmt.close();
          rset.close();
          // close the connection which resets the database session
          cm.closeConnection(conn);
          // time subsequent connection as different user
          connectionStart2 = System.currentTimeMillis();
          conn = cm.getConnection("KING");
          connectionStop2 = System.currentTimeMillis();
          // ensure database can distinguish this new user
          stmt = conn.createStatement();
          rset = stmt.executeQuery(query);
          while (rset.next()) {
            System.out.println("Name:   " + rset.getString(1));
            System.out.println("Job:    " + rset.getString(2));
            System.out.println("Salary: " + rset.getString(3));
          }
          stmt.close();
          rset.close();
          cm.closeConnection(conn);
        } catch (Exception e)    { System.out.println(e.toString()); }
        // print timing results
        connectTime = (connectionStop - connectionStart);
        System.out.println("Connection time for Pool: " + connectTime + " ms.");
        connectTime2 = (connectionStop2 - connectionStart2);
        System.out.println("Subsequent connection time: " +
                            connectTime2 + " ms.");
      }
    }
    Code download is: http://www.mhprofessional.com/getpage.php?c=oraclepress_downloads.php & cat = 4222
    I'm looking at Chapter 6.

    I extracted the .jar (jar - xvf) file

    The ODBC .jar file? Don't, don't. Add it to your classpath as it is, or paste it into the WEB-INF/lib directory, or what you have to do.

  • Derby connection pool

    Although I copied the derbyclient.jar in .../oc4j/j2ee/home/applib and restarted the server, when I try to create a pool on this basis, the TEST fails due to:

    + < span class = 'x 1' > year error has occurred. + < span class = 'x 0' >cannot create: org.apache.derby.jdbc.ClientXADataSource
    + Lack of class: dependent on org.apache.derby.jdbc.ClientXADataSource
    class: oracle.oc4j.sql.config.DataSourceConfigUtils charger: oc4j:10.1.3
    Source code: /opt/appServers/oc4j/j2ee/home/lib/oc4j-internal.jar
    Configuration: In the META-INF/boot.xml to
    /opt/appServers/OC4J/J2EE/home/oc4j.jar
    This charge was introduced to ascontrol.web.ascontrol:0.0.0 using the
    Class.forName method.
    The missing class is available from the following locations: 1.
    Source code: /opt/appServers/oc4j/j2ee/home/applib/derbyclient.jar
    (to in opt/appServers/oc4j/j2ee/home/config/server.xml) This
    source code is available in the charger overall .libraries: 1.0. This
    shared library can be imported by the application "ascontrol". This
    source code is available in the Derby charger: 3.1.4. This shared library can
    be imported by the application "ascontrol". +

    I also tried to create a lib shared for her and still the same problem.
    Please notify.
    Thank you.
    NAT

    After a quick crash course Derby, run, create users, schemas, blunders by finding where derby.properties is going, etc. I have now it works using ClientDataSource and ClientXADataSource. It's only against localhost, which means little to your original question, but I am too wonr out/confused/scared to try to get the Derby settles everywhere and running on another server.

    So with a little Derby, what I discovered was that when usign the ' * DataSource ' class, you must specify the databaseName as an additional property. It does not appear to fall within the URL. I don't know why. The doc on the use of ClientDataSource is very thin in my humble OPINION. But after reading the error message, it seems to me that the databaseName has not been picked up from the URL, so I tried the approach of the property and the bingo! It worked.

    On our side, I then noticed in the console 'EM, that the "Test connection" button in the screen create only "seems to not work when property." I just filled in the fields, hit finish and then tested from the JDBC resources page resulting.

    Anyway, the best way for you to create the JDBC resource is probably to change the file data - sources.xml and add them manually.

    Here are the examples I used - note that I used a managed pool of datasource/connection both a native data source.

    < user native-data-source = "foo" password = 'bar '.
    URL = "jdbc:derby://localhost:1527 / wombat;" create = true ".
    Data-source-class = "org.apache.derby.jdbc.ClientXADataSource".
    JNDI-name = "jdbc/MyDerbyTest" name = "MyDerbyTest" >
    < property name = "databaseName" value = "wombat" / >
    < property name = value "createDatabase" = "true" / >
    < / native-data-source >

    And

    < connection-pool name = "DerbyCP_Foo" >
    <-factory connections
    factory-class = "org.apache.derby.jdbc.ClientXADataSource".
    user = 'foo '.
    password = 'bar '.
    URL = "jdbc:derby://localhost:1527 / wombat" >
    < property name = "databaseName" value = "wombat" / >
    < / factory connections >
    < / connection pool >

    < managed data source
    Connection-pool-name = "DerbyCP_Foo".
    JNDI-name = jdbc/derby/Foo"."
    name = "DerbyDS_Foo" / >

    Then I could run a test through the DS and it worked.

    Now, one thing that I've seen, but I have not worked through is that the default policy for the Derby network server only allows connections from localhost. I left as an exercise for the interested :-) reader develop and test. That I've demonstrated here, is that you can configure a ConnectionPool/ManagedDataSource and a NativeDataSource using the org.apache.derby.jdbc.ClientXADataSource class and make it work.

    Finally, I have my configured OC4J instance so that the derbyclient.jar is located in the applib directory and EM is configured so that it can see the contents of the directory by distorting its application.xml file - orion.

    D:\java\oc4j-10135-dev > jwhich % CD % ClientXADataSource
    ... looking...
    D:\java\oc4j-10135-dev\j2ee\home\applib\derbyclient.jar: org.apache.derby.jdbc.ClientXADataSource
    D:\java\oc4j-10135-dev\j2ee\home\applib\derbyclient.jar: org.apache.derby.jdbc.ClientXADataSource40
    -steve-

  • Connection pool does not work.

    Nice day. all the

    I tried OracleConnectionPoolDataSource and OracleDataSource.

    And found that there is no difference in performance. And connections are not grouped according to me.

    My sample fill the table with the records and read and update simultaneously in two threads.

    Below is a code provided.

    < strong >

    A piece of < facilities > logs: each time new connection is created.

    ...

    connection = oracle.jdbc.driver.OracleConnection@1198891

    0 updatedNumber = 1

    Connection.Close = oracle.jdbc.driver.OracleConnection@1198891

    connection = oracle.jdbc.driver.OracleConnection@17725c4

    Connection.Close = oracle.jdbc.driver.OracleConnection@17725c4

    List.Size () = 10

    0, name_update0, name_desc0, name_status0, 2008-11-04, 2008-11-04.

    1, a1, c1, b1, 2008-11-04, 2008-11-04.

    ...

    view the logs files I see that every time new connection is created in both cases, if I use OracleConnectionPoolDataSource or OracleDataSource.

    < strong >

    Question: < facilities > can someone help me understand how to use the connection pool? And how to see with my own eyes that this works?

    DDL < strong > < facilities >:

    to run the program, we should create table:

    {color: #000080} CREATE TABLE TEST_RECORD1)

    ID NUMBER (10) NOT NULL PRIMARY KEY,

    NAME VARCHAR2 (255 BYTE),

    VARCHAR2 (255 BYTE) STATUS,

    DESCRIPTION VARCHAR2 (255 BYTE),

    START_DATE TIMESTAMP,

    END_DATE TIMESTAMP

    ); {color}

    < strong >

    < Facilities > Java code:

    package test.jdbc;

    import java.sql.Connection;

    import java.sql.PreparedStatement;

    import java.sql.ResultSet;

    import java.sql.ResultSetMetaData;

    import java.sql.SQLException;

    import java.sql.Statement;

    import java.util.ArrayList;

    import java.util.Date;

    import java.util.List;

    javax.sql.ConnectionPoolDataSource import;

    import javax.sql.DataSource;

    Import oracle.jdbc.pool.OracleConnectionPoolDataSource;

    Import oracle.jdbc.pool.OracleDataSource;

    public class TestConnectionPooling2 {}

    static data source data source;

    / * number of iterations * /.

    public static final long BASE_REPEAT_NUMBER = 5;

    public static final long RECORDS_NUMBER = 10;

    Public Shared Sub main (String [] args) throws Exception {}

    Here you can change the data source (shared or not), but the performance has won "t change

    setupDataSource (new OracleDataSource());

    setupDataSource (new OracleConnectionPoolDataSource());

    long startTime = System.currentTimeMillis ();

    own picture

    removeAllRecords ("the removal of test_record1");

    insert records into the table

    for (int i = 0; i & lt; RECORDS_NUMBER; i++) {

    insertRecord (i,

    «insert into TEST_RECORD1 (id, name, status, description, start_date, end_date) "»

    + " values (?, ?, ?, ?, ?, ?)");

    }

    wire installation that queries the data in table

    Wire th1 = new Thread ("thread 1") {}

    public void run() {}

    for (int i = 0; i & lt; BASE_REPEAT_NUMBER; i++) {

    retrieveRecords ("select * from test_record1 by id asc");

    Thread.Yield ();

    }

    }

    };

    wire installation that updates the data in table

    Th2 thread = new Thread ("thread 2") {}

    public void run() {}

    for (int counter = 0; counter & lt; BASE_REPEAT_NUMBER; counter ++) {}

    for (int i = 0; i & lt; RECORDS_NUMBER; i++) {

    performSingleUpdate (counter, i,

    "update TEST_RECORD1 set name =?, description =?, status =? where id =? ») ;

    Thread.Yield ();

    }

    }

    }

    };

    TH1.start ();

    Th2.start ();

    do not complete until the worker threads

    While (th1.isAlive (): th2.isAlive ()) {}

    Thread.Yield ();

    }

    long endTime = System.currentTimeMillis ();

    System.out.println ("execution time:" + (endTime - startTime) + "ms.");

    }

    private static Sub performSingleUpdate (long bar, long I, String sql) {}

    PreparedStatement stmt = null;

    Connection conn2 = getConnection().

    try {}

    stmt = conn2.prepareStatement (sql);

    long temp = counter * 10 + i;

    stmt.setString (1, "name_update" + temp);

    stmt.setString (2, "name_desc" + temp);

    stmt.setString (3, "name_status" + temp);

    stmt.setLong (4, i);

    int updatedNumber = stmt.executeUpdate ();

    System.out.println (counter + ".") updatedNumber = "+ updatedNumber);

    } catch (SQLException e) {}

    e.printStackTrace ();

    } {Finally

    try {}

    stmt. Close();

    } catch (SQLException e) {}

    e.printStackTrace ();

    }

    If (conn2! = null) {}

    closeConnection (conn2);

    }

    }

    }

    private public static void removeAllRecords (String deleteAllSQL) {}

    Statement stmt = null;

    Connection conn2 = getConnection().

    try {}

    stmt = conn2.createStatement ();

    int updatedNumber = stmt.executeUpdate (deleteAllSQL);

    System.out.println ("remove all records. updatedNumber = "+ updatedNumber);

    stmt. Close();

    } catch (SQLException e) {}

    e.printStackTrace ();

    } {Finally

    If (conn2! = null) {}

    closeConnection (conn2);

    }

    }

    }

    {} public static void retrieveRecords (String sql)

    List = new ArrayList();

    Statement stmt = null;

    ResultSet resultset = null;

    int recordsCounter = 0;

    Output connection getConnection() =;

    try {}

    stmt = connection.createStatement ();

    ResultSet = stmt.executeQuery (sql);

    While (resultset.next ()) {}

    Record NewRecord = new Record();

    recordsCounter ++;

    newRecord.setId (resultset.getLong ("id"));

    newRecord.setName (resultset.getString ('name'));

    newRecord.setDesc (resultset.getString ("description"));

    newRecord.setStatus (resultset.getString ("status"));

    newRecord.setStartDate (resultset.getDate ("start_Date"));

    newRecord.setEndDate (resultset.getDate ("end_Date"));

    List.Add (NewRecord);

    }

    } catch (SQLException e) {}

    e.printStackTrace ();

    } {Finally

    If (resultset! = null)

    try {}

    ResultSet.Close ();

    } catch (Exception e) {}

    e.printStackTrace ();

    }

    If (stmt! = null)

    try {}

    stmt. Close();

    } catch (Exception e) {}

    e.printStackTrace ();

    }

    If (connection! = null) {}

    closeConnection (connection);

    }

    }

    StringBuilder sb2 is new StringBuilder ("list.size () =" + list.size () + "\n");.

    for (int i = 0; i & lt; list.size (); i ++) {}

    Record (Record) = list.get (i);

    SB2. Append ("" + record.toString () + "\n");

    }

    System.out.println ("" + sb2);

    }

    {} public static void insertRecord (long counter, String sql)

    PreparedStatement stmt = null;

    Connection conn2 = getConnection().

    try {}

    stmt = conn2.prepareStatement (sql);

    stmt.setLong (1 wicket);

    stmt.setString (2, "a" + counter);

    stmt.setString (3, "b" + counter);

    stmt.setString (4 "c" + counter);

    stmt.setTimestamp (5, java.sql.Timestamp (System.currentTimeMillis ())) of new;

    stmt.setTimestamp (6, java.sql.Timestamp (System.currentTimeMillis ())) new;

    int updatedNumber = stmt.executeUpdate ();

    System.out.println (".insertNumber =" + counter + updatedNumber);

    } catch (SQLException e) {}

    e.printStackTrace ();

    } {Finally

    try {}

    stmt. Close();

    } catch (SQLException e) {}

    e.printStackTrace ();

    }

    If (conn2! = null) {}

    closeConnection (conn2);

    }

    }

    }

    Initial methods

    private static Sub setupDataSource(OracleDataSource oracleDataSource) throws SQLException {}

    OracleDataSource ds = oracleDataSource;

    ds.setUser ("akhlystov");

    ds.setPassword ("xallex");

    ds.setURL ("jdbc:oracle:thin:@localhost:1521:abc");

    dataSource = ds;

    }

    public static {DataSource getDataSource()

    Returns the data source;

    }

    private public static void closeConnection (connection) {}

    If (conn! = null) {}

    return;

    }

    System.out.println ("Connection.Close () =" + login + "\n");

    try {}

    Connection.Close;

    } catch (SQLException e) {}

    throw new RuntimeException)

    "application should not run when the database cannot close the connection");

    }

    }

    static connection Conn;

    public static {connection getConnection()

    /*

    * Uncomment to test without any source of data, unique connection if (conn is

    * null) {try {conn = getDataSource () .getConnection () ;} catch}}

    * (SQLException e) {e.printStackTrace () ;}} return conn;

    */

    try {}

    Fitting out = null;

    If (instanceof ConnectionPoolDataSource getDataSource()) {}

    connection = ((ConnectionPoolDataSource) getDataSource ()) .getPooledConnection () .getConnection ();

    } else {}

    connection = getDataSource () .getConnection ();

    }

    System.out.println ("connection =" + connection);

    return of connection;

    } catch (SQLException e) {}

    e.printStackTrace ();

    throw new RuntimeException ("application should not run when the database is not available");

    }

    }

    Record class

    public static class {Record

    long ID;

    The name of the string;

    String desc;

    Status string;

    Date startDate;

    Date endDate;

    {} public long getId()

    return the id;

    }

    public void setId (long id) {}

    This.ID = id;

    }

    public String getName() {}

    return the name.

    }

    public void setName (String name) {}

    myIdName = name;

    }

    public String getDesc() {}

    return of ESCR;

    }

    {} public void setDesc (String desc)

    This.DESC = desc;

    }

    public String getStatus() {}

    return the situation;

    }

    {} public void setStatus (string status)

    This.Status = status;

    }

    public Date getStartDate() {}

    return startDate;

    }

    {} public void setStartDate (Date startDate)

    this.startDate = startDate;

    }

    public Date getEndDate() {}

    return endDate;

    }

    {} public void setEndDate (Date endDate)

    this.endDate = endDate;

    }

    public String toString() {}

    return the id + ',' + name + ',' + desc + ',' + status + ',' startDate + ', ' + endDate + ".";

    }

    }

    }

    Published by: Alexandr Khlystov on 04.11.2008 14:20

    Relevant documentation for JDBC 9i drivers here is http://download.oracle.com/docs/cd/B10501_01/java.920/a96654/connpoca.htm#1056354.

    In the world of JDBC 9i driver, there was a distinction between a connection pool (consolidated connection) and a cache of connections.

    A connection pool is trying to eliminate overhead consumption and resources of connection / disconnection from the database. If the connection is going to be only reused so no reason to close the connection, just open it again.

    What a performance gain were you looking for? Only, you would see a performance gain if your application was constantly opening and closing of connections, demanding that all resources for Setup and take down communications database. When the connection is established there is no difference in the performance of the execution of SQL.

    You can see with

    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    
    import oracle.jdbc.pool.OracleConnectionPoolDataSource;
    import oracle.jdbc.pool.OracleDataSource;
    import oracle.jdbc.pool.OraclePooledConnection;
    
    public class TestConnectionCache {
    
      public static void exec(Connection conn) throws SQLException {
        ResultSet rs = conn.prepareStatement("select sys_context('USERENV','SESSIONID') from dual").executeQuery();
        rs.next();
        System.out.println("Session id: " + rs.getInt(1));
        conn.close();
      }
    
      public static void main(String[] args) throws SQLException {
    
        OracleDataSource ods = new OracleConnectionPoolDataSource();
        ods.setUser("...");
        ods.setPassword("...");
    
        // Construct the jdbc url.
        String host     = "...";
        String port     = "...";
        String instance = "...";
    
        String url =
          "jdbc:oracle:thin:@//" + host + ":" + port + "/" + instance
          ;
        ods.setURL(url);
    
        // No connection re-use.
        exec(ods.getConnection());
        exec(ods.getConnection());
    
        // Connection re-use. (Connection pooling)
        OraclePooledConnection opc = (OraclePooledConnection)((OracleConnectionPoolDataSource)ods).getPooledConnection();
        exec(opc.getConnection());
        exec(opc.getConnection());
      }
    }
    

    Product output similar to:

    Session id: 4110149
    Session id: 4110150
    Session id: 4110151
    Session id: 4110151
    

    Note: when the pooliing connection is used, the session of database id is the same. Call close() has not closed the physical connection.

    A cache of connections is a layer on top of pooled connections that manages the creation and destruction of the connections. There usually limits this link how much should be open and the maximum number of connections to allow. Then the cache is queried for a connection, it can return the one that is not in use or perhaps create a new.

    Later versions of the JDBC driver will greatly simplify managing your connections and here is the note of documentation:

    Note:
    The previous cache architecture, based on OracleConnectionCache and OracleConnectionCacheImpl, is discouraged. Oracle recommends that you take advantage of the new architecture, which is more powerful and offers better performance.

    Any reason you're not not using a newer driver?

  • connection pool

    HI the OBIEE Experts

    How many pools of connections you used in your project

    To get data from another schema, then what you must activate in the connection pool

    . Can we create multiple pools of connection under the object of a database


    Thanks in advance

    You seriously to come on the forum and posting simply questions of an interview questionnaire or a certification test?

    You have 4 threads right now with 2 different user accounts. I suggest that you stop this behavior. Start posting questions with a specific context and meaning. We only are here to get a job, that you should better start for your own good if you do not know the answers and even less here to help you cheat your way to certification.

  • OBIEE 11 g RPD migration - how to automate the Connection Pool passwords changes in environments

    Hello gurus

    We have a situation in our client, where I am responsible for automating RPD Migrations in environments. In our current scenarios, (SID database) data source names and user names (schema name) are same in environments. The current process deploy us the RPD by EM then SPR online by using the administration tool and manually open update passwords in each connection pool (we have 9 pools of connections). There has been a lot of problems with this approach you can imagine (especial when do things the manual way).

    Can you please provide a better approach to automate this process in order to avoid human error.

    Thank you very much.

    Take a look at BIServerT2PProvisioner.jar http://docs.oracle.com/cd/E29542_01/bi.1111/e10540/conn_pool.htm#BHBBDDFF

  • How to validate SQL * MORE connection in Unix shell script

    I wrote the following function in unix shell script to validate SQL * MORE connection and throw a user-defined message.

    function check_db_conn

    {

    output | sqlplus-s-L $User/$Password@$SID >/dev/null

    If [[$?-no 0]]; then

    echo 'credentials incorrect DB.

    FI

    }

    However, I would like to change this feature so that the user has entered a good connection and that there is a problem with TNS listener must display the appropriate message.

    Hello

    Try adding:

    lsnrctl status $listener_name > /dev/null
    if [[ $? -ne 0 ]]; then
      echo "Issue with Listener"
    fi
    
  • NLS parameters in a connection pool environment

    I have limited experience of localization/globalization and I am building an application, using Oracle APEX 4.2/Oracle 11 g db, which takes care of several users of different nationalities.  I have a specific question, but first... can anyone recommend good books, blogs and websites to learn more about best practices for the many things you need to think in this area?

    Second, my precise question is... Since my application will use a connection pool, how it works as far as setting the NLS parameters for a given client session?  In the typical client/server architecture that I know that you would simply change the NLS parameter when the user connects, and this change would govern just the session of this user database.  It's a different approach when we are in an environment of connection pool?  If this is not the case, how Oracle now manages the parameters of the client session this session of customer may engage in more than one session of db in its lifetime?

    You can set the runtime: http://docs.oracle.com/cd/E16655_01/appdev.121/e17961/global_primary_lang.htm#HTMDB14002

    Thank you

    Sergiusz

Maybe you are looking for

  • I did my first backup right?

    I bought an external hard (Lacie) drive for the first time and I made my fist with time saving machine (macbook pro) which was really a struggle because I don't know anything. I understand not partitions and how to put in place, but looks like he wen

  • What are these "channel messages"? (In German, "Kanalnachrichten")

    Sometimes I get a notifitcation the title of "Kanalnachricht". There are numbers displayed.To give you an image, I uploaded an image in my blog: http://WP.me/a44nIR-16 I have not yet scanned the source code to determine, why I got these notifitcation

  • When you use Safari - Macbook crashes sometimes

    Hello! I have a weird problem with my Macbook Pro retina 2015. I didn't know if I should put this topic in the category of Safari, but this problem because I have improved my M to El Capitan. While I use my M Safari blocks - display freezes, works of

  • Impossible to have a brand new window "Auto-agrandie".

    Whenever I click on a link in IE 8, each new window is always a skinny 1 "x 2". Surely, there must be a way to open NEW window as "ENLARGED". There is absolutely nothing even 1% useful on either IE 8 'Help' and 'Help' Vista I'm used to XP and IE6, bu

  • Reset the filters using the API de BAS

    Hello is it possible to clear filters for a user by using the BOTTOM API. What I want to do is similar to the option '-see ' using the BESUserAdminClient, it is implemented in LOWER API Web services?