[OT] RE: Calling a datasource

2005-02-16 Thread Brian McGovern
Thanks for the reply.

-Original Message-
From: Erik Weber [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 16, 2005 10:34 AM
To: Struts Users Mailing List
Subject: Re: Calling a datasource


The resource-ref element in your web.xml file decouples the web app from 
the actual resource name (it gets mapped to whatever is specified in 
your server-specific JNDI configuration). As far as I know, you'll still 
need to hard-wire your app to whatever is in web.xml, but at least this 
way you are not hard-wiring it to a specific JNDI server's resource name.

Erik


Brian McGovern wrote:

>In my server config file I have a data resource "jdbc/MyData" and in my data 
>layer i call it like this.
>
>DataSource zDataSource = (javax.sql.DataSource)zContext.lookup("jdbc/MyData");
>
>This works, but I dont want to hardcode the jdbc name in the data class.  How 
>and where do I put this when I am not importing anything into the data class 
>besides data specific classes?
>
>Thanks
>-B
>
>  
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Calling a datasource

2005-02-16 Thread Erik Weber
The resource-ref element in your web.xml file decouples the web app from 
the actual resource name (it gets mapped to whatever is specified in 
your server-specific JNDI configuration). As far as I know, you'll still 
need to hard-wire your app to whatever is in web.xml, but at least this 
way you are not hard-wiring it to a specific JNDI server's resource name.

Erik
Brian McGovern wrote:
In my server config file I have a data resource "jdbc/MyData" and in my data 
layer i call it like this.
DataSource zDataSource = (javax.sql.DataSource)zContext.lookup("jdbc/MyData");
This works, but I dont want to hardcode the jdbc name in the data class.  How 
and where do I put this when I am not importing anything into the data class 
besides data specific classes?
Thanks
-B
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Calling a datasource

2005-02-16 Thread Jim Kennedy
There is a standard way to do this Brian, but this is not a Struts question.  
This is a Struts only list.


-Original Message-
From: Brian McGovern <[EMAIL PROTECTED]>
Sent: Feb 16, 2005 9:23 AM
To: Struts Users Mailing List 
Subject: Calling a datasource

In my server config file I have a data resource "jdbc/MyData" and in my data 
layer i call it like this.

DataSource zDataSource = (javax.sql.DataSource)zContext.lookup("jdbc/MyData");

This works, but I dont want to hardcode the jdbc name in the data class.  How 
and where do I put this when I am not importing anything into the data class 
besides data specific classes?

Thanks
-B


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Calling a datasource

2005-02-16 Thread Brian McGovern
In my server config file I have a data resource "jdbc/MyData" and in my data 
layer i call it like this.

DataSource zDataSource = (javax.sql.DataSource)zContext.lookup("jdbc/MyData");

This works, but I dont want to hardcode the jdbc name in the data class.  How 
and where do I put this when I am not importing anything into the data class 
besides data specific classes?

Thanks
-B