Multiple JDBC Connections

I am running net8 with oracle 8.1.7 on linux. I have an applet that connects to the database. I seem to lose my connection when another applet starts and connects to the database. Anyone know why I can't get more than one database connection?

Are both applets running on the same machine? If so, are you sure you don't have some sort of singleton class so each applet is actually trying to share the connection?
You might also check the SQL*Net logs for any error information.

Similar Messages

  • Multiple JDBC connection pools

    Hi
    I have WLI application ( 7.0 ) and another J2EE appliction configured on WLS (
    7.0 ). If I have multiple jdbc connection pools configured to access different
    ( or even the same ) databases, I am unable to get the connection to execute a
    sql query in the J2EE app. The connection pool gets initialized properly during
    the server startup and I can see them in the console but when I try to acquire
    a connection from the pool for execution of a jdbc stmt, I am unable to obtain
    a connection. Did any one succeed in configuring mulitple jdbc connection pools
    and WLI and another J2EE app to run together on WLS 7.0? Any suggestions are welcome.
    Thanks
    Sreeram

    Well ... It boiled down to ACLs.
    "Sreeram" <[email protected]> wrote:
    >
    Hi
    I have WLI application ( 7.0 ) and another J2EE appliction configured
    on WLS (
    7.0 ). If I have multiple jdbc connection pools configured to access
    different
    ( or even the same ) databases, I am unable to get the connection to
    execute a
    sql query in the J2EE app. The connection pool gets initialized properly
    during
    the server startup and I can see them in the console but when I try to
    acquire
    a connection from the pool for execution of a jdbc stmt, I am unable
    to obtain
    a connection. Did any one succeed in configuring mulitple jdbc connection
    pools
    and WLI and another J2EE app to run together on WLS 7.0? Any suggestions
    are welcome.
    Thanks
    Sreeram

  • Servlets and multiple JDBC connections...

    Hi Guru's
    I want to perform multiple JDBC queries simultaneously from my servlet. Let's say I have a connection pool containing JDBC connections. Now what I want to do is to use each of this connections simultaneously to perform queries in parallel.
    What is the best way to do this??? create multiple threads, one for each query, and then collate results when all threads are finished???
    Has anyone does this before or know of any links or samples which I can look at??
    your help much appreciated...
    Many Thanks

    Thanks but further questions....
    But take care:
    multithreading might only work parallel if there are
    multiple processors - otherwise the thread fragments
    will be processed one after the other until they are
    finished.I agree. My server has multiple processors hence multi-threading.
    Why do you need to perform the queries
    simultaneously?
    wouldn't it work too when you perform the queries one
    after the other?To speed up performance. Sequential processing is too slow at the moment.
    Hope you don't try doing so inside one single
    database...yes inside a single databse.
    Do you have any links to sample example etc..??? Importantly are you aware of any issues when one does this type of multi-threading from servlet. i.e does it clash with servlet's threading model etc...
    I am aware of how servlets multithread requests and am quite familiar with them. Just wanted some examples on multithreading JDBC connections from servlets and how I can wait for all threads to finish before collecting results....also wanted to make sure that there are no other issues....
    further help will be much appreciated.....

  • Establishing multiple WLEC connection pools

    Running WLS 6.0 communicating with WLE 4.2:
    I'm looking at setting up multiple connection pools to communicate with multiple
    WLE application domains.
    The code fragment below is from the BEA documentation and works fine if you know
    the domain(pool) name. My code uses the "lookup" method in the InitialContext
    class to get the pool name for single WLEC pool/domain configuration. Is there
    a method to return a list of domain(pool) names?
    Each WLEC connection pool has a Tobj_Bootstrap object that lets you access the
    associated WLE domain. The WLEC component provides an object called BootstrapFactory
    which provides access to the Tobj_Bootstrap object for a particular WLE domain.
    Include the following code in your WebLogic Server client to connect to a WLE
    domain:
    Tobj_Bootstrap myBootstrap = Tobj_BootstrapFactory.getClientContext("myPool");
    where
    The getClientContext() method returns the Tobj_Bootstrap object that is associated
    with myPool. If getClientContext() cannot find a WLEC connection pool with this
    name, it returns null.
    myPool is the name of a WLEC connection pool for the desired WLE domain. This
    WLEC connection pool needs to be defined in the Administration Console.

    Well ... It boiled down to ACLs.
    "Sreeram" <[email protected]> wrote:
    >
    Hi
    I have WLI application ( 7.0 ) and another J2EE appliction configured
    on WLS (
    7.0 ). If I have multiple jdbc connection pools configured to access
    different
    ( or even the same ) databases, I am unable to get the connection to
    execute a
    sql query in the J2EE app. The connection pool gets initialized properly
    during
    the server startup and I can see them in the console but when I try to
    acquire
    a connection from the pool for execution of a jdbc stmt, I am unable
    to obtain
    a connection. Did any one succeed in configuring mulitple jdbc connection
    pools
    and WLI and another J2EE app to run together on WLS 7.0? Any suggestions
    are welcome.
    Thanks
    Sreeram

  • JDBC  - Connecting Multiple Databases

    Hi JDBC's
    I would like to know if it is possible to retrive a data from different tables and from different databases using a single query, which mean can I retrive data from multiple tables multiple databases in a single JDBC connection?
    If not, How do I implement it?
    Any Ideas or please point me to any related solution if you have.
    Thanks.

    Although theoretically possible in fact a single JDBC connection cannot work with several databases. To implement this feature somebody has to write another aggregating JDBC driver which parse SQL statement and work with other databases in background. I like this idea, but currently there is no such driver available.
    Scriptella ETL (http://scriptella.javaforge.com) offers an interesting solutions for cross-database operations. See example on how -to copy a table from oracle to hsqldb: http://snippets.dzone.com/posts/show/3511
    If you want to join 2 tables from different databases and copy the result to a third database use the following code:
    <query connection-id="db1">
    SELECT * FROM Table1
    <query connection-id="db2">
    SELECT * FROM Table2 WHERE Table2_ID=?Table1_ID
    <script connection-id="db3">
    INSERT INTO Table3 VALUES (?rownum, ?Table1_Field, ?Table2_Field);
    </script>
    </query>
    </query>
    Message was edited by:
    ejboy

  • Single jdbc connection opens multiple connections to sql server

    Hello!
    I'm having a bad problem, because one jdbc connection opens multiple connections to the sql server. I'm working with the open source jdbc driver jtds and the ms sql server. Because I'm using temporary tables that are only visible to one database connection, my code doesn't work. Is this a bug in jtds or is this the normal behaviour of a java.sql.Connection?
    Here a code example:
    Class.forName("net.sourceforge.jtds.jdbc.Driver");
    conn = DriverManager.getConnection(
    "jdbc:jtds:sqlserver://"+dbConnDef.getServer()+"/"+dbConnDef.getDatabase(),
    dbConnDef.getUserName(),
    dbConnDef.getUserPasswd()
    Statement stmt = conn.createStatement();
    stmt.executeUpdate("SET DATEFORMAT YMD");
    stmt.close();
    stmt = conn.createStatement();
    stmt.executeUpdate("CREATE TABLE #tmp (FieldA INT NOT NULL)");
    stmt.close();
    stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT * FROM #tmp");
    stmt = conn.createStatement("SELECT FieldA AS sthElse FROM #tmp");
    ResultSet rs2 = stmt.executeQuery("SELECT * FROM #tmp");
    // the strange thing is, that this second query does NOT yet open a
    // new connection, but the next sql command does.
    stmt = conn.createStatement();
    stmt.executeUpdate("DROP TABLE #tmp");
    stmt.close();
    Why is it behaving that strange way? It is absolutely necessary, that EVERYTHING that I do with my connection is really done on the same connection to the SQL server! How can I force a java.sql.Connection not to open multiple sql-server-connections?
    It is very urgent, thus, PLEASE HELP!!!
    Thousand thanks in advance! Marco.

    ...but that means, that the jdbc driver I use, is not working properly, because it should work the following way (please correct me, if I misunderstood the concept):
    I create a Connection object which should represent exactly one physical connection to the database. Then I can create as many Statement instances by conn.createStatement() as I want. There should still exist only one physical connection.
    With each of my Statement objects, I can create one result set.
    This means, I should be able to create as many result sets as I want to with only one Connection object (and therefor one physical connection) by creating multiple Statements, right?!
    If this is correct, the concept is perfect for me and exactly as I'm used to it by other programming languages. Then, only my jdbc driver does not work properly which means I either have to replace it by another one or change it myself (it's open source).

  • JDBC connection issue with multiple DBs on same instance

    I have two databases on one sql server 2012 instance.  One called 'demotime' the other called 'demotime_dev'.  how ever when I change in my JDBC connection the DB from demotime to demotime_dev.  the connection still remains established with
    the demotime, is there any known reason to cause this? does both being on the same instance have anything to do with the problem?

    Do your application may send a "USE [demotime]" command to Switch to the database? Do you may use a config file in your application where the database is still pointing to the other database?
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Xa-problems when releasing jdbc connection

    We have a very strange problem with our WL setup.
    Weblogic 8.1.4 (2 cluster nodes)
    Oracle 9i stand alone db (although tested on RAC with 2 nodes)
    The application architecture is quite complicated, with several EJB-applications that communicate via JMS and RMI. Everything (except logging) runs under xa-transactions that span multiple applications. We use both xa (for everything but logging) and non-xa jdbc connection pools (Oracle thin driver).
    When we release a jdbc connection then the following node manager log entry is written:
    <Mar 13, 2006 11:11:02 AM UTC> <Error> <JDBC> <BEA-001112> <Test "SELECT 1 FROM DUAL" set up for pool "myPoolXA" failed with exception: "oracle.jdbc.xa.OracleXAException".>
    <Mar 13, 2006 11:11:02 AM UTC> <Error> <JDBC> <BEA-001035> <The following error has occured: XA operation failed : java.lang.NullPointerException
    at weblogic.jdbc.wrapper.VendorXAResource.rollback(VendorXAResource.java:78)
    at weblogic.jdbc.jta.DataSource.rollback(DataSource.java:1047)
    at weblogic.transaction.internal.XAServerResourceInfo.rollback(XAServerResourceInfo.java:1358)
    at weblogic.transaction.internal.XAServerResourceInfo.rollback(XAServerResourceInfo.java:687)
    at weblogic.transaction.internal.ServerSCInfo.startRollback(ServerSCInfo.java:729)
    at weblogic.transaction.internal.ServerTransactionImpl.localRollback(ServerTransactionImpl.java:1909)
    at weblogic.transaction.internal.ServerTransactionImpl.globalRollback(ServerTransactionImpl.java:2592)
    at weblogic.transaction.internal.ServerTransactionImpl.internalRollback(ServerTransactionImpl.java:385)
    at weblogic.transaction.internal.ServerTransactionImpl.rollback(ServerTransactionImpl.java:364)
    at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:279)
    at weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObject.java:140)
    at com.xx.myapp.ejb.MessageMgmt_s1i1u8_EOImpl.processMessage(MessageMgmt_s1i1u8_EOImpl.java:56)
    at com.xx.myapp.ejb.MessageMgmt_s1i1u8_EOImpl_CBV.processMessage(Unknown Source)
    at com.xx.myapp.ejb.TextMessageReceiverBean.onMessage(TextMessageReceiverBean.java:120)
    at weblogic.ejb20.internal.MDListener.execute(MDListener.java:370)
    at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:262)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2678)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:2598)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    As we understand the message this means that the jdbc resource wrapper crashes with a NPE.
    Are there any hints on this situation ?
    Regards
    Nikolaus Rumm

    Additional information:
    We use Hibernate as the persistence layer. The problem arises when the application detects a business problem and calls setRollbackOnly() on the session bean's ejb context, followed by a "throw ApplicationException" (extends java.lang.Exception).
    When we use unchecked exceptions for business exceptions (which violates the EJB spec) everything works fine.

  • Multiple jdbc credentials : setting AM pool config parameters on runtime

    Hi
    was working with multiple jdbc credentials. In the custom JDBC cookie session factory, i try to set my AM configuration parameters , and pass this on to the env info provider , as instructed in the samples. But if i try to pass the JDBC Name , or configuration parameter etc , it refuses to recognize the connection. I have to specify the DB username, DB password and jdbc connection url string for the settings to actually take effect.
    I tried using data sources as well, but it in vain.
    Is this probably a bug , or is this an issue with how i have implemented it.
    code sample with createSessionCookie method of customJDBCSessionCookieFactory:-
    Hashtable env = pool.getEnvironment();
    env.remove(Configuration.DB_USERNAME_PROPERTY);
    env.remove(Configuration.DB_PASSWORD_PROPERTY);
    env.remove(Configuration.DB_CONNECT_STRING_PROPERTY);
    env.remove(Configuration.JDBC_CONNECTION_NAME);
    pool.setUserData(null);
    EnvInfoProvider provider = null;
    String dbSID = (String)request.getAttribute("dbSID");
    if(dbSID.equalsIgnoreCase("SID1")){
    provider = new DynamicJDBCEnvInfoProvider( "myJDBCName");
    session.setAttribute( Configuration.JDBC_CONNECTION_NAME, "myJDBCName");
    cookie.setEnvInfoProvider(provider);
    .............................................................

    KUBA - were you able to resolve these issues and if so are there any lessons learned you can share?
    I'm hoping someone from the ADF team can answer our original question including guidelines for setting pool parameters and how to monitor the pool's performance while running in production.
    thanks

  • JDBC connection over IPv6

    Hi
    I have an MS SQL Server 2005 Database Server and a Client computer on two different subnets.
    There is also a DNS Server, which contains both an IPv4 (A) and IPv6 (AAAA) DNS record for the Database Server.
    I've disabled IPv4 routing between the two subnets so that the Database Server is only accessible by IPv6 from the Client computer.
    I am then unable to connect to the Database Server from the Client using JDBC.
    I have tried increasing the loginTimeout in the JDBC connection string, but this doesn't appear to make any difference.
    I get a java.net.ConnectException in about 20 seconds.
    If I remove the IPv4 (A) record of the Database Server from the DNS Server, the JDBC connection then succeeds.
    Does JDBC iterate over all the possible addresses of the Database Server?
    Is the loginTimeout the correct parameter to try to increase, to allow it to iterate over the possible addresses?
    There is a similar problem with MS SQL Client - see http://msdn.microsoft.com/en-us/library/ms378428(SQL.90).aspx
    But increasing the connection timeout allows a successful connection.
    Thanks
    Alain

    jschell wrote:
    ahkal01 wrote:
    Alain: A machine may have multiple IPv6 addresses, as well as an IPv4 address.
    You may not be able to get to the machine via all the addresses, depending on the network route.
    If a driver gives up on the first DNS lookup (which probably will be the IPv4 address), it'll never try the IPv6 addresses. However that is NOT what you are testing.
    As described in your first post there is a route. Routing works if the final location is found. After that a refused connection is a refused connection.
    Alain: In my test, IPv4 routing is disabled between the two subnets. So there is no IPv4 routing between the two machines, only IPv6.
    >
    But even so, to me it is still two different IP addresses. Just as if you try to create your own replication by having two database servers on different IPv4 addresses. If the client is supposed to be using one address then the DNS should be set up that way.
    Or use the address. Because the point is not the IP address, the point is the DNS look up.
    Alain: With IPv6, it is common for computers to be assigned more than one address for routing under different hierarchies.
    If you're saying that the DNS lookup should be set up to return only one IP address to client computers trying to connect to the DB Server, DNS will need to be set up differently depending on where the client computer is.
    >
    Again looking at it from the point of someone developing a driver the only option I would allow is that one might be able to specify a configuration value that says to try a IPv6 address first. That would be in the driver, not JDBC. So you can look to your driver for that.
    There is a similar problem with MS SQL Client - see http://msdn.microsoft.com/en-us/library/ms378428(SQL.90).aspx
    But increasing the connection timeout allows a successful connection.
    I do not see anywhere in that link that it claims that the setup you are using would work Alain: apologies. It was the wrong url link.
    I meant, http://blogs.msdn.com/sql_protocols/archive/2005/10/12/480192.aspx.The scenario there is SQL Server is configured to listen only on IPv6 addresses and disable all IPv4 addresses so that only IPv6 connection can be accepted. The workaround is to specify the IPv6 address of the target machine explicitly to force SNI to use IPv6 connection directly or to use longer timeout value. I don't see that in that blog.
    It says that if you have addresses that some different behavior might result. It specifically refers to using an IPv4 address (not DNS) and failing on that and then attempting to use a IPv6 address (again not a DNS) and even in that case it might fail.
    Alain: The blog is talking about a hostname resolving into multiple addresses. I quote from the blog, with bold for emphasis,
    "In most cases, the connection string does not need to be modified if the <servername> is specified using server hostname or FQDN (Full Qualified Domain Name). If the server machine has dual-stack, *its hostname or FQDN will be resolved into multiple IP addresses*, including at lease one IPv4 address and multiple IPv6 addresses. *And SNI will attempt to establish connections using these IP addresses in order and use the first connection that succeeds*. IPv4 addresses are attempted first if both IPv4 and IPv6 addresses are present. This logic is transparent to the users of ODBC, OLEDB or ADO.NET.
    And it doesn't say anything about that some clients already do this but merely that they can.
    Alain: SNI does, from the quote above. A test also shows that it does try all the addresses that DNS returns, with the caveat that the connection timeout has to be increased.
    Unfortunately it looks like the MS JDBC driver doesn't do likewise.
    Myself I don't really consider that a valid option for most use cases for drivers. If I have a data center then I am not normally going to be using both types of addresses. And if I am both will work. And if there are variation in subnets then I would expect that if DNS is in use then it would be set up to correctly represent that.Thanks for your input on this thread. Much appreciated.

  • Unable to create dynamic JDBC Connections in RMI Server

    Hi,
    Goal: Using Swing client to connect to a variety of JDBC databases via RMI dynamically....
    J2SE : 1.4.2
    J2EE: 1.31
    Databases: Oracle 9i(R2), MySQL 4.0, MS Access 2000
    Platform : Windows 2000 SP4 (Professional and Server)
    I have a working client-server application using RMI to connect to a single database. I want the ability
    to create JDBC connections dynmically by invoking a RMI method after it has been bound. Presently
    I am getting null pointers. Anybody offer any solutions or work arounds?

    Goal: Using Swing client to connect to a variety of
    JDBC databases via RMI dynamically....Actually what u want from the client swing is to form a Form using the datamodel from the database, invoke query as the client is allowed and wants and update changes. I hope I got it right, thats what u want.
    Actually as per my knowledge goes thats what any Database 3-tier program should do.
    I have a working client-server application using RMI
    to connect to a single database. I want the ability
    to create JDBC connections dynmically by invoking a
    RMI method after it has been bound. Presently
    I am getting null pointers. Anybody offer any
    solutions or work arounds?Database connections are only needed as long as the query to the database are being processed. So for ur solution if u have a RMI method that, will invoke first, the database connection and then process the query and then disconnect it , would be enough. When multiple clients will call the method there will be multiple connections to the database as they can have threads working or if u want one process at a time u can sycronize the method. This RMI method will only return the result set of the query and that would be enough for ur solution. Now to be able to say why ur getting null pointers I would need the code u r using.

  • JDBC Connection Driver Problem for Oracle in a J2EE servlet/class

    Hi,
    I am having a big problem with setting up a JDBC connection with my oracle database, I have been trying to fix it for about 6 hours now with no joy, I have read that many threads about JDBC, class paths etc.. that i dont know which way is up any more!!
    Here is the issue:
    (Please bare in mind that I am new to this when posting replies)
    I have a Web Application set up as a project in the netbeans IDE. I have a servlet which creates a new object call dbaseFunc which is a public class I have wrote and within this class is a function called getAppConfigCon(). The code for this function is below:
    public Connection getAppConfigCon()
    Connection con = null;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","cavdev", "password");
    catch (SQLException e)
    e.printStackTrace();
    catch (ClassNotFoundException e)
    e.printStackTrace(System.out);
    return con;
    The database is Oracle XE and is installed on the same machine I am developing on, the database is up and I can connect to it via the netbeans IDE database interface after telling it where the driver is (C:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.zip). Obviously this is just IDE functionality and allows you to browse the database objects from netbeans however I now need to know how to tell the jre where the drivers are, right??
    Well like I said multiple forums led me down the classpath route and I have a system environment variable called CLASSPATH set up with the oracle jdbc driver specified as its value, when i run the set command from the command line ( I am running Windows XP Pro) I can see the class path entry in the output as follows:
    CLASSPATH=C:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.zip
    When I try to run my web app it doesnt assign the connection object with a value, i.e. when i was debugging my con object was null after calling the method mentioned above. After some time debugging i found a ClassNotFoundException was being thrown when the following command was executed:
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Which I understand is because their is a problem with the class path but what is the problem??? The IDE likes the driver so why doesnt the jre.
    I am runnin jdk and jre 1.5, an Oracle XE Database using the netbeans environment.
    Some one please help me, I have spent far to much time on this rather than actually working on my project!!!!
    Thanks
    Keith

    Well After 10.5 hrs I actually sorted this myself, the two problems that were throwing me were this:
    1. Netbeans does not stop the tomcat server when it finishes running the app, you either have to stop the server from the menu or exit netbeans, until the server restarts it will not pick up on any driver files you add to common/lib
    2. You are very right Kiros tomcat does not do .zip files!!!!~~~###
    In order to sort this I had to add the oracle driver as a package to my project using the netbeans ide Project > Libraries > New Jar file, this allowed me to access the oracle classes. Then I had to set the server up to deal with the drivers as well, this meant adding the .jar file (not the latest .zip as it wont work) to the bundled tomcat common lib directory and restart the server via the ide (using the start/stop bat files in the tomcat conf directory doesnt work for some reason when its bundled with netbeans!)
    Thanks for the help guys but in the end it took 10 hrs a lot of reading and 2 bottles of lucozade to keep the brain goin.
    Keith

  • Help me understand JDBC connections using DataSource objects

    I'm writing a simple Java server application that accepts connections from multiple clients via RMI, connects to a SQL Server 2000 database via Microsoft's SQL 2000 JDBC driver, gets some data, and returns it to the client. The server application will handle every SQL database connection. However, it must be able to establish multiple simultaneous connections, since multiple clients may connect at the same time and request data.
    Sounds like a simple multi-threaded server that utilizes a connection pool for database connectivity, right? Well, if I want to do that, I have to register a PooledDataSource object with JNDI. My server threads that are handling requests will simply grab connections out of the pool to retrieve data (presumably).
    This seems like a fairly simple server application; however, all the information and tutorials I've read on using DataSource objects for database connections rather than DriverManager.getConnection() mention XML config files, J2EE application servers, Tomcat, WebSphere, etc. I really don't want to have to deal with all that just to get connection pooling and not have to use the DriverManager.getConnection() method.
    Is there a simple way to use DataSource objects without installing a lot of extra junk on my server?

    Thanks, diazlara. Your response was exactly what I needed to know. All the information I've read prior to this suggested that I had to have a J2EE server running, and that I had to register the DataSource object with JNDI. If you ladies and gents could take a quick look at this and let me know if I'm doing it correctly, I'd appreciate it.
    As proflux suggested, I wrote a connection manager:
    import java.sql.*;
    import javax.sql.*;
    import com.microsoft.jdbcx.sqlserver.*;
    public class SQLConnectionManager {
       private static ConnectionPoolDataSource connectionPool;
       // Initialize the connection manager
       public SQLConnectionManager() {
          init();
       // Retrieve a connection from the connection pool and return it
       public static Connection getConnection() {
          Connection connection = null;
          try {
             connection = connectionPool.getPooledConnection("myUsername", "myPassword").getConnection();
          catch (SQLException ex) {
             System.err.println("A problem occurred while getting a connection from the pool.");
             ex.printStackTrace();
          return connection;
       // Initialize the datasource and connection pool
       private static void init() {
          SQLServerDataSource mds = new SQLServerDataSource();
          mds.setDescription("MS SQLServerDataSource");
          mds.setServerName("127.0.0.1");
          mds.setPortNumber(1433);
          mds.setDatabaseName("SomeTable");
          mds.setSelectMethod("cursor");
          connectionPool = (ConnectionPoolDataSource) mds;
    }As you can see, I'm hard-coding the username and password for testing purposes. I'll incorporate a login/authentication system for any production code that I use this in.
    Once the SQLConnectionManager is created, connections can be retrieved as follows:
          Connection connection = null;
          try {
             connection = SQLConnectionManager.getConnection();
             System.out.println("** Got a SQL database connection from the pool");
             DatabaseMetaData metaData = connection.getMetaData();
             ResultSet rs = metaData.getCatalogs();
             while (rs.next()) {
                System.out.println("\tcatalog: " + rs.getString(1));
             rs.close();
             connection.close();
          catch (SQLException ex) {
             System.out.println("An exception occurred while connecting to the SQL Database:");
             ex.printStackTrace();
          }So, how does that look? I tested it out, and it seems to work just fine. Using this code, I am getting a connection from a pool, correct? I want to make sure of that. Also, are there any inherent weaknesses or flaws with this method that I need to be aware of?
    Thanks so much for all the helpful responses.

  • New ADF Taskflow transaction acquires a new JDBC connection?

    Hi,
    I would like to know more about ADF Taskflow transaction in relation to JDBC Connection.
    tf1 ----(contains)---- page1 and call to tf2
    tf2 ----(contains)---- page2
    page1 - search objects
    page2 - edit objects
    I have two pages part of two taskflows, first taskflow does not create any transaction but the page1 in tf1 shows a searh screen for objects. I want to use transaction behavior of ADF TF for tf2 which is called in tf1.
    My tf2 contains a page for edit objects, if i set New transaction as TF transaction behavior for tf2.
    Does it really acquire a new JDBC connection?
    I really appreciate if someone can help me with this.
    Thanks,
    Sunil.

    "Is there any way to achieve 1 user ---> 1 connection ?"
    I don't claim to be an expert on answering this as there's still a lot of things I need to investigate, and other's in the forum may chime in with more informed answers, but my understanding is you need to:
    a) Use a single root AM
    b) Configure your BTFs to use "shared data control scope" and the same AM
    c) All of your BTFs should use "Use existing transaction if possible"
    Because of "c", the very first BTF called, will not have a transaction to borrow, so it will establish a new transaction and therefore a new connection.
    An alternative is, and I'm on shaky grounds here so please check this for yourself, but you could set all your BTFs to "use no transaction", which implies I believe they switch back to the model used in JDev 10g, where it's purely your AMs that determine connections/transactions.
    As for saying 250 connections sounds very high, that's really up to you. If you build an application that you need to support a user with multiple transactions, it's your requirement that causes this. IMHO Oracle has given you the flexibility to build your application anyway you want, so it's up to you to decide if you want multiple concurrent transactions per user or not.
    Finally regards the behaviour observed in WLS, note that the AM pooling options can influence the behvaiour of connections, so it's hard to say what you're seeing is correct, it depends. A suggestion is to install Oracle's Fusion Middleware Control application and use that for monitoring statistics; the FMW Control has smarts built it to help you observe the AM pooling and connection pooling. Andrejus Baranovskis has a few blog posts describing how he used this to track the pooling options.
    CM.

  • Leaking JDBC connections

    We have a web application that is currently depending on Application Module Pooling.
    Our production system is configured with PIIX to enforce a multiple DMZ model. The ocj4 instance serving our application is in one DMZ and the data base server is in another. PIIX is configured to disable connections between firewalls that are idle for 30 minutes. Over time, JDBC connections leak (50 to 60 a day). It looks like when the fire wall disables a connection that is being referenced by an application module that has been idle for 30 minute, that application module is getting a new connection to service without returning the disabled connection to the OS.
    Would we set the jbo.maxpoolcookieage property of the Application Module to less than 30 minutes to avoid the JDBC connection leaks? If not, how can we configure the application module so that disabled JDBC connections are returned to the operating system if the connection has been timeout out by the firewall software?
    Thanks in advance.

    My thought is that your firewall feature is completely
    at odds with connection pooling.
    Doesn't it stand to reason that a conn will be idle when
    your app is idle?
    On the other hand, you might be able to use J2EE (OC4J)
    conn pooling and tune the closing the idle connection in
    data-sources.xml and set min conns to zero. This way
    you might get the container to close all conns and you'll
    leak no idle conns.
    I don't think AM pooling with nailed up conns or using
    BC4J's conn pooling will time out idle conns as will
    the J2EE container.
    Search this forum on data-source.xml and I posted definative
    how-to configure datasource connection configuration and
    tuning.
    BTW, doing this, will make first users of your app sluggish
    as they pay the cost of new connections. ;-(
    Good luck.
    curt

Maybe you are looking for

  • APD issue, Data not showing correctly in APD.

    Hi All, Please guys help me with this APD issue that I am facing. There is an APD created whose target is a file and with one routine. Here the purpose of the routine was mostly just to sequence the fields the way I want them, and only to show certai

  • Uninstalled Itunes Wrong Now it wont install says i need Itunes.msi

    my Itunes out of No Where just stopped working and brought up the Error 7 Windows 126 Screen and said please reinstall itunes... I Uninstalled Itunes Wrong on my Laptop...Then when i go into the control panel to delete it completely it wont let me sa

  • Data Source for MS SQL SERVER

    Need Help on how to add a data source from MS SQL Server. Please give an example using PUB as the database and the server is N12345\SQLSERVER. Thanks.

  • List of values minus select query

    Hi I have list of fixed values say (2,3,5,7,11,13, .. ...97). I want to minus this list withe some query. how can I do that in oracle 9i sql. ex: select (abovelist) minus select value from numbers; I don't want to create the table with above list and

  • Importing Netscape's address book into Apple's Address Book application

    I want to import my email Netscape email address book into Apple's Address Book application. So I open the Address Book application and select import from the pull down menu. That brings up three choices, vCards, LDIF and Text. I previously had saved