also if you are going to be opening up more than 1 connection I would suggest 
using connection-pool Here is Oracle ex.
http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-datasource/doc/how-to-datasource.html#conf

(and follow david's advice)

Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 




> Date: Wed, 10 Dec 2008 14:05:14 -0500
> From: [EMAIL PROTECTED]
> To: users@tomcat.apache.org
> Subject: Re: problem in pooled database
> 
> You could also be more explicit in your code if you import two classes
> of the same name from different packages:
> 
> javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup(
> "java:comp/env/jdbc/bzk2" ) ;
> 
> --David
> 
> ahmet temiz wrote:
> > Now, it seems ok after disabling javax.activation.DataSource;
> >
> > //import javax.activation.DataSource;
> > import javax.sql.DataSource;
> >
> > thank you
> >
> > 2008/12/10 David Smith <[EMAIL PROTECTED]>
> >
> >   
> >> Ok... so what do the import statements at the top of that file look
> >> like?  Seems to me java has taken DataSource to mean
> >> javax.activation.DataSource instead of javax.sql.DataSource.  That's
> >> probably because of the imports at the top of your source file.
> >>
> >> --David
> >>
> >> ahmet temiz wrote:
> >>     
> >>> Exception has taken place here:
> >>>
> >>> DataSource ds =  (DataSource) ctx.lookup("java:comp/env/jdbc/bzk2");
> >>>
> >>> this is my Application-specific resource (context.xml)
> >>> <?xml version="1.0" encoding="UTF-8"?>
> >>> <Context path="/home/orkun/workspace5/w1" docBase="w1"
> >>>     crossContext="true" reloadable="true" debug="1">
> >>>     <Resource name="jdbc/bzk2" auth="Container"
> >>>       
> >> type="javax.sql.DataSource"
> >>     
> >>>         driverClassName="org.postgresql.Driver" url="jdbc:postgresql://
> >>> 127.0.0.1:5432/bzk2"
> >>>         username="orkun" password="222222" maxActive="20" maxIdle="10"
> >>>         maxWait="-1" />
> >>> </Context>
> >>>
> >>> thank you
> >>>
> >>> 2008/12/10 David Smith <[EMAIL PROTECTED]>
> >>>
> >>>
> >>>       
> >>>> Patient says: It hurts when I do this...  (demonstrates movement)
> >>>> Doctor says: Don't do that.
> >>>>
> >>>> Moral of the story is the error message is pretty clear.  If your class
> >>>> has imported javax.activation.* and javax.sql.*, you may have to be more
> >>>> specific on the type of your datasource variable:
> >>>>
> >>>> javax.sql.DataSource dbDataSrc = /* code for retrieving the datasource
> >>>>         
> >> */
> >>     
> >>>> For less sarcasm and more help, please feed us more details like say a
> >>>> snippet of code where this error occurs, what was imported for that
> >>>> class, and relevant parts of your config.
> >>>>
> >>>> --David
> >>>>
> >>>> ahmet temiz wrote:
> >>>>
> >>>>         
> >>>>> hello
> >>>>>
> >>>>> I am trying to manage pooled database (postgresql).I am encountering
> >>>>> this problem :
> >>>>>
> >>>>> java.lang.ClassCastException:
> >>>>> org.apache.tomcat.dbcp.dbcp.BasicDataSource cannot be cast to
> >>>>> javax.activation.DataSource
> >>>>>
> >>>>> I will appreciate if you supply any information to me to overcome the
> >>>>>
> >>>>>           
> >>>> problem
> >>>>
> >>>>         
> >>>>> kind regards
> >>>>>
> >>>>> Ahmet Temiz
> >>>>>
> >>>>>
> >>>>>
> >>>>>           
> >>>> ---------------------------------------------------------------------
> >>>> 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]
> >>
> >>
> >>     
> >
> >   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

_________________________________________________________________
Send e-mail faster without improving your typing skills.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008

Reply via email to