The Artima Developer Community
Sponsored Link

Java Answers Forum
specifying dsn as a jndi resource in jsp/struts

4 replies on 1 page. Most recent reply: Oct 13, 2005 9:48 PM by Tapan kumar Rath

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Tapan kumar Rath

Posts: 18
Nickname: papuni
Registered: Sep, 2005

specifying dsn as a jndi resource in jsp/struts Posted: Oct 10, 2005 2:00 AM
Reply to this message Reply
Advertisement
hi
I am a newbie
My problem is specifying a dsn for my mvc compliant application.I am ussing tomcat 5.0.When I make configuration changes in server.xml file it works.But when I want to deploy the same application I need access to server.xml file.I have registered for a domain name.All help they would give is that they will create or will avail the control panel tool to create a dsn.If my dsn is not a jndi resource then I can connect to database using plain jdbc.(e.g Using DriverManager,Connection class).What I want is that my application should be purely mvc compliant and it should use datasource as a jndi resource.What is the solution and how should I approach the people giving me space and domain name on their server.
Please answer.


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: specifying dsn as a jndi resource in jsp/struts Posted: Oct 10, 2005 5:18 AM
Reply to this message Reply
If you are a Newbie I'd suggest you start off with a J2EE tutorial.

Tomcat is a webserver I don't know if it actually deploys applications.
Hence you will need something like JBoss - an application Server.
You will define your connections via a deployment descriptor - the
short of it is that you require to familiarize you self with J2EE.

If connecting with pure JDBC, you probably need to create a connection
Pool - I have a similar personal project, and have chosen this approach
coz I kept losing connections.

Anyways, odds are I haven't cleared much air but that's the direction I'd
take if I wanted to tackle such a problem.

p/s: I believe what you are referring to is DNS and not DSN. Also
familiarize yourself with the DataSource API (JDBC), that should help.

Good luck,
Kondwani

Tapan kumar Rath

Posts: 18
Nickname: papuni
Registered: Sep, 2005

Re: specifying dsn as a jndi resource in jsp/struts Posted: Oct 11, 2005 9:29 PM
Reply to this message Reply
Thanks spike.
I have followed what is given as an example in tomcat documentation and created the datasource as a jndi resource.The place where I want to host my application runs a tomcat webserver.My purpose is that my application should use dbcp.Since I have followed what is given in the tomcat documentation I am able to run my application at home.But I need to run it on their web server and they would not give me access to the server.xml file.So please specify a way to do it or send some links where I can find the answer.I have searched a lot but not found a good solution.
Lastly thanks in advance ...

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: specifying dsn as a jndi resource in jsp/struts Posted: Oct 11, 2005 11:17 PM
Reply to this message Reply
Hi there:

Sorry I'm not in my sharpest witts in the mornings
so clarify it for me again... You have what type
of an application? You are trying to connect to
a database being hosted by someone else (am I correct)?

If its simply your application trying to connect to
a remote database, all you need to do is learn exactly
what type of a database they are running, and download
the appropriate driver for that database (mysql,
postgresql or whatever) and Jar it with you application
- remember to include class loaders to load the driver.

I'm sure I got the question all wrong, but as I said
its 8am, please clarify a bit more and if I have the
answer, I'd be glad to respond - or hopefully someone
else will.

Kondwa

Tapan kumar Rath

Posts: 18
Nickname: papuni
Registered: Sep, 2005

Re: specifying dsn as a jndi resource in jsp/struts Posted: Oct 13, 2005 9:48 PM
Reply to this message Reply
Hi
I got the soln.I have put the data source declaration in
struts-config.xml. It's working.Though this is not what I wanted.Anyways thanks spike.

Flat View: This topic has 4 replies on 1 page
Topic: Java 7?? - Dolphin?? Previous Topic   Next Topic Topic: a question about clone()

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use