tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Propes, Barry L " <barry.l.pro...@citi.com>
Subject RE: DB connection error -Tomcat 6 config
Date Thu, 18 Mar 2010 22:07:54 GMT
Yes, it should be.

Not sure how that got jumbled as such but what I did have was:

Connection connection = null;
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/myoracle"); 

Tried other variations seen elsewhere on here as suggested. But still no dice.
Odd - like I'd mentioned earlier, I can pass params through (DBUrl, user, password) and hit
it, but not with a Context object.


-----Original Message-----
From: Pid [mailto:pid@pidster.com] 
Sent: Thursday, March 18, 2010 5:02 PM
To: Tomcat Users List
Subject: Re: DB connection error -Tomcat 6 config

On 18/03/2010 21:26, Bob Hall wrote:
> --- On Thu, 3/18/10 at 1:56 PM, Caldarale, Charles R<Chuck.Caldarale@unisys.com>
 wrote:
>
>> If you can, move up to 6.0.26 so we can all be looking at the same 
>> release.
>
>  From one of the OP's earlier messages:
>
>> An error occurred at line: 68 in the jsp file: 
>> /chngctrl/chgctrl_details.jsp Type mismatch: cannot convert from 
>> Object to Context
>> 65:
>> 66: Connection connection = null;
>> 67: Context initCtx = new InitialContext();
>> 68: Context envCtx = initCtx.lookup("java:comp/env");
>> 69: // Look up our data source
>> 70: DataSource ds = initCtx.lookup("jdbc/myoracle");
>> 71:

  Context envCtx = initCtx.lookup("java:comp/env");
  DataSource ds = initCtx.lookup("jdbc/myoracle");

should be:

  Context envCtx = initCtx.lookup("java:comp/env");
  DataSource ds = envCtx.lookup("jdbc/myoracle");

no?


p


>> SEVERE: Servlet.service() for servlet jsp threw exception
> javax.naming.NameNotFoundException: Name jdbc is not bound in this 
> Context
>>      at 
>> org.apache.naming.NamingContext.lookup(NamingContext.java:770)
>
>
> Have you tried:
>
> 66: Connection connection = null;
> 67: Context initCtx = new InitialContext();
> 68: Context envCtx = (Context) initCtx.lookup("java:comp/env");
> 69: // Look up our data source
> 70: DataSource ds = (DataSource) initCtx.lookup("java:/myoracle");
>
>     OR
>
> 70: DataSource ds = (DataSource) initCtx.lookup("java:jdbc/myoracle");
>
>
> - Bob
>
>
>
>
> ---------------------------------------------------------------------
> 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