Re: Question about a sample Application

2007-10-29 Thread Viet Nguyen
On 10/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi , we are working on the geronimo one project. We were looking at a
> sample application that connects to the database in geronimo . Upone
> studying it we stumbled upon a syntax that has a little confused
>
> In your DBManager.java for the inventory application we found this line of
> code.
>
> DataSource ds =
> (DataSource)context.lookup("java:comp/env/jdbc/InventoryDS");


The parameter represents the JNDI name of a datasource. Once you deploy the
application, go to the Administration Console, then click on "JNDI Viewer"
on the left panel. It will show you a tree of the JNDI names.

We know what the function does . We just don't know what the parameter
> represents. Which part of the parameter represents the database we are
> connecting to? We need to know the nature of the parameter so that we can
> use it in our own application.


The parameter does not specify which DB you are connecting to. What it does,
is specify which DataSource you wish to use. The DataSource will specify
which DB to connect to. So it's

YourApp --> DataSource --> Database

The DataSource is defined by 'InventoryPool.xml.'

Hope this helps,
Viet


Re: Question about a sample Application

2007-10-29 Thread Prasad Kashyap
#1. The example asks you to create a DB named InventoryDB and then run
some sql commands to create tables.

#2. Your web.xml has a resource ref to jdbc/InventoryDS. This is a
part of the jndi name of the datasource (not database).

#3. The geronimo-web.xml links your jdbc/InventoryDS with the
datasource's name called InventoryPool.

#4. Then the InventoryPool.xml which is the alt-DD for the RA links
the InventoryPool datasource with the InventoryDB you created in #1.
http://svn.apache.org/viewvc/geronimo/samples/trunk/samples/inventory/inventory-ear/src/main/resources/InventoryPool.xml?view=markup

For further reading, check out this link
http://localhost:8080/console/portal//Services/Database%20Pools/__pm0x3system-database0x2DBWizard!1134683811%7C0_view/__rp0x3system-database0x2DBWizard!1134683811%7C0_name/InventoryPool/__rp0x3system-database0x2DBWizard!1134683811%7C0_mode/usage/__rp0x3system-database0x2DBWizard!1134683811%7C0_abstractName/org0x2apache0x2geronimo0x2samples0x3inventory-ear0x320x20-SNAPSHOT0x3ear0xaJ2EEApplication=org0x2apache0x2geronimo0x2samples0x3inventory-ear0x320x20-SNAPSHOT0x3ear,JCAConnectionFactory=InventoryPool,JCAResource=tranql-connector-ra-10x230x2rar,ResourceAdapter=tranql-connector-ra-10x230x2rar,ResourceAdapterModule=tranql-connector-ra-10x230x2rar,j2eeType=JCAManagedConnectionFactory,name=InventoryPool

This is the usage link for the InventoryPool under "Database Pools"
navigational link. If you have deployed the Inventory app, you will
see this link too.

Hope this helps

Cheers
Prasad

On 10/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi , we are working on the geronimo one project. We were looking at a
> sample application that connects to the database in geronimo . Upone
> studying it we stumbled upon a syntax that has a little confused
>
> In your DBManager.java for the inventory application we found this line of
> code.
>
> DataSource ds =
>  (DataSource)context.lookup("java:comp/env/jdbc/InventoryDS");
>
> We know what the function does . We just don't know what the parameter
> represents. Which part of the parameter represents the database we are
> connecting to? We need to know the nature of the parameter so that we can
> use it in our own application.
>
>
>


Question about a sample Application

2007-10-29 Thread joanyanw
Hi , we are working on the geronimo one project. We were looking at a
sample application that connects to the database in geronimo . Upone
studying it we stumbled upon a syntax that has a little confused

In your DBManager.java for the inventory application we found this line of
code.

DataSource ds =
 (DataSource)context.lookup("java:comp/env/jdbc/InventoryDS");

We know what the function does . We just don't know what the parameter
represents. Which part of the parameter represents the database we are
connecting to? We need to know the nature of the parameter so that we can
use it in our own application.