You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Einsle <ro...@einsle.de> on 2004/09/01 08:33:45 UTC

Re: Access zu an jdbc Datasource

Hy,

It seems to work, very much Thanks.

Greetings

\Robby

D'Alessandro, Arthur schrieb:

>Try a resourcelink in your context for the webapp.
>
>Eg.
><Context cachingAllowed="true" docBase="yourwebappname.war" debug="99"
>path="/yourwebappname" privileged="false" reloadable="true"
>swallowOutput="true">
>  <ResourceLink name="jdbc/globalname" global="jdbc/globalname"
>type="javax.sql.DataSource"/>
></Context> 
>
>-----Original Message-----
>From: Robert Einsle [mailto:robert@einsle.de] 
>Sent: Tuesday, August 31, 2004 9:02 AM
>To: Tomcat Users List
>Subject: Access zu an jdbc Datasource
>
>Hello List,
>
>I'm trying zu connect to an JDBC Datasource connecting to an Postgres 
>Database. But it will not work.
>
>I tryed it link the Documentation, adding the Datasource under 
>GlobalNamingResources, and add the another in web.xml.
>
>In ProgrammSource:
>
>--- cut ---
>Context initContext = new InitialContext();
>Context envContext = (Context)initContext.lookup("java:/comp/env");
>DataSource ds = (DataSource)envContext.lookup("jdbc/postgres");
>Connection conn = ds.getConnection();
>--- cut ---
>
>The another is link the description in the JDBC Howto.
>
>While ds.getConnection() i recieved an Exception, cannot connect to 
>Datasource name ''.
>
>Searchin a little bit, i cannot find the Environment for the 
>Postgresdatabasesource.
>
>Does anyone has an Idea / Howto i can lokk about my Problem??
>
>Thanks for Help
>
>\Robby
>
>
>  
>


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