Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 3995 invoked from network); 30 Oct 2007 05:11:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Oct 2007 05:11:37 -0000 Received: (qmail 68517 invoked by uid 500); 30 Oct 2007 05:11:24 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 67985 invoked by uid 500); 30 Oct 2007 05:11:23 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Delivered-To: moderator for dev@geronimo.apache.org Received: (qmail 95067 invoked by uid 99); 30 Oct 2007 03:34:41 -0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of vhnguy2@gmail.com designates 64.233.182.191 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=lgh3E4oQbe2p01X+inUIGs7ChB05Xx03N5ZOc8uY1jA=; b=Foc/gOoWhlXAoBb7PDijC88LSzYsprEC9AEmz6x9HyCTWuoNF0jNBX12CIunsNVSWaClb9oejuiizmXCR/om76eDWAshiv8f5fgaSkdRskk/mP2TzWK6n9Ci/WdikWTwHkwyrRfZmcNZ20Ij+BEOaax0lZzTBBuiwmqU8mNCGE8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=uusksMdc/DDsL/lIC7QNXfLXX6BEn2DslmWPnBLV5m6FmdOgwAUkpNVGdV1bNn07TsaoBZGTfLSSr5cm/wtAWtqB26uQd592WjvEmtOZ9p4SvY5tlWGTcEd9aXgAmng5gRVWKGus4kQJC61IbpJvMURlM1jSouSSDjLV4a7kCQY= Message-ID: Date: Mon, 29 Oct 2007 23:34:21 -0400 From: "Viet Nguyen" To: dev@geronimo.apache.org Subject: Re: Question about a sample Application In-Reply-To: <51938.152.7.193.152.1193705616.squirrel@webmail.ncsu.edu> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_534_27451405.1193715261287" References: <51938.152.7.193.152.1193705616.squirrel@webmail.ncsu.edu> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_534_27451405.1193715261287 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/29/07, joanyanw@ncsu.edu 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 ------=_Part_534_27451405.1193715261287 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

On 10/29/07, joanyanw@ncsu.edu <joanyanw@ncsu.edu> 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


------=_Part_534_27451405.1193715261287--