Re: JNDI Datasource question

2002-12-02 Thread Ron Smits
Jake,

thanks, this is a great answer and answers my question exactly. :)
Especially the "META-INF/context.xml". was somthing that I must have
overlooked 

Ron

On Mon, 2002-12-02 at 11:09, Jacob Kjome wrote:
> 
> Hi Ron,
> 
> That is referring to a context configuration file.  You *always* need to 
> set up your DataSources through the proprietary server configuration.  The 
> stuff in the web.xml only defines the interface.  For instance, if you set 
> up DBCP specific stuff in the web.xml file, your app would be dependent on 
> running under Tomcat and be incompatible with every other app server.  JNDI 
> is meant to provide a standard interface while allowing the vendor to 
> provide a proprietary implementation.  That way, you get to code to a 
> standard and you get to pick the vendor who provides the best 
> implementation (by your own definition).  That provides for both standards 
> *and* market competition.  Neat, eh?
> 
> See the following for context configuration files:
> 
>http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html#Automatic%20Application%20Deployment
> 
> Also, look at admin.xml and manager.xml in CATALINA_HOME/webapps for reference.
> 
> I addition, Craig R. McClanahan pointed out the following when deploying 
> via the manager app:
> 
> 
> For the deploy command, simply include your context confgiuration file in
> the WAR at "META-INF/context.xml".
> 
> In Tomcat 4.1, you can dynamically deploy a "context configuration file"
> instead of, or along with your webapp.  Such a file can contain the
>  element, and all nested subelements, from what you would
> normally put in server.xml, so you can indeed dynamically deploy an app
> with a custom realm.
> 
> 
> Jake



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: JNDI Datasource question

2002-12-01 Thread Jacob Kjome

Hi Ron,

That is referring to a context configuration file.  You *always* need to 
set up your DataSources through the proprietary server configuration.  The 
stuff in the web.xml only defines the interface.  For instance, if you set 
up DBCP specific stuff in the web.xml file, your app would be dependent on 
running under Tomcat and be incompatible with every other app server.  JNDI 
is meant to provide a standard interface while allowing the vendor to 
provide a proprietary implementation.  That way, you get to code to a 
standard and you get to pick the vendor who provides the best 
implementation (by your own definition).  That provides for both standards 
*and* market competition.  Neat, eh?

See the following for context configuration files:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html#Automatic%20Application%20Deployment

Also, look at admin.xml and manager.xml in CATALINA_HOME/webapps for reference.

I addition, Craig R. McClanahan pointed out the following when deploying 
via the manager app:


For the deploy command, simply include your context confgiuration file in
the WAR at "META-INF/context.xml".

In Tomcat 4.1, you can dynamically deploy a "context configuration file"
instead of, or along with your webapp.  Such a file can contain the
 element, and all nested subelements, from what you would
normally put in server.xml, so you can indeed dynamically deploy an app
with a custom realm.


Jake

At 10:02 PM 12/1/2002 +0100, you wrote:
Evening

A question to grow my knowledge:)

On tomcat 4.1.12-LE-jdk14 deployment with java jsdk 1.4.1_01-b01 I have
installed the two missing jar files from commons (dbcp and pool) and
made the example from the documentation (/DBTest) work. Great work, well
written and very clear.

So my question. If I want to use DataSources I always need to change or
add Contect (or defaultContext) in the conf/server.xml? According to the
documentation I can define a Resource as:

  ...
  
  ...


in server.xml or as

  Employees Database for HR Applications
  jdbc/EmployeeDB
  javax.sql.DataSource
  Container


int web.xml of an application that is deployed. But where to I put all
the values named in the ResourceParams entries if I want to declare them
from the web.xml file?

Ron




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 



JNDI Datasource question

2002-12-01 Thread Ron Smits
Evening

A question to grow my knowledge:)

On tomcat 4.1.12-LE-jdk14 deployment with java jsdk 1.4.1_01-b01 I have
installed the two missing jar files from commons (dbcp and pool) and
made the example from the documentation (/DBTest) work. Great work, well
written and very clear.

So my question. If I want to use DataSources I always need to change or
add Contect (or defaultContext) in the conf/server.xml? According to the
documentation I can define a Resource as:

  ...
  
  ...


in server.xml or as 

  Employees Database for HR Applications
  jdbc/EmployeeDB
  javax.sql.DataSource
  Container


int web.xml of an application that is deployed. But where to I put all
the values named in the ResourceParams entries if I want to declare them
from the web.xml file?

Ron




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: JNDI DataSource Question

2001-12-14 Thread Micael Padraig Og mac Grene

At 07:07 PM 12/14/01 +, you wrote:
>Hi,
>
>Thankyou for the mail.
>
>my datasource is sitting on the local computer and I can connect with a 
>normal JDBC Connection. The same driver properties I use to create a 
>datasource in server.xml and it fails.
>
>I thought it can be a problem like Tomcat failing if we have the 
>servlet.jar in /lib/ext, so I cleaned it out.
>
>Any pointers?
>
>Krishna.


I hate to ask silly questions, but because you provide no details, I have 
to guess.  You are using javax, right?

-- micael


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: JNDI DataSource Question

2001-12-14 Thread Micael Padraig Og mac Grene

At 07:07 PM 12/14/01 +, you wrote:
>Hi,
>
>Thankyou for the mail.
>
>my datasource is sitting on the local computer and I can connect with a 
>normal JDBC Connection. The same driver properties I use to create a 
>datasource in server.xml and it fails.
>
>I thought it can be a problem like Tomcat failing if we have the 
>servlet.jar in /lib/ext, so I cleaned it out.
>
>Any pointers?
>
>Krishna.
>
>


You did not really provide any information that I do not have to guess 
at.  Where are the files?  What does server.xml say?  What do you have in 
web.xml?  I use, in relevant part, for example:


 ...
  
  setup
  SetupServlet
  
  jdbcDriver
  org.postgresql.Driver
  

  
  jdbcURL
  
jdbc:postgresql://localhost:5432/username/param-value>
  

  
  jdbcUser
  username
  

  
  jdbcPwd
  password
  

  
  


And, I have:
public class PostgresqlConnection {
 private Connection conn;
 private String user;
 private String password;

 public Connection getConnection(String user, String password) throws 
ClassNotFoundException, SQLException {
 Class.forName("org.postgresql.Driver");
 PostgresqlDataSource dataSource = new PostgresqlDataSource();
 conn = dataSource.getConnection(user, password);
 return conn;
 }
}

I have the javax.sql.* stuff in /lib/ext.  Mine works fine.

-- micael


Re: JNDI DataSource Question

2001-12-14 Thread Bhamidi Krishna

Hi,

Thankyou for the mail.

my datasource is sitting on the local computer and I can connect with a 
normal JDBC Connection. The same driver properties I use to create a 
datasource in server.xml and it fails.

I thought it can be a problem like Tomcat failing if we have the servlet.jar 
in /lib/ext, so I cleaned it out.

Any pointers?

Krishna.




_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: JNDI DataSource Question

2001-12-14 Thread Micael Padraig Og mac Grene

At 01:34 PM 12/14/01 +, you wrote:
>Hi,
>
>I had posted this question some time back and am posting just in case some 
>one may have just missed it.
>
>I am trying to get a JNDI connection to a datasource. For this I defined 
>my datasource exactly as it is described in the Tomcat docs - define a 
>resource in WEB.XML and in SERVER.XML
>
>When I try to connect, my context keeps returning me a NULL DataSource. I 
>read thru all of the mails in the list, I could not get any definite pointers.
>
>Can someone who has solved the problem, please point me in the right 
>direction.
>
>Thankyou for the time,
>Krishna.
>

Your problem inevitably has to be that your code is referencing something 
that is not being found.  That leaves two potential problems: (1) you don't 
have your data source from your service provider in the right place; (2) 
you don't have a reference as required to where you have the 
datasource.  If you have the data source in the right place, there should 
be a default reference, so (1) is probably it.  Where do you have the data 
source sitting?

-- micael


--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




JNDI DataSource Question

2001-12-14 Thread Bhamidi Krishna

Hi,

I had posted this question some time back and am posting just in case some 
one may have just missed it.

I am trying to get a JNDI connection to a datasource. For this I defined my 
datasource exactly as it is described in the Tomcat docs - define a resource 
in WEB.XML and in SERVER.XML

When I try to connect, my context keeps returning me a NULL DataSource. I 
read thru all of the mails in the list, I could not get any definite 
pointers.

Can someone who has solved the problem, please point me in the right 
direction.

Thankyou for the time,
Krishna.




_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe:   
For additional commands: 
Troubles with the list: