Categories

JAVA DATEBASE
Technology Network Community
Oracle Database
Fusion Middleware
Development Tools
Java
Desktop
Server & Storage Systems
Enterprise Management
Berkeley DB Family
Cloud Computing
Big Data
Business Intelligence
Architecture
Migration and Modernization
E-Business Suite
Siebel
PeopleSoft Enterprise
JD Edwards World
Industries
JD Edwards EnterpriseOne
User Productivity Kit Pro (UPK) and Tutor
Governance, Risk & Compliance (GRC)
Master Data Management (MDM)
Oracle CRM On Demand
On Demand: SaaS and Managed Applications
AutoVue Enterprise Visualization
Primavera
ATG
Agile PLM
Endeca Experience Management
Fusion Applications
Archived Forums

 



Tags

New To Java


Connection pools and JDBC resources


What is the difference between connection pool and a JDBC resource  When I create connection pool - what do I Create -  - a connection to a Database server or  - a connection to distinct database on this database server ?  Can I for example create connection to MySql-server as connection pool and then create a couple of JDBC resources, each of them will be representation of some databse on that server?  When I create a JDBC resource, I can define for it only JNDi name and Connection pools, but how can I define the name of database, wich will be referred by this JDBC resource?

What is the difference between connection pool and a JDBC resource  A data source can be a relational database, an XML data stream, a flat file, or anything else.  Consider it to be an abstraction.  A connection pool makes me think of a pool of JDBC resources that are checked in and out as needed like a library.      When I create connection pool - what do I Create -  - a connection to a Database server or  - a connection to distinct database on this database server ?  Usually it means a connection to a distinct database when I do it.    Can I for example create connection to MySql-server as connection pool and then create a couple of JDBC resources, each of them will be representation of some databse on that server?  You'd create a connection pool for each database your app needs to talk to.    only JNDi name and Connection pools, but how can I define the name of database, wich will be referred by this JDBC resource?  Depends on the app server you're using.  If it's Tomcat, you specify the driver, URL, etc. in context XML for your app.  You can also use the admin console.    %

Why do I need then create a couple of JDBC resources that reference the same connection pool? When can this be reasonable?  I saw in J2EE tutorials, that different applications use different JDBC resources, but they all (JDBC resources) reference the same connection pool

Sounds like one pool is managing connections to several databases.  I'd have to see exactly what you mean to understand.  %

For example, if you read through the J2EE tutorial, you'll see, that 2 JDBC resources are created for similar examples. One is named jdbc/BookDB(Chapters 11-21) and another - jdbc/ejbTutorialDB (chapters 23-28). They both reference connection pool named PointBasePool. The definition of PointBasePool was not changed from one chapter to other. It points to Database "jdbc:pointbase:server://localhost:9092/sun-appserv-samples"  Why do we need such a situation? How would you explain this?  Thanx in advance for your answer.

. One is named jdbc/BookDB(Chapters 11-21) and another - jdbc/ejbTutorialDB (chapters 23-28). They both reference connection pool named PointBasePool. The definition of PointBasePool was not changed from one chapter to other. It points to Database "jdbc:pointbase:server://localhost:9092/sun-appserv-sa mples"  In which case one would be sufficient.  IMO, they are just different JNDI named resources pointing to the same resource (which is a connection pool in this case) A simple test would be to use it interchangeably and check if you get the same desired behaviour.  Duffy,  Sounds like one pool is managing connections to several databases.  just curious, is this possible ?  cheers, ram.   Why do we need such a situation? How would you explain this? IMO, you woudnt need. The same jndi resource can be looked from  a servlet/java beans/ejbs.

Duffy,  Sounds like one pool is managing connections to several databases.  just curious, is this possible ?   Hi Ram,  I think this is your polite way of saying "Duffy, you're full of it here."  After reading it again, I don't think it's possible for a pool to manage connections to several databases.  It goes against the whole notion of a pool - every instance isn't equal.  I think I wrote that because the OP's original description made it sound like that's what was going on.  I'll have to admit that I'd never heard of such a thing, so I commented out of ignorance.  %

Actually, I use SQL Server for my backend and I have my pool connect to the server, not a particular database. I even use complex joins that join data from a table in one database with data in another table in an entirely different database. This is needed as I'm providing web utilities that reads and writes data to two distinctly different applciation databases at once.  When referencing a table this way, I simply need to use the format Database.owner.table vs. just using the table name.


Related Links

Changing the Frame title via Textfield
Newbie to Java
HELP!! Need to find out somebody's age.
Please Help Me!! I'm New and don't know where to start!
I want the Solution
Help
Little help?
transparent frame/window
i just want to access a class variable...dont want it to be static
assignment
information regarding storing text into a file as binary data ie. 1's and 0
Runtime exec()... help...???
ArrayIndexOutOfBoundsExcept
Urgent Help Needed
what am i doing wrong?
Test String Contents