DataSource Vs Connection Pooling

What is the difference between Datasource and Connection Pool, and what is the advantages of using both.can any one plz explain me..

Hi,
Without creating a Connection Pool, one can not create a Data Source.
Connection Pool refers to the DataBase URL, Driver Class, User-Id and Password for the database.
Data Source refers to the Connection Pool created above for the particular database.
And to get connection from the DataSource:
DataSource ds = (javax.sql.DataSource)initCtx.lookup("JNDI-NAME");
Connection conn = ds.getConnection();
sameer

Similar Messages

  • Difference between Datasource and Connection Pool

    Hi,
    What is the major difference between Datasource and Connection Pool.
    Both the Datasource with JNDI and Connectio Pool will serve the pool of connections. Then what is the difference.
    regards,
    Raj

    A datasource is not implicitly a connection pool. You can configure that in the datasource properties. A connection pool is also not implicitly a datasource. You can create your own connection pool using the java.sql interfaces. A datasource just gives the ability to acquire the connections and access the database through JNDI. A connection pool just gives the ability to reuse a set of connections which are created/closed/controlled by the connection pool logic.

  • When is it appropriate to use DataSource (or Connection pooling)?

    Hello all,
    I'm having some design issues with my application and I'm starting to think that maybe using Connection pooling is not suited for my application. I'm using Tomcat 5.5.12 if it's any relevant..
    The architecture of our application looks like this:
    Servlets -> App Helper classes -> DB/Accessor classes
    looks like the three-tier architecture described in this document: http://www.subrahmanyam.com/articles/servlets/ServletIssues.html
    I have read on the Tomcat docs that said that using DataSource is good practice and improves efficiency since it recycles database connections. However, if the accessor/DB classes are not servlets, how can I use the DataSource facility that interacts with Tomcat?
    I would like to know whether it is a good idea to use DataSource in my case and if so, how? (since they are not servlets)
    Thanks in advance :)

    Hi. Thank you for replying.
    In the examples that I've seen that use JNDI for Database access, it seems that DataSource is always used--in other words, JNDI and DataSource always seem to be used together (in Servlets). I have not found a case where JNDI is used by itself to access the Database--perhaps I'm not looking in the right place. Could you point me to some documentation maybe?
    Thanks a lot!

  • Migrating from WebLogic v8.1.3 to v10.3:  Datasources and Connection Pools

    I took the liberty to migrate my OLD BEA WebLogic v8.1.3 domain (i.e. sample) to Oracle WebLogic v10.3. Everything appears to run smoothly BUT when I try to connect to the Hypersonic Database I had from the OLD environment, I get connection errors (i.e. weblogic.common.ResourceException). I can see from the NEW 10.3 environment that the migration utility creates two (2) datasources (sampleDS and samplePool). However, when clicking through the screens, I do not see how sampleDS refers to the samplePool out of the box from the migration utility. When I start the WebLogic domain with startWebLogic.cmd...here is the code to launch the actual DB instance:
    cd hsqldb
    start "Sample DB (HSQLDB)" %JAVA_HOME%\bin\java -classpath hsqldb.jar -Xms32m -Xmx128m org.hsqldb.Server -database sampleDB -port 15553 -silent false -trace false
    cd ..
    This works quite well and launches a window that has the following:
    | Sample DB (HSQLDB)
    | server.properties not found, using command line or default properties
    | Opening database: sampleDB
    | server.port =15553
    | server.database =sampleDB
    | server.silent =false
    | HSQLDB server 1.7.1 is running
    | Use SHUTDOWN to close normally, Use [CTRL] + [C] to abort abruptly
    | Wed Jun 16 10:18:48 EDT 2010 Listening for connections ...
    |_________________________________________________________
    This is the right screen and confirms my database is up and running and waiting for connections. Somehow, when I migrated from 8.1 to 10.3 something is not configured correctly and my sampleDS is not properly leveraging the samplePool. Can anyone shed any light on this problem?
    I have went through most of the posts and can not seem to understand what happens to the DS and Pools during the migration and specifically how do I reconnect the two to ensure that I can connect to the database. The app is up and running fine in WebLogic v10.3 but without the dB connection, I am stuck at the login screen.
    Thanks for any help...

    I took the liberty to migrate my OLD BEA WebLogic v8.1.3 domain (i.e. sample) to Oracle WebLogic v10.3. Everything appears to run smoothly BUT when I try to connect to the Hypersonic Database I had from the OLD environment, I get connection errors (i.e. weblogic.common.ResourceException). I can see from the NEW 10.3 environment that the migration utility creates two (2) datasources (sampleDS and samplePool). However, when clicking through the screens, I do not see how sampleDS refers to the samplePool out of the box from the migration utility. When I start the WebLogic domain with startWebLogic.cmd...here is the code to launch the actual DB instance:
    cd hsqldb
    start "Sample DB (HSQLDB)" %JAVA_HOME%\bin\java -classpath hsqldb.jar -Xms32m -Xmx128m org.hsqldb.Server -database sampleDB -port 15553 -silent false -trace false
    cd ..
    This works quite well and launches a window that has the following:
    | Sample DB (HSQLDB)
    | server.properties not found, using command line or default properties
    | Opening database: sampleDB
    | server.port =15553
    | server.database =sampleDB
    | server.silent =false
    | HSQLDB server 1.7.1 is running
    | Use SHUTDOWN to close normally, Use [CTRL] + [C] to abort abruptly
    | Wed Jun 16 10:18:48 EDT 2010 Listening for connections ...
    |_________________________________________________________
    This is the right screen and confirms my database is up and running and waiting for connections. Somehow, when I migrated from 8.1 to 10.3 something is not configured correctly and my sampleDS is not properly leveraging the samplePool. Can anyone shed any light on this problem?
    I have went through most of the posts and can not seem to understand what happens to the DS and Pools during the migration and specifically how do I reconnect the two to ensure that I can connect to the database. The app is up and running fine in WebLogic v10.3 but without the dB connection, I am stuck at the login screen.
    Thanks for any help...

  • User Level Vs. Application Level Authorization and Authentication for Container Managed Datasources (Oracle Connection Pools)

    Oracle Database Server 9i supports the usage of LABELS to enforce highly granular
    resource access restrictions at the database level independent of the application
    that is accessing it. In order to use this however, the particular user, and
    not just the application, accessing the database must be known. Oracle Application
    Server (Oracle's J2EE product line) solves this by providing the ability to PROXY
    the identity of the application user and creditials (SSL Certs for instance) down
    to the database server.
    I haven't seen a similar ability for BEA Weblogic Server 8.1 which allow the user
    identity and credientials to be PROXIED to the database server. Is this possible?
    Have I missed an important document?
    Thanks for any input,
    Raymond Tiong

    On 3 Feb 2004 12:51:26 -0800, Raymond Tiong <[email protected]> wrote:
    >
    Oracle Database Server 9i supports the usage of LABELS to enforce highly
    granular
    resource access restrictions at the database level independent of the
    application
    that is accessing it. In order to use this however, the particular
    user, and
    not just the application, accessing the database must be known. Oracle
    Application
    Server (Oracle's J2EE product line) solves this by providing the ability
    to PROXY
    the identity of the application user and creditials (SSL Certs for
    instance) down
    to the database server.
    I haven't seen a similar ability for BEA Weblogic Server 8.1 which allow
    the user
    identity and credientials to be PROXIED to the database server. Is this
    possible?
    Have I missed an important document?
    Thanks for any input,
    Raymond Tiong
    I think there is a section in the JDBC documentation for 8.1 which
    describes what it takes to utilize Oracle 9i extension called "Virtual
    Private Database". With this extension, one might be able to proxy the
    callers
    identity to the DB.
    See: http://e-docs.bea.com/wls/docs81/jdbc/thirdparty.html#1103627

  • Connection pool and datasource

    In WL 7, we need to configure a datasource and a connection pool in order for the application to get a connection to the database. How is the datasource and connection pool related?
    In WL 9.2, there is no option to configure the connection pool, there is only the option to configure the data source. Where did the connection pool go in WL 9.2?

    gerald lee wrote:
    In WL 7, we need to configure a datasource and a connection pool
    in order for the application to get a connection to the database.
    How is the datasource and connection pool related?
    It depends on the WLS version. pre-9.X, there can be more than one datasource pointing to a given pool,
    but you do need a datasource typically to use a pool.
    In WL 9.2, there is no option to configure the connection pool, there is only
    the option to configure the data source. Where did the connection pool go in WL 9.2?In 9.X and beyond the relationship is one-to-one, and you will create both at the
    same time when creating a datasource.
    Joe

  • DataSource & Connection pools

    Hi,
    I have a couple of question about DataSources and connection pools.
    1. Are DataSources & connection pools the same thing?
    2. Typically the data-sources.xml file, shows in plain text a user/name password combination. Isn't this a security risk? Can anything be done about this?
    thanks in advance,
    Kevin

    Hi Kevin --
    1. Are DataSources & connection pools the same thing?
    A DataSource enables the clean abstraction of the database connection details from the code.
    A DataSource has a name, and it provides you with access to connections via some configuration information it has (ie database host, port, sid, username/password). To get a connection, you first locate the datasource, and then ask it for a connection.
    Since the DataSource is now providing access to connections, you can get different types of DataSources that give you different behaviour. One example of this is a DataSource which supports connection pooling -- it will pool the connections for you. Some other datasources will support the use of container-managed-connections, which are used by EJB containers to support CMT.
    So while a DataSource can support connection pooling, the two are not synonomous.
    2. Typically the data-sources.xml file, shows in plain text a user/name password combination. Isn't this a security risk? Can anything be done about this?
    In the current production version and prior, the data-sources.xml file stored details in clear-text. Besides ensuring that the file has the correct level of OS priviliges set on it to ensure it can't be easily viewed, the only other workaround was to specify the username/password as parameters to the ds.getConnection() method. This puts the username/password back into the code so it breaks the concept of clean abstraction, but it was an option to avoid it being in the xml file.
    In our 904 release (available as a dev preview now on OTN) we support the use of password indirection for the passwords in this file. This enables you to specify a logcal name for a password, then create the actual user/password combination in our encrypted JAZN user repository. When the datasource is used, the container follows the indirection and retrives the password from the encrypted storage area.
    I'm pretty sure this is documented in the beta version of 904 J2EE Services Guide, see
    http://otn.oracle.com/tech/java/oc4j/904/doc_library/services-904-preview.pdf
    cheers
    -steve-

  • Connection pooling oc4j

    hi guys,
    I have a deployed application in OC4J (oracle 10g). My JSP needs connection pooling to the DB connection . right now i am uisng normal DB connection, which is not feasible for long term process.
    I had seen some of the mails/step by step process to implement and create Data soruce and Connection pooling examplesin forum & OTN but those examples and applications[b] which are accessing from outside the server.
    can you please provide the link or thread where i can get the example for datasource and connection pooling.

    It's always more helpful if you can provide more specific details about the version you are using -- 10g spans multiple releases.
    So basically you want to make use of a connection pool from your web app?
    The basic solution then is to create a DataSource on the OC4J instance, then lookup the datasource in the JSP and extract a connection from it to use. When you close the connection it will return to the pool maintained by the DataSource.
    Worth noting is that the DataSource/ConnectionPool implementation has changed a bit between the 10.1.2 and 10.1.3 releases, although the core principals remain the same.
    The documentation covers how to do this:
    10.1.2 doc: http://download-west.oracle.com/docs/cd/B14099_19/web.1012/b14012/datasrc.htm#sthref425
    10.1.3 doc: http://download-west.oracle.com/docs/cd/B31017_01/web.1013/b28958/datasrc.htm#BABIDCBJ
    10.1.3. How-To:
    http://www.oracle.com/technology/tech/java/oc4j/1013/howtos/how-to-datasource/doc/how-to-datasource.html
    Here's a link to a how-to that walks you through constructing and testing a datasource using the Application Server Control console.
    I wrote a blog posting a while back on how to lookup a datasource using the fully abstracted approach:
    http://buttso.blogspot.com/2006/06/datasource-lookup-using-javacompenv.html
    cheers
    -steve-

  • How do I expand my simple JSP page to implement Connection Pooling?

    Hi everyone,
    I have a small SQL database which contains information about Students and a StudenBean which contains their attributes and appropriate get/set methods (which I haven't needed to use yet).
    I want to write a simple JSP page which displays all the students details in one big table. I can do this using the basic prototyping method of adding the dataSource and driver details to the deployment descriptor (web.xml - I'm using the latest version of Tomcat by the way) and then accessing the database using JSP standard SQL actions.
    Here's a snipet of what I've done (just an example, the final code works):
    <sql:query var="temp"
    sql="SELECT * FROM Employee ORDER BY UserName"
    />
    <c:forEach items="${temp.rows}" var="row">
    <td><c:out value ="${row.UserName}"/></td>
    <td><c:out value ="${row.FirstName}"/></td>
    <td><c:out value ="${row.LastName}"/></td>
    Now I want to upgrade! I want to access the dataSource using Connection Pooling and it's causing me a lot of trouble. I already have the required working classes/data such as ConnectionPool.java, ResourceManagerListener.java, the MySQL driver etc.
    However, I don't know what the best way to setup the connection for my purposes would be and where I should do it.
    Do I need to write a servlet or tag handler/custom action to establish the connection and access my bean through it? I would like to keep a similar sort of business logic as I already have developed i.e. be able to use actions in my JSP page to cycle through the database and print out each detail from the row.
    Rather confused and muddled. Thanks for any input!

    Good idea.
    Set up a JNDI data source for your app, according to these docs:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    You'll have to put the right information into your web.xml and a context.xml. Once you've done that, your JSTL JSPs will simply use the connection resource automagically.
    MOD

  • NameNotFOundException in OC4J Connection Pool

    Hi,
    I am trying to implement connection pooling in OC4J.I modified the data-sources.xml file as follows:
    <!-- DataSource for Connection Pooling for MD Database -->
    <managed-data-source name="MDDS"
    connection-pool-name="SampleConnectionPool"
    jndi-name="jdbc/MDDS"/>
    <connection-pool name="SampleConnectionPool"
         min-connections="10"
         max-connections="100"
         inactivity-timeout="30">
    <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource"
    user="xxx"
    password="xxx"
    url="jdbc:oracle:thin:@//localhost:1521/zzz">
    </connection-factory>
    </connection-pool>
    My Java Coding is as follows:
    javax.naming.InitialContext ic = new javax.naming.InitialContext();
         javax.sql.DataSource dataSource = (javax.sql.DataSource)ic.lookup("jdbc/MDDS");
         con = dataSource.getConnection();
    While executing the above code,I am getting "javax.naming.NameNotFoundException : jdbc/MDDS not found..
    Am I missing any step?.Thanks.

    Have you restarted the container?

  • Creagting connection pools dynamically and bind with TxDataSource

              Hi!
              Is there a way I can create a dynamic connection pool and associate it to a DataSource
              using weblogic. I know I can't create a datasource dynamically, so are there
              any work arounds to bind the dynamically created connection pool to configured
              datasource.
              thanks,
              Srinivas
              

    Ken Yeung wrote:
    My application is required to support many different connections to different databases. I'll need to setup potentially hundreds of connection pools (and associated datasources). I was thinking of creating them dynamically through the app as needed.. but, wondering if I can get a way with creating all of them upfront (and setting the initial connections to 0). This way I can set all the database properties via WL console instead of hardcoding in the appl. I would like to know if there's a significant cost to creating datasources and connections pools upfront (even though they're initially not used). Please let me know how you would approach this. thanks.You can certainly create them ahead of time. No significant overhead from simply having
    the pools. However, if you set them up to do periodic refresh they will involve some cycles.

  • How to make Connection Pooling in JAVA

    Dear Members
    I want to know that how can i make connection pooling in java and also how can i use that pool in my jsp/servlet application.
    Plz Describe in Detail.
    Thanks
    Vasim

    vasim_saiyad2000 wrote:
    Dear Members
    I want to know that how can i make connection pooling in java and also how can i use that pool in my jsp/servlet application.
    Plz Describe in Detail.
    Thanks
    VasimAs the previous poster is trying to suggest, the server you use will have datasource and connection pooling support. so look up in the manual how to set it up, or do a google search. For example if you use Tomcat, look here:
    http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html

  • Tomcat connection pooling configuration

    I have configured the datasource with connection pool as per
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    All the required jar fles are in $CATALINA_HOME/common/lib.
    When I run my app,I am getting the following error even though commons-pool.jar file is there which contains GenericObjectPool.class file
    java.lang.NoSuchMethodError: org.apache.commons.pool.impl.GenericObjectPool: method <init>()V not found
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:652)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:403)
    Did anyone run into similar issue?
    Thanks

    I am running into this same issue at the moment.
    If you found the solution, it would be much appreciated if you could give me some insight into this problem.
    Thanks.

  • Dynamic datasources and connnection pools cont...

    sorry.. i got an error when replying to the original message..
    Thanks for the quick response. I'm assuming this applies to datasources as well. So, there's not much WL overhead with creating hundreds datasources and connection pools up front?
    Ken

    Ken Yeung wrote:
    sorry.. i got an error when replying to the original message..
    Thanks for the quick response. I'm assuming this applies to datasources as well. So, there's not much WL overhead with creating hundreds datasources and connection pools up front?
    Kencorrect.

  • Shall I use one datasource for multiple connection pool?

    Hi,
    I need to clarrify that, Shall I use one Datasource for multiple connection pool in distributed transaction?
    Thanks with regards
    Suresh

    No. If its transactions across multiple databases you should use different datasources.

Maybe you are looking for

  • Using a queue to increase buffer

    Hi, I am aquiring data from a 3 axis accelerometer, at a pretty high sampling rate, 10K. I have seen that "randomly" there are peaks in my data above what resonant frequency applitutes should be. The spikes are unreasonably big and almost never occur

  • Safari Java Date Implementation

    Dear, I'm having this very strange problem at work today concerning dates. It seems that any dates beyond the 28th of February 2034 are being miscalculated and this happens only in Safari. It seems that starting from this date, the system calculates

  • Recently opening an HTML file on my computer makes firefox attempt a search for the entire file name in the search engine online, how to do i correct that?

    when opening an HTML file recently my Firefox automatically opens up a yahoo search screen and the file, the entire file name and route for the file is searched for online. I don't even use Yahoo Search i use Google but that doesn't mater have to ope

  • Query on Planning WorkFlow Process

    Hi Guys, I have a query on Planning WorkFlow Process i.e Two Business Units are willing to do their Budgeting & Forecasting Process in different periods. I would like to bring first one process for this and I would like to grant access for these two

  • Custom images under weblayout

    Hi All I put some js, css and image files under the /ucm/cs/weblayout/resources/wcm/custom/ directory and should be accessible from my customized code. i.e. http://mydomain/cs/resources/wcm/custom/custom_js/custom_common.js However, these files are n