Article View: borland.public.jbuilder.database
Article #413Re: Help with JNDI Datasource in JBuilder 2006
From: Paul Furbacher [TeamB]
Date: Tue, 29 Nov 2005 05:11
Date: Tue, 29 Nov 2005 05:11
91 lines
4656 bytes
4656 bytes
Tom Butler wrote:
> Need help getting JNDI MySQL database source setup correctly within JBuilder
> 2006 to support a JSF application. I am able to access the database using
> a non-JNDI based approach, and, I was also able to get JNDI to work outside
> of JBuilder 2006 using the configuration described below.
>
> I am using the following tomcat documentation as a guide:
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
>
> I have looked through a number of posts and examples, but at this point
> (after many non-frutile hours) need someone with experience to help me to
> get the configuration correct.
>
> 1. Install JDBC Driver
> * have 'mysql-connector-java-3.1.11-bin.jar' installed to
> /myapp/webmodule/WEB-INF/lib
No, you don't manage this; JBuilder does. As noted five
gazillion times in these newsgroups, you create a JBuilder
library (see JBuilder Help if you don't know how to do this)
and add it to your project. You configure your Web Module to
copy all resources. Read the JBuilder Help on developing
Web apps and all about Web Module configuration. Note the
Content > Dependencies page in the Web Module properties
dialog. (By default, your "required libraries" are set to
"Include all" which is what you want.) Use the samples/jsf/
Tomcat/bookstore.jpx Web module as a learning tool.
> * also have JDBC driver installed to
> /JBuilder2006/thirdparty/jakarta-tomcat-5.5.9/common/lib (this was done as a
> troubleshooting step though; prefer to only install this within the project
> directory)
No, don't put the driver lib in the thirdparty dirs.
>
> 2. Declare your Resource Requirements
> * following code included in web.xml within project:
> /myapp/webmodule/WEB-INF/web.xml
> <resource-ref>
> <description>MySQL DB Connection</description>
> <res-ref-name>jdbc/mysql</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
This is correct.
> [...]
> 4. Configure Tomcat's Resource Factory
> * context.xml contents located at:
> /JBuilder2006/thirdparty/jakarta-tomcat-5.5.9/conf/context.xml
> [...]
JBuilder manages Tomcat runs, so I doubt that monkeying
with the thirdparty directory XML files will get you where
you want to go. In general, don't touch those.
> [...]
> ANY SUGGESTIONS?
> * Do I need anything specified in the server.xml file?
Yes, isn't that the place where you generally place the
resource definition? I just opened up the JBuilder/samples/
jsf/Tomcat/bookstore.jpx and tested using Tomcat 5.5. Do
this yourself, and run the "Server" runtime config. Then
while the Web app is running, do a "File open" in JBuilder,
navigate to the "Project" dir via the "Favorites" panel
on the left. Click on the "Tomcat/conf" dir, and open
the server8080.xml file. From here on in, I'll ask you
to do some research: following the generously available
instructions in the newsgroup archives on editing "server8080.xml"
(search keywords "edit server8080 tomcat"), edit the file, adding
your <Resource ...> definition.
--
Paul Furbacher (TeamB)
Save time, search the archives:
http://info.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
Technical Details
Message-ID:
<438be2d7$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed2.newsreader.com!newsreader.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<438a4e03$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1073da,634e789a0dc75d45 X-Google-Attributes: gid1073da,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 29 Nov 2005 00:11:25 -0500 From: "Paul Furbacher [TeamB]" <pfurbacher@mac.com> Organization: Reverse Alchemy, Inc. User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.database Subject: Re: Help with JNDI Datasource in JBuilder 2006 References: <438a4e03$1@newsgroups.borland.com> In-Reply-To: <438a4e03$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.142.194.228 Message-ID: <438be2d7$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1133241047 69.142.194.228 (28 Nov 2005 21:10:47 -0700) Lines: 91 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed2.newsreader.com!newsreader.com!nx01.iad01.newshosting.com!newshosting.com!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail