tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andoni <andonil...@eurokom.ie>
Subject Re: ASKING AGAIN: problem in getting database connection from rem ote machine using JNDI
Date Tue, 25 Oct 2005 09:32:14 GMT
Hello,

I am looking at this error message you are getting:
Cannot create PoolableConnectionFactory (Unknown database 'myDB')
and thinking it isn't any thing to do with resource tags. Specially if it is
working locally. To me it seems to be something wrong with your DB
installation. Does the remote DB have a schema called myDB?

Andoni.

----- Original Message ----- 
From: rahul
Newsgroups: gmane.comp.jakarta.tomcat.user
Sent: Tuesday, October 25, 2005 10:08 AM
Subject: RE: ASKING AGAIN: problem in getting database connection from rem
ote machine using JNDI


Thanks for help Jan,

But how to define jdbc/global in the Data Sources of the tomcat Server?
can you explain further

 -RahulJoshi

> -----Original Message-----
> From: Jan Pernica [mailto:jan.pernica@pernica.org]
> Sent: Tuesday, October 25, 2005 2:29 PM
> To: Tomcat Users List
> Subject: Re: ASKING AGAIN: problem in getting database connection from
> rem ote machine using JNDI
>
>
> In your deploy XML you should have somethink like this:
>
>   <ResourceLink global="jdbc/global" name="jdbc/myApp"
> type="javax.xml.DataSource"/>
>
> Where jdbc/global is defined in the Data Sources of the tomcat server.
>
> Jan
>
> rahul wrote:
>
> >I am still not been able to use remote database,
> >even after including <resource-ref> in my web.xml
> >
> >
> >
> >
> >
> >>-----Original Message-----
> >>From: Peter.Zoche@materna.de [mailto:Peter.Zoche@materna.de]
> >>Sent: Tuesday, October 25, 2005 1:48 PM
> >>To: users@tomcat.apache.org
> >>Subject: RE: ASKING AGAIN: problem in getting database connection from
> >>rem ote machine using JNDI
> >>
> >>
> >>I dont know if it is required, but do you have a resource-ref
> >>entry in your web.xml, something like this?
> >>
> >><resource-ref>
> >>  <description>mySQL Datasource</description>
> >>  <res-ref-name>jdbc/myAPP</res-ref-name>
> >>  <res-type>javax.sql.DataSource</res-type>
> >>  <res-auth>Container</res-auth>
> >></resource-ref>
> >>
> >>where res-ref-name has to be the same as in context.xml.
> >>
> >>And perhaps your look-up-name might not be correct, but I am
> >>not sure because I am using PostrgreSQL databse.
> >>
> >>http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-h
> >>owto.html
> >>might help you out.
> >>
> >>-----Urspr√ľngliche Nachricht-----
> >>Von: rahul [mailto:rahul.joshi@amsoft.net]
> >>Gesendet: Dienstag, 25. Oktober 2005 06:33
> >>An: Tomcat Users List
> >>Betreff: ASKING AGAIN: problem in getting database connection from
> >>remote machine using JNDI
> >>
> >>
> >>
> >>Is there anything else that is required for remote database?
> >>
> >>
> >>
> >>
> >>>-----Original Message-----
> >>>From: rahul [mailto:rahul.joshi@amsoft.net]
> >>>Sent: Monday, October 24, 2005 7:56 PM
> >>>To: Tomcat Users List
> >>>Subject: problem in getting database connection from remote machine
> >>>using JNDI
> >>>
> >>>
> >>>Hi all,
> >>>
> >>>I am using tomcat JNDI for getting databse connection in my application
> >>>
> >>>For this I have created a context.xml file in myAPP/META-INF
> >>>which looks like this:
> >>>
> >>><?xml version="1.0" encoding="UTF-8"?>
> >>><Context path="/myAPP" docBase="myAPP" debug="5" reloadable="true"
> >>> privileged="true" crossContext="true">
> >>> <Resource name="jdbc/myAPP" auth="Container"
> >>>  type="javax.sql.DataSource" maxActive="30" maxIdle="10"
> maxWait="6000"
> >>>  username="user" password="password"
> >>>  driverClassName="com.mysql.jdbc.Driver"
> >>>  url="jdbc:mysql://localhost:3306/myDB" removeAbandoned="true"
> >>>  autoReconnect="true"
> >>>  validationQuery="select now()"
> >>>  factory="org.apache.commons.dbcp.BasicDataSourceFactory"/>
> >>></Context>
> >>>
> >>>
> >>>This works absolutely fine. But when I try to connect to a
> >>>
> >>>
> >>remote database
> >>
> >>
> >>>by changing url in above
> >>>file to "jdbc:mysql://192.168.5.65:3306/myDB" my application fails
> >>>It creates following exception while retrieving a connection:
> >>>org.apache.tomcat.dbcp.dbcp.SQLNestedException:
> >>>Cannot create PoolableConnectionFactory (Unknown database 'myDB')
> >>>
> >>>
> >>>code I have written for fetching connection is:
> >>>
> >>>
> >>>   Context ctx = (Context) new InitialContext()
> >>>     .lookup("java:comp/env");
> >>>   if (ctx == null)
> >>>   {
> >>>    throw new Exception("No context available");
> >>>   } else
> >>>   {
> >>>    dataSource = (DataSource) ctx.lookup("jdbc/icontact");
> >>>    Connection connection = dataSource.getConnection();
> >>>   }
> >>>
> >>>
> >>>can anybody help?
> >>>
> >>>
> >>>thanks in advance
> >>>--RahulJoshi
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >>
> >>
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
> >
> >
> >
>
>



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


Mime
View raw message