You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Edward Manalansan <ed...@yahoo.com> on 2006/03/14 15:54:47 UTC

Help on error "Name jdbc is not bound in this context"

Hi there, 
   
  I've trying to setup a Datasource in Tomcat 5.028 and I can't get it to work. I've meticulously followed the tomcat documentation and still no luck. I went into several famous forums and still didn't work. 
   
  For starter, I tried adding the Datasource manually in the admin screen and was able to save it, however, I don't see the Datasouce entry anywhere in Tomcat files, specifically the ...conf/server.xml.
   
  Here my code in server.xml
  .
  existing code 
  .
  <Context path="/jspbook_site" docbase="jspbook_site"
  debug="0" priveleged="true">
 <Resource name="jdbc/jspbook_site"
  auth="Container"
  type="javax.sql.DataSource"/>
 <ResourceParams name="jdbc/jspbook_site">
  <parameter>
   <name>username</name>
   <value>sa</value>
  </parameter>
  <parameter>
   <name>password</name>
   <value></value>  
  </parameter>
  <parameter>
   <name>driverClassName</name>
   <value>org.hsqldb.jdbcDriver</value>  
  </parameter>
  <parameter>
   <name>url</name>
   <value>jdbc:hsqldb:/usr/Tomcat 5.0/webapps/jspbook_site/WEB-INF/jspbookdb</value>  
  </parameter>
 </ResourceParams>
</Context>
   
  Here is my call to the Datasouce...
   
  .
  .
  InitialContext ctx = new InitialContext();
      DataSource ds =
        (DataSource)ctx.lookup("java:comp/env/jdbc/jspbook_site");
      Connection conn = ds.getConnection();
   
  .
  .
   
  I verified that org.hsqldb.jdbcDriver is working when using DriverManager class.
   
  Thank you very much.

Re: Help on error "Name jdbc is not bound in this context"

Posted by Edward Manalansan <ed...@yahoo.com>.
 <resource-ref>
  <description>
   Resource reference to a factory for java.sql.Connection
   instances that may be used for talking to a particular
   database that is configured in the server.xml file
  </description>
  <res-ref-name>
   jdbc/jspbook
  </res-ref-name>
  <res-type>
   javax.sql.DataSource
  </res-type>
  <res-auth>
   Container
  </res-auth> 
 </resource-ref>
   
  Thank you Filip.

Filip Hanik - Dev Lists <de...@hanik.com> wrote:
  what did you put in your web.xml?

Filip


Edward Manalansan wrote:
> Hi there, 
> 
> I've trying to setup a Datasource in Tomcat 5.028 and I can't get it to work. I've meticulously followed the tomcat documentation and still no luck. I went into several famous forums and still didn't work. 
> 
> For starter, I tried adding the Datasource manually in the admin screen and was able to save it, however, I don't see the Datasouce entry anywhere in Tomcat files, specifically the ...conf/server.xml.
> 
> Here my code in server.xml
> .
> existing code 
> .
> > debug="0" priveleged="true">
> > auth="Container"
> type="javax.sql.DataSource"/>
> 
> 

> username
> sa
> 

> 

> password
> 
> 

> 

> driverClassName
> org.hsqldb.jdbcDriver 
> 

> 

> url
> jdbc:hsqldb:/usr/Tomcat 5.0/webapps/jspbook_site/WEB-INF/jspbookdb 
> 

> 
> 
> 
> Here is my call to the Datasouce...
> 
> .
> .
> InitialContext ctx = new InitialContext();
> DataSource ds =
> (DataSource)ctx.lookup("java:comp/env/jdbc/jspbook_site");
> Connection conn = ds.getConnection();
> 
> .
> .
> 
> I verified that org.hsqldb.jdbcDriver is working when using DriverManager class.
> 
> Thank you very much.
>
> 


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



Re: Help on error "Name jdbc is not bound in this context"

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
what did you put in your web.xml?

Filip


Edward Manalansan wrote:
> Hi there, 
>    
>   I've trying to setup a Datasource in Tomcat 5.028 and I can't get it to work. I've meticulously followed the tomcat documentation and still no luck. I went into several famous forums and still didn't work. 
>    
>   For starter, I tried adding the Datasource manually in the admin screen and was able to save it, however, I don't see the Datasouce entry anywhere in Tomcat files, specifically the ...conf/server.xml.
>    
>   Here my code in server.xml
>   .
>   existing code 
>   .
>   <Context path="/jspbook_site" docbase="jspbook_site"
>   debug="0" priveleged="true">
>  <Resource name="jdbc/jspbook_site"
>   auth="Container"
>   type="javax.sql.DataSource"/>
>  <ResourceParams name="jdbc/jspbook_site">
>   <parameter>
>    <name>username</name>
>    <value>sa</value>
>   </parameter>
>   <parameter>
>    <name>password</name>
>    <value></value>  
>   </parameter>
>   <parameter>
>    <name>driverClassName</name>
>    <value>org.hsqldb.jdbcDriver</value>  
>   </parameter>
>   <parameter>
>    <name>url</name>
>    <value>jdbc:hsqldb:/usr/Tomcat 5.0/webapps/jspbook_site/WEB-INF/jspbookdb</value>  
>   </parameter>
>  </ResourceParams>
> </Context>
>    
>   Here is my call to the Datasouce...
>    
>   .
>   .
>   InitialContext ctx = new InitialContext();
>       DataSource ds =
>         (DataSource)ctx.lookup("java:comp/env/jdbc/jspbook_site");
>       Connection conn = ds.getConnection();
>    
>   .
>   .
>    
>   I verified that org.hsqldb.jdbcDriver is working when using DriverManager class.
>    
>   Thank you very much.
>
>   


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