You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chirag Mehta <Ch...@morganstanley.com> on 2003/07/31 13:30:35 UTC

Database Connection

Hello,

I have just started developing with Struts and was wondering if anyone could help me connect to a Sybase Database using my webapp?

I have set up my JSP page, actionform and action. I have set the datasource properies in my config.xml and am calling them from my action. It is giving me a class not found exception like below.

java.sql.SQLException: open: java.lang.ClassNotFoundException: com.sybase.jdbc2.jdbc.SybDriver
 at org.apache.struts.legacy.GenericDataSource.open(GenericDataSource.java:735)
 at org.apache.struts.action.ActionServlet.initModuleDataSources(Unknown Source)
 at org.apache.struts.action.ActionServlet.init(Unknown Source)
 at javax.servlet.GenericServlet.init(GenericServlet.java:256)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:935)

Anyone got any ideas what i maybe ding wrong.

One other question. Does anyone know of any drivers that connect to a informix DB and how to use them?

Sorry if this is a very basic question. I am only a first yr undergraduate!

Chirag


Re: Database Connection

Posted by Marc Ende <me...@twenty47.tv>.
Am Donnerstag, 31. Juli 2003 13:53 schrieb Navjot Singh:
> yes, you can put your class file in webapp CP also - whichever way it works
> for you. However, docs say that it should be under tomcat common dir.

Yes of course, they should be under tomcats common dir especially when using 
jndi for connection pooling.

> Can you explain a little more why/how the connection behaviour is toggling?
> Did you print the state of the connection before you use it?

Yes I had, but I run into trouble with sometimes open and sometimes closed 
connections. That might be no problem anymore but I've got them some month 
ago . Since this time I'm only using JNDI for connection-pooled database 
access. (It's much easyer and more efficient to use database-connections this 
way (my opinion))

Marc


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


RE: Database Connection

Posted by Navjot Singh <na...@net4india.net>.
yes, you can put your class file in webapp CP also - whichever way it works
for you. However, docs say that it should be under tomcat common dir.

Can you explain a little more why/how the connection behaviour is toggling?
Did you print the state of the connection before you use it?

rgds
navjot singh

|-----Original Message-----
|From: Marc Ende [mailto:me@twenty47.tv]
|Sent: Thursday, July 31, 2003 5:19 PM
|To: Struts Users Mailing List
|Subject: Re: Database Connection
|
|
|Hi Navjot,
|
|I ran into trouble as I put it in the classpath you mentioned.
|(Connection works, connection works not, and so on)
|I think it's better to put it in the webapps classpath, if you're
|not using
|jndi.
|
|yours
|
|Marc
|
|
|Am Donnerstag, 31. Juli 2003 13:37 schrieb Navjot Singh:
|> the jar file for your sybase driver should in the class path of tha app
|> server.
|> If it's tomcat put your jar file in tomcat_home/common/lib
|
|
|---------------------------------------------------------------------
|To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
|For additional commands, e-mail: struts-user-help@jakarta.apache.org
|
|


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


Re: Database Connection

Posted by Marc Ende <me...@twenty47.tv>.
Hi Navjot,

I ran into trouble as I put it in the classpath you mentioned.
(Connection works, connection works not, and so on)
I think it's better to put it in the webapps classpath, if you're not using 
jndi.

yours

Marc


Am Donnerstag, 31. Juli 2003 13:37 schrieb Navjot Singh:
> the jar file for your sybase driver should in the class path of tha app
> server.
> If it's tomcat put your jar file in tomcat_home/common/lib


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


RE: Database Connection

Posted by Navjot Singh <na...@net4india.net>.
the jar file for your sybase driver should in the class path of tha app
server.
If it's tomcat put your jar file in tomcat_home/common/lib

it will work.
-navjot singh

|-----Original Message-----
|From: Chirag Mehta [mailto:Chirag.Mehta@morganstanley.com]
|Sent: Thursday, July 31, 2003 5:01 PM
|To: Struts Users Mailing List
|Subject: Database Connection
|
|
|Hello,
|
|I have just started developing with Struts and was wondering if
|anyone could help me connect to a Sybase Database using my webapp?
|
|I have set up my JSP page, actionform and action. I have set the
|datasource properies in my config.xml and am calling them from my
|action. It is giving me a class not found exception like below.
|
|java.sql.SQLException: open: java.lang.ClassNotFoundException:
|com.sybase.jdbc2.jdbc.SybDriver
| at
|org.apache.struts.legacy.GenericDataSource.open(GenericDataSource.java:735)
| at
|org.apache.struts.action.ActionServlet.initModuleDataSources(Unknow
|n Source)
| at org.apache.struts.action.ActionServlet.init(Unknown Source)
| at javax.servlet.GenericServlet.init(GenericServlet.java:256)
| at
|org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrappe
|r.java:935)
|
|Anyone got any ideas what i maybe ding wrong.
|
|One other question. Does anyone know of any drivers that connect
|to a informix DB and how to use them?
|
|Sorry if this is a very basic question. I am only a first yr undergraduate!
|
|Chirag
|
|


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