RE: Name jdbc:comp is not bound in this context
I resolved my own problem, and should have caught it along time ago. I needed to install the standard 4.1.18 to access JNDI resources. Hope that this might help someone else in the future. -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 4:45 PM To: Tomcat Users List Subject: RE: Name jdbc:comp is not bound in this context Is this an issue encountered by users of tomcat 4.1.18.Le? Should i try reinstalling and configuring an earlier version? I've see serveral discussion regarding this topic and I've tried everything suggested... what should I do now? -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:45 PM To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: Name jdbc:comp is not bound in this context Thanks for the reply :). Unfoutunately I added the useNaming=true and I still have the same results. I'm really stuck here... do you have any other suggestions. -Original Message- From: Justin L. Spies [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:31 PM To: 'Tomcat Users List' Subject: RE: Name jdbc:comp is not bound in this context Nicole, Not sure if this was answered, but I'll give it a try. When I had this problem, I found that I needed to add useNaming=true to both the Host ... entry and to the Context ... entry. Sincerely, Pantek Incorporated Justin L. Spies URL: http://www.pantek.com Ph 440.519.1802 Fax 440.248.5274 Cell 440.336.3317 -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:11 PM To: [EMAIL PROTECTED] Subject: Name jdbc:comp is not bound in this context I've gone through every resource I have in trying to test a connection to MySql database. I am using Tomcat 4.1.18-LE and MySql 3.23.53 and java 1.4.1_01. I set priveleges on MySql, put the mm.sql driver's jar in common/lib. I set my Classpath Variable .;C:\ServletDev;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar ;C:\ mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar I added the following to my server.xml !--1/07/2002 Nicole Hibbard The following block of code add the datasource for connecting mysql database using Connector J Driver -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className = org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name = jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !--Maximum number of dBconnections in pool. Make sure you configure your mysqld max_connection large enough to handle all you connections-- parameter namemaxActive/name value100/value /parameter parameter namepassword/name valuejavadude/value /parameter !-- Class name for JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your mysql db if the connection closes then auto connect -- parameter nameurl/name valuejdbc:mysql://localhost/javatest?user=javauser/value /parameter /ResourceParams /Context !--End of code from 1/7/2003 for Nicole Hibbard-- I created a web.xml in DBTest/WEB-INF ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//DN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionMySQL Test App /description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app I have a jsp in web-apps/DBTest html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html I have a DBTest.class in Webapps/DBtest/foo package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup(
Re: Name jdbc:comp is not bound in this context
Nicole Hibbard wrote: I resolved my own problem, and should have caught it along time ago. I needed to install the standard 4.1.18 to access JNDI resources. Hope that this might help someone else in the future. I'm using 4.1.12 and jndi resources work fine :) . -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 4:45 PM To: Tomcat Users List Subject: RE: Name jdbc:comp is not bound in this context Is this an issue encountered by users of tomcat 4.1.18.Le? Should i try reinstalling and configuring an earlier version? I've see serveral discussion regarding this topic and I've tried everything suggested... what should I do now? -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:45 PM To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: Name jdbc:comp is not bound in this context Thanks for the reply :). Unfoutunately I added the useNaming=true and I still have the same results. I'm really stuck here... do you have any other suggestions. -Original Message- From: Justin L. Spies [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:31 PM To: 'Tomcat Users List' Subject: RE: Name jdbc:comp is not bound in this context Nicole, Not sure if this was answered, but I'll give it a try. When I had this problem, I found that I needed to add useNaming=true to both the Host ... entry and to the Context ... entry. Sincerely, Pantek Incorporated Justin L. Spies URL: http://www.pantek.com Ph 440.519.1802 Fax 440.248.5274 Cell 440.336.3317 -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:11 PM To: [EMAIL PROTECTED] Subject: Name jdbc:comp is not bound in this context I've gone through every resource I have in trying to test a connection to MySql database. I am using Tomcat 4.1.18-LE and MySql 3.23.53 and java 1.4.1_01. I set priveleges on MySql, put the mm.sql driver's jar in common/lib. I set my Classpath Variable .;C:\ServletDev;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar ;C:\ mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar I added the following to my server.xml !--1/07/2002 Nicole Hibbard The following block of code add the datasource for connecting mysql database using Connector J Driver -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className = org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name = jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !--Maximum number of dBconnections in pool. Make sure you configure your mysqld max_connection large enough to handle all you connections-- parameter namemaxActive/name value100/value /parameter parameter namepassword/name valuejavadude/value /parameter !-- Class name for JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your mysql db if the connection closes then auto connect -- parameter nameurl/name valuejdbc:mysql://localhost/javatest?user=javauser/value /parameter /ResourceParams /Context !--End of code from 1/7/2003 for Nicole Hibbard-- I created a web.xml in DBTest/WEB-INF ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//DN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionMySQL Test App /description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app I have a jsp in web-apps/DBTest html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html I have a DBTest.class in Webapps/DBtest/foo package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/TestDB); if (ds == null) foo= Datasource is null; if (ds != null) { Connection conn = ds.getConnection(); if (conn == null) foo=got datasource, no connection; if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery(
RE: Name jdbc:comp is not bound in this context
I was using the LE version and needed to use the standard which supports JNDI resources.:) -Original Message- From: Peng Tuck Kwok [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 4:18 PM To: Tomcat Users List Subject: Re: Name jdbc:comp is not bound in this context Nicole Hibbard wrote: I resolved my own problem, and should have caught it along time ago. I needed to install the standard 4.1.18 to access JNDI resources. Hope that this might help someone else in the future. I'm using 4.1.12 and jndi resources work fine :) . -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 4:45 PM To: Tomcat Users List Subject: RE: Name jdbc:comp is not bound in this context Is this an issue encountered by users of tomcat 4.1.18.Le? Should i try reinstalling and configuring an earlier version? I've see serveral discussion regarding this topic and I've tried everything suggested... what should I do now? -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:45 PM To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: Name jdbc:comp is not bound in this context Thanks for the reply :). Unfoutunately I added the useNaming=true and I still have the same results. I'm really stuck here... do you have any other suggestions. -Original Message- From: Justin L. Spies [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:31 PM To: 'Tomcat Users List' Subject: RE: Name jdbc:comp is not bound in this context Nicole, Not sure if this was answered, but I'll give it a try. When I had this problem, I found that I needed to add useNaming=true to both the Host ... entry and to the Context ... entry. Sincerely, Pantek Incorporated Justin L. Spies URL: http://www.pantek.com Ph 440.519.1802 Fax 440.248.5274 Cell 440.336.3317 -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:11 PM To: [EMAIL PROTECTED] Subject: Name jdbc:comp is not bound in this context I've gone through every resource I have in trying to test a connection to MySql database. I am using Tomcat 4.1.18-LE and MySql 3.23.53 and java 1.4.1_01. I set priveleges on MySql, put the mm.sql driver's jar in common/lib. I set my Classpath Variable .;C:\ServletDev;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar ;C:\ mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar I added the following to my server.xml !--1/07/2002 Nicole Hibbard The following block of code add the datasource for connecting mysql database using Connector J Driver -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className = org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name = jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !--Maximum number of dBconnections in pool. Make sure you configure your mysqld max_connection large enough to handle all you connections-- parameter namemaxActive/name value100/value /parameter parameter namepassword/name valuejavadude/value /parameter !-- Class name for JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your mysql db if the connection closes then auto connect -- parameter nameurl/name valuejdbc:mysql://localhost/javatest?user=javauser/value /parameter /ResourceParams /Context !--End of code from 1/7/2003 for Nicole Hibbard-- I created a web.xml in DBTest/WEB-INF ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//DN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionMySQL Test App /description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app I have a jsp in web-apps/DBTest html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html I have a
Re: Name jdbc:comp is not bound in this context
I think the LE version just omits the xml parsers and just uses the one that the jdk 1.4 has. There is no mention of omitting key features like that in the LE versions. Can someone else comment? Nicole Hibbard wrote: I was using the LE version and needed to use the standard which supports JNDI resources.:) -Original Message- From: Peng Tuck Kwok [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 4:18 PM To: Tomcat Users List Subject: Re: Name jdbc:comp is not bound in this context Nicole Hibbard wrote: I resolved my own problem, and should have caught it along time ago. I needed to install the standard 4.1.18 to access JNDI resources. Hope that this might help someone else in the future. I'm using 4.1.12 and jndi resources work fine :) . -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 4:45 PM To: Tomcat Users List Subject: RE: Name jdbc:comp is not bound in this context Is this an issue encountered by users of tomcat 4.1.18.Le? Should i try reinstalling and configuring an earlier version? I've see serveral discussion regarding this topic and I've tried everything suggested... what should I do now? -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:45 PM To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: Name jdbc:comp is not bound in this context Thanks for the reply :). Unfoutunately I added the useNaming=true and I still have the same results. I'm really stuck here... do you have any other suggestions. -Original Message- From: Justin L. Spies [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:31 PM To: 'Tomcat Users List' Subject: RE: Name jdbc:comp is not bound in this context Nicole, Not sure if this was answered, but I'll give it a try. When I had this problem, I found that I needed to add useNaming=true to both the Host ... entry and to the Context ... entry. Sincerely, Pantek Incorporated Justin L. Spies URL: http://www.pantek.com Ph 440.519.1802 Fax 440.248.5274 Cell 440.336.3317 -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:11 PM To: [EMAIL PROTECTED] Subject: Name jdbc:comp is not bound in this context I've gone through every resource I have in trying to test a connection to MySql database. I am using Tomcat 4.1.18-LE and MySql 3.23.53 and java 1.4.1_01. I set priveleges on MySql, put the mm.sql driver's jar in common/lib. I set my Classpath Variable .;C:\ServletDev;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar ;C:\ mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar I added the following to my server.xml !--1/07/2002 Nicole Hibbard The following block of code add the datasource for connecting mysql database using Connector J Driver -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className = org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name = jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !--Maximum number of dBconnections in pool. Make sure you configure your mysqld max_connection large enough to handle all you connections-- parameter namemaxActive/name value100/value /parameter parameter namepassword/name valuejavadude/value /parameter !-- Class name for JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your mysql db if the connection closes then auto connect -- parameter nameurl/name valuejdbc:mysql://localhost/javatest?user=javauser/value /parameter /ResourceParams /Context !--End of code from 1/7/2003 for Nicole Hibbard-- I created a web.xml in DBTest/WEB-INF ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//DN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionMySQL Test App /description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app I have a jsp in web-apps/DBTest html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html I have a DBTest.class in Webapps/DBtest/foo package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No
Name jdbc:comp is not bound in this context
I've gone through every resource I have in trying to test a connection to MySql database. I am using Tomcat 4.1.18-LE and MySql 3.23.53 and java 1.4.1_01. I set priveleges on MySql, put the mm.sql driver's jar in common/lib. I set my Classpath Variable .;C:\ServletDev;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar;C:\ mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar I added the following to my server.xml !--1/07/2002 Nicole Hibbard The following block of code add the datasource for connecting mysql database using Connector J Driver -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className = org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name = jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !--Maximum number of dBconnections in pool. Make sure you configure your mysqld max_connection large enough to handle all you connections-- parameter namemaxActive/name value100/value /parameter parameter namepassword/name valuejavadude/value /parameter !-- Class name for JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your mysql db if the connection closes then auto connect -- parameter nameurl/name valuejdbc:mysql://localhost/javatest?user=javauser/value /parameter /ResourceParams /Context !--End of code from 1/7/2003 for Nicole Hibbard-- I created a web.xml in DBTest/WEB-INF ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//DN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionMySQL Test App /description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app I have a jsp in web-apps/DBTest html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html I have a DBTest.class in Webapps/DBtest/foo package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/TestDB); if (ds == null) foo= Datasource is null; if (ds != null) { Connection conn = ds.getConnection(); if (conn == null) foo=got datasource, no connection; if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); if(rst.next()) { foo=rst.getString(2); bar=rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getFoo() { return foo; } public int getBar() { return bar;} } AND I GET THE FOLLOWING ERROR ON TOMCAT javax.naming.NameNotFoundException: Name jdbc:comp is not bound in this Context My test.jsp outputs Results Foo Not Connected Bar -1 I have to get this working ASAP!! Please help! Nicole -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Name jdbc:comp is not bound in this context
If someone doesn't have time to help me, but knows somewhere else I might be able to get help, please let me know. If I don't get this working by tonight then I'll probably have to nix using Tomcat alltogether and try something different and I don't want that to happen. I appreciate any help I can get. Thanks, Nicole -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 12:11 PM To: [EMAIL PROTECTED] Subject: Name jdbc:comp is not bound in this context I've gone through every resource I have in trying to test a connection to MySql database. I am using Tomcat 4.1.18-LE and MySql 3.23.53 and java 1.4.1_01. I set priveleges on MySql, put the mm.sql driver's jar in common/lib. I set my Classpath Variable .;C:\ServletDev;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar;C:\ mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar I added the following to my server.xml !--1/07/2002 Nicole Hibbard The following block of code add the datasource for connecting mysql database using Connector J Driver -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className = org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name = jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !--Maximum number of dBconnections in pool. Make sure you configure your mysqld max_connection large enough to handle all you connections-- parameter namemaxActive/name value100/value /parameter parameter namepassword/name valuejavadude/value /parameter !-- Class name for JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your mysql db if the connection closes then auto connect -- parameter nameurl/name valuejdbc:mysql://localhost/javatest?user=javauser/value /parameter /ResourceParams /Context !--End of code from 1/7/2003 for Nicole Hibbard-- I created a web.xml in DBTest/WEB-INF ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//DN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionMySQL Test App /description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app I have a jsp in web-apps/DBTest html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html I have a DBTest.class in Webapps/DBtest/foo package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/TestDB); if (ds == null) foo= Datasource is null; if (ds != null) { Connection conn = ds.getConnection(); if (conn == null) foo=got datasource, no connection; if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); if(rst.next()) { foo=rst.getString(2); bar=rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getFoo() { return foo; } public int getBar() { return bar;} } AND I GET THE FOLLOWING ERROR ON TOMCAT javax.naming.NameNotFoundException: Name jdbc:comp is not bound in this Context My test.jsp outputs Results Foo Not Connected Bar -1 I have to get this working ASAP!! Please help! Nicole -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL
RE: Name jdbc:comp is not bound in this context
Nicole, Not sure if this was answered, but I'll give it a try. When I had this problem, I found that I needed to add useNaming=true to both the Host ... entry and to the Context ... entry. Sincerely, Pantek Incorporated Justin L. Spies URL: http://www.pantek.com Ph 440.519.1802 Fax 440.248.5274 Cell 440.336.3317 -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:11 PM To: [EMAIL PROTECTED] Subject: Name jdbc:comp is not bound in this context I've gone through every resource I have in trying to test a connection to MySql database. I am using Tomcat 4.1.18-LE and MySql 3.23.53 and java 1.4.1_01. I set priveleges on MySql, put the mm.sql driver's jar in common/lib. I set my Classpath Variable .;C:\ServletDev;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar ;C:\ mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar I added the following to my server.xml !--1/07/2002 Nicole Hibbard The following block of code add the datasource for connecting mysql database using Connector J Driver -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className = org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name = jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !--Maximum number of dBconnections in pool. Make sure you configure your mysqld max_connection large enough to handle all you connections-- parameter namemaxActive/name value100/value /parameter parameter namepassword/name valuejavadude/value /parameter !-- Class name for JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your mysql db if the connection closes then auto connect -- parameter nameurl/name valuejdbc:mysql://localhost/javatest?user=javauser/value /parameter /ResourceParams /Context !--End of code from 1/7/2003 for Nicole Hibbard-- I created a web.xml in DBTest/WEB-INF ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//DN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionMySQL Test App /description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app I have a jsp in web-apps/DBTest html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html I have a DBTest.class in Webapps/DBtest/foo package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/TestDB); if (ds == null) foo= Datasource is null; if (ds != null) { Connection conn = ds.getConnection(); if (conn == null) foo=got datasource, no connection; if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); if(rst.next()) { foo=rst.getString(2); bar=rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getFoo() { return foo; } public int getBar() { return bar;} } AND I GET THE FOLLOWING ERROR ON TOMCAT javax.naming.NameNotFoundException: Name jdbc:comp is not bound in this Context My test.jsp outputs Results Foo Not Connected Bar -1 I have to get this working ASAP!! Please help! Nicole -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For
RE: Name jdbc:comp is not bound in this context
Thanks for the reply :). Unfoutunately I added the useNaming=true and I still have the same results. I'm really stuck here... do you have any other suggestions. -Original Message- From: Justin L. Spies [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:31 PM To: 'Tomcat Users List' Subject: RE: Name jdbc:comp is not bound in this context Nicole, Not sure if this was answered, but I'll give it a try. When I had this problem, I found that I needed to add useNaming=true to both the Host ... entry and to the Context ... entry. Sincerely, Pantek Incorporated Justin L. Spies URL: http://www.pantek.com Ph 440.519.1802 Fax 440.248.5274 Cell 440.336.3317 -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:11 PM To: [EMAIL PROTECTED] Subject: Name jdbc:comp is not bound in this context I've gone through every resource I have in trying to test a connection to MySql database. I am using Tomcat 4.1.18-LE and MySql 3.23.53 and java 1.4.1_01. I set priveleges on MySql, put the mm.sql driver's jar in common/lib. I set my Classpath Variable .;C:\ServletDev;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar ;C:\ mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar I added the following to my server.xml !--1/07/2002 Nicole Hibbard The following block of code add the datasource for connecting mysql database using Connector J Driver -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className = org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name = jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !--Maximum number of dBconnections in pool. Make sure you configure your mysqld max_connection large enough to handle all you connections-- parameter namemaxActive/name value100/value /parameter parameter namepassword/name valuejavadude/value /parameter !-- Class name for JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your mysql db if the connection closes then auto connect -- parameter nameurl/name valuejdbc:mysql://localhost/javatest?user=javauser/value /parameter /ResourceParams /Context !--End of code from 1/7/2003 for Nicole Hibbard-- I created a web.xml in DBTest/WEB-INF ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//DN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionMySQL Test App /description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app I have a jsp in web-apps/DBTest html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html I have a DBTest.class in Webapps/DBtest/foo package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/TestDB); if (ds == null) foo= Datasource is null; if (ds != null) { Connection conn = ds.getConnection(); if (conn == null) foo=got datasource, no connection; if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); if(rst.next()) { foo=rst.getString(2); bar=rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getFoo() { return foo; } public int getBar() { return bar;} } AND I GET THE FOLLOWING ERROR ON TOMCAT
RE: Name jdbc:comp is not bound in this context
Is this an issue encountered by users of tomcat 4.1.18.Le? Should i try reinstalling and configuring an earlier version? I've see serveral discussion regarding this topic and I've tried everything suggested... what should I do now? -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:45 PM To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: Name jdbc:comp is not bound in this context Thanks for the reply :). Unfoutunately I added the useNaming=true and I still have the same results. I'm really stuck here... do you have any other suggestions. -Original Message- From: Justin L. Spies [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:31 PM To: 'Tomcat Users List' Subject: RE: Name jdbc:comp is not bound in this context Nicole, Not sure if this was answered, but I'll give it a try. When I had this problem, I found that I needed to add useNaming=true to both the Host ... entry and to the Context ... entry. Sincerely, Pantek Incorporated Justin L. Spies URL: http://www.pantek.com Ph 440.519.1802 Fax 440.248.5274 Cell 440.336.3317 -Original Message- From: Nicole Hibbard [mailto:[EMAIL PROTECTED]] Sent: Monday, January 13, 2003 3:11 PM To: [EMAIL PROTECTED] Subject: Name jdbc:comp is not bound in this context I've gone through every resource I have in trying to test a connection to MySql database. I am using Tomcat 4.1.18-LE and MySql 3.23.53 and java 1.4.1_01. I set priveleges on MySql, put the mm.sql driver's jar in common/lib. I set my Classpath Variable .;C:\ServletDev;C:\jakarta-tomcat-4.1.18-LE-jdk14\common\lib\servlet.jar ;C:\ mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar I added the following to my server.xml !--1/07/2002 Nicole Hibbard The following block of code add the datasource for connecting mysql database using Connector J Driver -- Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Logger className = org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name = jdbc/TestDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !--Maximum number of dBconnections in pool. Make sure you configure your mysqld max_connection large enough to handle all you connections-- parameter namemaxActive/name value100/value /parameter parameter namepassword/name valuejavadude/value /parameter !-- Class name for JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your mysql db if the connection closes then auto connect -- parameter nameurl/name valuejdbc:mysql://localhost/javatest?user=javauser/value /parameter /ResourceParams /Context !--End of code from 1/7/2003 for Nicole Hibbard-- I created a web.xml in DBTest/WEB-INF ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//DN http://java.sun.com/dtd/web-app_2_3.dtd; web-app descriptionMySQL Test App /description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app I have a jsp in web-apps/DBTest html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html I have a DBTest.class in Webapps/DBtest/foo package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/TestDB); if (ds == null) foo= Datasource is null; if (ds != null) { Connection conn = ds.getConnection(); if (conn == null) foo=got datasource, no connection; if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst =