You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by muhammed soyer <mu...@ges.net.tr> on 2004/09/06 08:12:51 UTC

Using JDBC Data source from a business class

Hello,
    I defined a JDBC data source in tomcats server.xml  .I add a context line in the web applications webapp.xml file .
My servlets are using the ds without a problem ..But I have some classes which are POJO classes to make my job easier whie accessing the DB ..these classes couldnt use my JDBC definition ..As I guess its from context problems ..But I couldnt solve the problem ..

What should I do to use tomcat's ds from a POJO class ?

thnx 

-ms

Re: Using JDBC Data source from a business class

Posted by Peng Tuck Kwok <pe...@gmail.com>.
Adding to this, you could also supply a context.xml seperately  with
the war file when you deploy the app, this is optional.


On Mon, 6 Sep 2004 06:07:18 -0500, Keith Bottner <kb...@comcast.net> wrote:
> The context.xml file is under your WebRoot/META-INF directory. When you
> application is deployed it gets copied to the conf/Catalina/[host name]/
> directory then renamed to be the same as your web application. (Which BTW,
> if it is NOT being copied could also be part of the problem). 5.0.27 has a
> problem on Windows doing the copy so you have to do it manually, I believe
> it has been fixed in 5.0.28.
> 
> Keith
> 
> 
> 
> -----Original Message-----
> From: muhammed soyer [mailto:muhammed@ges.net.tr]
> Sent: Monday, September 06, 2004 5:58 AM
> To: Tomcat Users List
> Subject: Re: Using JDBC Data source from a business class
> 
> Hello
> 
>     Where is this context.xml file .should I create a file in web-inf
> directory named context.xml . I put a ResourceLink line in my webapp.xml
> files which is at "jakarta-tomcat-5.0.28/conf/Catalina/localhost"
> 
> -ms
> ----- Original Message -----
> From: "Keith Bottner" <kb...@comcast.net>
> To: "'Tomcat Users List'" <to...@jakarta.apache.org>
> Sent: Monday, September 06, 2004 1:48 PM
> Subject: RE: Using JDBC Data source from a business class
> 
> I believe you also need an entry in your web.xml file that looks something
> like this (obviously changed for your DB settings).
> 
> <resource-ref>
> <description>postgreSQL Datasource</description>
> <res-ref-name>jdbc/postgres</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
> 
> You also need the ResourceLink entry in your context.xml
> 
> <ResourceLink name="jdbc/database" global="jdbc/postgres"
> type="javax.sql.DataSource" />
> 
> I use JNDI to retrieve the DB connection with
> 
> private static final String JNDI_CONTEXT = "java:comp/env"; private static
> final String DATASOURCE_DB_NAME = "jdbc/database";
> 
> try
> {
> Context initCtx = new InitialContext();
> Context envCtx = (Context)
> initCtx.lookup(JNDI_CONTEXT);
> datasource = (DataSource)
> envCtx.lookup(DATASOURCE_DB_NAME);
> }
> catch ( NamingException e )
> {
> if ( log.isEnabledFor(Level.ERROR) ) log.error(sm.getString("DAO.creation"),
> e); }
> 
> Hope that helps.
> 
> Keith
> -----Original Message-----
> From: muhammed soyer [mailto:muhammed@ges.net.tr]
> Sent: Monday, September 06, 2004 5:06 AM
> To: Peng Tuck Kwok; Tomcat Users List
> Subject: Re: Using JDBC Data source from a business class
> 
> For my web applications(servlets) I add the following lines  in the
> webapp.xml .For my classes what should I do ..These classes is not directly
> called from the browser .My JSP files use them ..
> 
> <ResourceLink name="jdbc/gp" type="javax.sql.DataSource" global="jdbc/gp"/>
> <Resource type="javax.sql.DataSource" description="Oracle Datasource
> example" auth="Container" name="jdbc/gp"/>
> 
> -ms
> ----- Original Message -----
> From: "Peng Tuck Kwok" <pe...@gmail.com>
> To: "muhammed soyer" <mu...@ges.net.tr>
> Sent: Monday, September 06, 2004 12:11 PM
> Subject: Re: Using JDBC Data source from a business class
> 
> You should be able to access the datasource from your classes.  You said
> earlier you had problems doing so, could you describe the problems ?
> 
> On Mon, 6 Sep 2004 11:31:04 +0300, muhammed soyer <mu...@ges.net.tr>
> wrote:
> > Yes they are in my web-inf/classes directory .I use them to do my db
> > jobs ..from jsp pages .. these classes access db .so I want to make
> > them use Tomcats conneciton pooling machanism . I can do this from
> > servlets ..
> >
> > -ms
> >
> > ----- Original Message -----
> > From: "Peng Tuck Kwok" <pe...@gmail.com>
> > To: "Tomcat Users List" <to...@jakarta.apache.org>
> > Sent: Monday, September 06, 2004 10:44 AM
> > Subject: Re: Using JDBC Data source from a business class
> >
> > On Mon, 6 Sep 2004 09:12:51 +0300, muhammed soyer
> > <mu...@ges.net.tr>
> > wrote:
> >
> > > My servlets are using the ds without a problem ..But I have some
> > > classes
> > which are >POJO classes to make my job easier whie accessing the DB
> ..these
> > classes couldnt use > my JDBC definition ..As I guess its from context
> > problems ..But I couldnt solve the >problem
> >
> > What's the exact problem? You don't exactly say where your POJO
> > classes are, so I assume they are in your webapp right, then it should
> > be ok.
> >
> > >
> > > What should I do to use tomcat's ds from a POJO class ?
> > >
> > > thnx
> > >
> > > -ms
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> > << Bu mail GESNET sunucusu tarafindan virus kontrolunden
> > gecirilmistir.>>
> >
> >
> 
> << Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> << Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Using JDBC Data source from a business class

Posted by Keith Bottner <kb...@comcast.net>.
The context.xml file is under your WebRoot/META-INF directory. When you
application is deployed it gets copied to the conf/Catalina/[host name]/
directory then renamed to be the same as your web application. (Which BTW,
if it is NOT being copied could also be part of the problem). 5.0.27 has a
problem on Windows doing the copy so you have to do it manually, I believe
it has been fixed in 5.0.28.

Keith

-----Original Message-----
From: muhammed soyer [mailto:muhammed@ges.net.tr] 
Sent: Monday, September 06, 2004 5:58 AM
To: Tomcat Users List
Subject: Re: Using JDBC Data source from a business class


Hello

    Where is this context.xml file .should I create a file in web-inf
directory named context.xml . I put a ResourceLink line in my webapp.xml
files which is at "jakarta-tomcat-5.0.28/conf/Catalina/localhost"


-ms
----- Original Message ----- 
From: "Keith Bottner" <kb...@comcast.net>
To: "'Tomcat Users List'" <to...@jakarta.apache.org>
Sent: Monday, September 06, 2004 1:48 PM
Subject: RE: Using JDBC Data source from a business class


I believe you also need an entry in your web.xml file that looks something
like this (obviously changed for your DB settings).

<resource-ref>
<description>postgreSQL Datasource</description>
<res-ref-name>jdbc/postgres</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

You also need the ResourceLink entry in your context.xml

<ResourceLink name="jdbc/database" global="jdbc/postgres"
type="javax.sql.DataSource" />

I use JNDI to retrieve the DB connection with

private static final String JNDI_CONTEXT = "java:comp/env"; private static
final String DATASOURCE_DB_NAME = "jdbc/database";

try
{
Context initCtx = new InitialContext();
Context envCtx = (Context)
initCtx.lookup(JNDI_CONTEXT);
datasource = (DataSource)
envCtx.lookup(DATASOURCE_DB_NAME);
}
catch ( NamingException e )
{
if ( log.isEnabledFor(Level.ERROR) ) log.error(sm.getString("DAO.creation"),
e); }


Hope that helps.

Keith
-----Original Message-----
From: muhammed soyer [mailto:muhammed@ges.net.tr]
Sent: Monday, September 06, 2004 5:06 AM
To: Peng Tuck Kwok; Tomcat Users List
Subject: Re: Using JDBC Data source from a business class


For my web applications(servlets) I add the following lines  in the
webapp.xml .For my classes what should I do ..These classes is not directly
called from the browser .My JSP files use them ..


<ResourceLink name="jdbc/gp" type="javax.sql.DataSource" global="jdbc/gp"/>
<Resource type="javax.sql.DataSource" description="Oracle Datasource
example" auth="Container" name="jdbc/gp"/>


-ms
----- Original Message ----- 
From: "Peng Tuck Kwok" <pe...@gmail.com>
To: "muhammed soyer" <mu...@ges.net.tr>
Sent: Monday, September 06, 2004 12:11 PM
Subject: Re: Using JDBC Data source from a business class


You should be able to access the datasource from your classes.  You said
earlier you had problems doing so, could you describe the problems ?


On Mon, 6 Sep 2004 11:31:04 +0300, muhammed soyer <mu...@ges.net.tr>
wrote:
> Yes they are in my web-inf/classes directory .I use them to do my db 
> jobs ..from jsp pages .. these classes access db .so I want to make 
> them use Tomcats conneciton pooling machanism . I can do this from 
> servlets ..
>
> -ms
>
> ----- Original Message -----
> From: "Peng Tuck Kwok" <pe...@gmail.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Monday, September 06, 2004 10:44 AM
> Subject: Re: Using JDBC Data source from a business class
>
> On Mon, 6 Sep 2004 09:12:51 +0300, muhammed soyer 
> <mu...@ges.net.tr>
> wrote:
>
> > My servlets are using the ds without a problem ..But I have some 
> > classes
> which are >POJO classes to make my job easier whie accessing the DB
..these
> classes couldnt use > my JDBC definition ..As I guess its from context 
> problems ..But I couldnt solve the >problem
>
> What's the exact problem? You don't exactly say where your POJO 
> classes are, so I assume they are in your webapp right, then it should 
> be ok.
>
> >
> > What should I do to use tomcat's ds from a POJO class ?
> >
> > thnx
> >
> > -ms
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> << Bu mail GESNET sunucusu tarafindan virus kontrolunden 
> gecirilmistir.>>
>
>

<< Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


<< Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Using JDBC Data source from a business class

Posted by muhammed soyer <mu...@ges.net.tr>.
Hello

    Where is this context.xml file .should I create a file in web-inf
directory named context.xml .
I put a ResourceLink line in my webapp.xml files which is at
"jakarta-tomcat-5.0.28/conf/Catalina/localhost"


-ms
----- Original Message ----- 
From: "Keith Bottner" <kb...@comcast.net>
To: "'Tomcat Users List'" <to...@jakarta.apache.org>
Sent: Monday, September 06, 2004 1:48 PM
Subject: RE: Using JDBC Data source from a business class


I believe you also need an entry in your web.xml file that looks something
like this (obviously changed for your DB settings).

<resource-ref>
<description>postgreSQL Datasource</description>
<res-ref-name>jdbc/postgres</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

You also need the ResourceLink entry in your context.xml

<ResourceLink name="jdbc/database" global="jdbc/postgres"
type="javax.sql.DataSource" />

I use JNDI to retrieve the DB connection with

private static final String JNDI_CONTEXT = "java:comp/env";
private static final String DATASOURCE_DB_NAME = "jdbc/database";

try
{
Context initCtx = new InitialContext();
Context envCtx = (Context)
initCtx.lookup(JNDI_CONTEXT);
datasource = (DataSource)
envCtx.lookup(DATASOURCE_DB_NAME);
}
catch ( NamingException e )
{
if ( log.isEnabledFor(Level.ERROR) )
log.error(sm.getString("DAO.creation"), e);
}


Hope that helps.

Keith
-----Original Message-----
From: muhammed soyer [mailto:muhammed@ges.net.tr]
Sent: Monday, September 06, 2004 5:06 AM
To: Peng Tuck Kwok; Tomcat Users List
Subject: Re: Using JDBC Data source from a business class


For my web applications(servlets) I add the following lines  in the
webapp.xml .For my classes what should I do ..These classes is not directly
called from the browser .My JSP files use them ..


<ResourceLink name="jdbc/gp" type="javax.sql.DataSource" global="jdbc/gp"/>
<Resource type="javax.sql.DataSource" description="Oracle Datasource
example" auth="Container" name="jdbc/gp"/>


-ms
----- Original Message ----- 
From: "Peng Tuck Kwok" <pe...@gmail.com>
To: "muhammed soyer" <mu...@ges.net.tr>
Sent: Monday, September 06, 2004 12:11 PM
Subject: Re: Using JDBC Data source from a business class


You should be able to access the datasource from your classes.  You said
earlier you had problems doing so, could you describe the problems ?


On Mon, 6 Sep 2004 11:31:04 +0300, muhammed soyer <mu...@ges.net.tr>
wrote:
> Yes they are in my web-inf/classes directory .I use them to do my db
> jobs ..from jsp pages .. these classes access db .so I want to make
> them use Tomcats conneciton pooling machanism .
> I can do this from servlets ..
>
> -ms
>
> ----- Original Message -----
> From: "Peng Tuck Kwok" <pe...@gmail.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Monday, September 06, 2004 10:44 AM
> Subject: Re: Using JDBC Data source from a business class
>
> On Mon, 6 Sep 2004 09:12:51 +0300, muhammed soyer
> <mu...@ges.net.tr>
> wrote:
>
> > My servlets are using the ds without a problem ..But I have some
> > classes
> which are >POJO classes to make my job easier whie accessing the DB
..these
> classes couldnt use > my JDBC definition ..As I guess its from context
> problems ..But I couldnt solve the >problem
>
> What's the exact problem? You don't exactly say where your POJO
> classes are, so I assume they are in your webapp right, then it should
> be ok.
>
> >
> > What should I do to use tomcat's ds from a POJO class ?
> >
> > thnx
> >
> > -ms
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> << Bu mail GESNET sunucusu tarafindan virus kontrolunden
> gecirilmistir.>>
>
>

<< Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


<< Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Using JDBC Data source from a business class

Posted by Keith Bottner <kb...@comcast.net>.
I believe you also need an entry in your web.xml file that looks something
like this (obviously changed for your DB settings).

	<resource-ref>
	 <description>postgreSQL Datasource</description>
	 <res-ref-name>jdbc/postgres</res-ref-name>
	 <res-type>javax.sql.DataSource</res-type>
	 <res-auth>Container</res-auth>
	</resource-ref>

You also need the ResourceLink entry in your context.xml

	<ResourceLink name="jdbc/database" global="jdbc/postgres"
type="javax.sql.DataSource" />

I use JNDI to retrieve the DB connection with

	private static final String JNDI_CONTEXT = "java:comp/env";
	private static final String DATASOURCE_DB_NAME = "jdbc/database"; 

		try
		{
			Context initCtx = new InitialContext();
			Context envCtx = (Context)
initCtx.lookup(JNDI_CONTEXT);
			datasource = (DataSource)
envCtx.lookup(DATASOURCE_DB_NAME);
		}
		catch ( NamingException e )
		{
			if ( log.isEnabledFor(Level.ERROR) )
				log.error(sm.getString("DAO.creation"), e);
		}


Hope that helps.

Keith
-----Original Message-----
From: muhammed soyer [mailto:muhammed@ges.net.tr] 
Sent: Monday, September 06, 2004 5:06 AM
To: Peng Tuck Kwok; Tomcat Users List
Subject: Re: Using JDBC Data source from a business class


For my web applications(servlets) I add the following lines  in the
webapp.xml .For my classes what should I do ..These classes is not directly
called from the browser .My JSP files use them ..


<ResourceLink name="jdbc/gp" type="javax.sql.DataSource" global="jdbc/gp"/>
<Resource type="javax.sql.DataSource" description="Oracle Datasource
example" auth="Container" name="jdbc/gp"/>


-ms
----- Original Message ----- 
From: "Peng Tuck Kwok" <pe...@gmail.com>
To: "muhammed soyer" <mu...@ges.net.tr>
Sent: Monday, September 06, 2004 12:11 PM
Subject: Re: Using JDBC Data source from a business class


You should be able to access the datasource from your classes.  You said
earlier you had problems doing so, could you describe the problems ?


On Mon, 6 Sep 2004 11:31:04 +0300, muhammed soyer <mu...@ges.net.tr>
wrote:
> Yes they are in my web-inf/classes directory .I use them to do my db 
> jobs ..from jsp pages .. these classes access db .so I want to make 
> them use Tomcats conneciton pooling machanism .
> I can do this from servlets ..
>
> -ms
>
> ----- Original Message -----
> From: "Peng Tuck Kwok" <pe...@gmail.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Monday, September 06, 2004 10:44 AM
> Subject: Re: Using JDBC Data source from a business class
>
> On Mon, 6 Sep 2004 09:12:51 +0300, muhammed soyer 
> <mu...@ges.net.tr>
> wrote:
>
> > My servlets are using the ds without a problem ..But I have some 
> > classes
> which are >POJO classes to make my job easier whie accessing the DB
..these
> classes couldnt use > my JDBC definition ..As I guess its from context 
> problems ..But I couldnt solve the >problem
>
> What's the exact problem? You don't exactly say where your POJO 
> classes are, so I assume they are in your webapp right, then it should 
> be ok.
>
> >
> > What should I do to use tomcat's ds from a POJO class ?
> >
> > thnx
> >
> > -ms
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> << Bu mail GESNET sunucusu tarafindan virus kontrolunden 
> gecirilmistir.>>
>
>

<< Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Using JDBC Data source from a business class

Posted by muhammed soyer <mu...@ges.net.tr>.
For my web applications(servlets) I add the following lines  in the
webapp.xml .For my classes what should I do ..These classes is not directly
called from the browser .My JSP files use them ..


<ResourceLink name="jdbc/gp" type="javax.sql.DataSource" global="jdbc/gp"/>
<Resource type="javax.sql.DataSource" description="Oracle Datasource
example" auth="Container" name="jdbc/gp"/>


-ms
----- Original Message ----- 
From: "Peng Tuck Kwok" <pe...@gmail.com>
To: "muhammed soyer" <mu...@ges.net.tr>
Sent: Monday, September 06, 2004 12:11 PM
Subject: Re: Using JDBC Data source from a business class


You should be able to access the datasource from your classes.  You
said earlier you had problems doing so, could you describe the
problems ?


On Mon, 6 Sep 2004 11:31:04 +0300, muhammed soyer <mu...@ges.net.tr>
wrote:
> Yes they are in my web-inf/classes directory .I use them to do my db jobs
> ..from jsp pages ..
> these classes access db .so I want to make them use Tomcats conneciton
> pooling machanism .
> I can do this from servlets ..
>
> -ms
>
> ----- Original Message -----
> From: "Peng Tuck Kwok" <pe...@gmail.com>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Monday, September 06, 2004 10:44 AM
> Subject: Re: Using JDBC Data source from a business class
>
> On Mon, 6 Sep 2004 09:12:51 +0300, muhammed soyer <mu...@ges.net.tr>
> wrote:
>
> > My servlets are using the ds without a problem ..But I have some classes
> which are >POJO classes to make my job easier whie accessing the DB
..these
> classes couldnt use > my JDBC definition ..As I guess its from context
> problems ..But I couldnt solve the >problem
>
> What's the exact problem? You don't exactly say where your POJO
> classes are, so I assume they are in your webapp right, then it should
> be ok.
>
> >
> > What should I do to use tomcat's ds from a POJO class ?
> >
> > thnx
> >
> > -ms
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
> << Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>
>
>

<< Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Using JDBC Data source from a business class

Posted by muhammed soyer <mu...@ges.net.tr>.
Yes they are in my web-inf/classes directory .I use them to do my db jobs
..from jsp pages ..
these classes access db .so I want to make them use Tomcats conneciton
pooling machanism .
I can do this from servlets ..



-ms

----- Original Message ----- 
From: "Peng Tuck Kwok" <pe...@gmail.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, September 06, 2004 10:44 AM
Subject: Re: Using JDBC Data source from a business class


On Mon, 6 Sep 2004 09:12:51 +0300, muhammed soyer <mu...@ges.net.tr>
wrote:

> My servlets are using the ds without a problem ..But I have some classes
which are >POJO classes to make my job easier whie accessing the DB ..these
classes couldnt use > my JDBC definition ..As I guess its from context
problems ..But I couldnt solve the >problem

What's the exact problem? You don't exactly say where your POJO
classes are, so I assume they are in your webapp right, then it should
be ok.


>
> What should I do to use tomcat's ds from a POJO class ?
>
> thnx
>
> -ms
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


<< Bu mail GESNET sunucusu tarafindan virus kontrolunden gecirilmistir.>>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Using JDBC Data source from a business class

Posted by Peng Tuck Kwok <pe...@gmail.com>.
On Mon, 6 Sep 2004 09:12:51 +0300, muhammed soyer <mu...@ges.net.tr> wrote:

> My servlets are using the ds without a problem ..But I have some classes which are >POJO classes to make my job easier whie accessing the DB ..these classes couldnt use > my JDBC definition ..As I guess its from context problems ..But I couldnt solve the >problem 

What's the exact problem? You don't exactly say where your POJO
classes are, so I assume they are in your webapp right, then it should
be ok.


> 
> What should I do to use tomcat's ds from a POJO class ?
> 
> thnx
> 
> -ms
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org