Re: Name jdbc is not bound in this Context error
Hi Antony, I downloaded postgres and installed on my m/c. I installed it as a service. Can you pls give step by step instruction as how to connect to postgresql database. Thank you so much. --- Antony Paul [EMAIL PROTECTED] wrote: You can name it the name of the context(web). The content should be similar to any other file there. I am giving a sample Context docBase=${catalina.home}/webapps/web antiResourceLocking=false antiJARLocking=false /Context rgds Antony Paul On Mon, 21 Feb 2005 23:18:55 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Thanks for the replies. What do u mean by the following in ur erlier mail. Did you defined your newly created context web in server.xml or at TOMCAT_HOME\conf\Catalina\localhost\some name.xml Does it mean i need to create a new xml file in TOMCAT_HOME\conf\Catalina\localhost? What should be it's name? What should it contain? Pls let me know. I will try that. I didn't create any file there. Thanks again. hope it will help. rgds Antony Paul On Mon, 21 Feb 2005 22:25:59 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Yes i read and did as per the document. When it didn't work, i followed the suggetions given to many users in the mailing lists in the internet and now i guess i messed up. Actually in the error, it says, no suitable driver found. I'm using Ms Access as it's free. Do we have any free driver available in the form of jar to use in place of JDBC-ODBC bridge driver? Or it's not required if configuration is correct. Pls let me know. I've pasted all relevant code in my first mail itself. If time permits, any of you can try give me the solution. It'll be a great help. I've integrated tomcat 5.5.7 with apache 2. Does this has any impact on the above. --- Antony Paul [EMAIL PROTECTED] wrote: If you followed the tomcat docs you will have no problem in DBCP getting to work. Going for Globalnamingresources is needed if you need to access it will all applications. Try to configure it as per the doc in following URL. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html follow MySQL config. And no need to put commons*.jar in commons/lib as TC by default comes with it. rgds Antony Paul On Mon, 21 Feb 2005 21:52:13 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i === message truncated === __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context error
In fact I hadnt installed it in windlws. You can connect to server suing psql. it will be in the bin directory. There is one GUI front end available PgAdmin. The documentation will be in doc directory. This contains installation, administration and tutorials on SQL. For further you can ask questions at PostgreSQL mailing lists(http://www.postgresql.org/community/lists/). rgds Antony Paul On Tue, 22 Feb 2005 02:07:20 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Hi Antony, I downloaded postgres and installed on my m/c. I installed it as a service. Can you pls give step by step instruction as how to connect to postgresql database. Thank you so much. --- Antony Paul [EMAIL PROTECTED] wrote: You can name it the name of the context(web). The content should be similar to any other file there. I am giving a sample Context docBase=${catalina.home}/webapps/web antiResourceLocking=false antiJARLocking=false /Context rgds Antony Paul On Mon, 21 Feb 2005 23:18:55 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Thanks for the replies. What do u mean by the following in ur erlier mail. Did you defined your newly created context web in server.xml or at TOMCAT_HOME\conf\Catalina\localhost\some name.xml Does it mean i need to create a new xml file in TOMCAT_HOME\conf\Catalina\localhost? What should be it's name? What should it contain? Pls let me know. I will try that. I didn't create any file there. Thanks again. hope it will help. rgds Antony Paul On Mon, 21 Feb 2005 22:25:59 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Yes i read and did as per the document. When it didn't work, i followed the suggetions given to many users in the mailing lists in the internet and now i guess i messed up. Actually in the error, it says, no suitable driver found. I'm using Ms Access as it's free. Do we have any free driver available in the form of jar to use in place of JDBC-ODBC bridge driver? Or it's not required if configuration is correct. Pls let me know. I've pasted all relevant code in my first mail itself. If time permits, any of you can try give me the solution. It'll be a great help. I've integrated tomcat 5.5.7 with apache 2. Does this has any impact on the above. --- Antony Paul [EMAIL PROTECTED] wrote: If you followed the tomcat docs you will have no problem in DBCP getting to work. Going for Globalnamingresources is needed if you need to access it will all applications. Try to configure it as per the doc in following URL. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html follow MySQL config. And no need to put commons*.jar in commons/lib as TC by default comes with it. rgds Antony Paul On Mon, 21 Feb 2005 21:52:13 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i === message truncated === __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? The all-new My Yahoo! - What will yours do? http://my.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context error
It seems you still have problem. You can google for the answer. One thing I know is GlobalNamingResources should come inside the Server element and not inside Context element. rgds Antony Paul On Fri, 18 Feb 2005 22:47:06 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I could able to get thro' JarperException. Thanks for replies. Now facing new problem. I'm getting NameNotFoundException - Name jdbc is not bound in this Context Environment what i'm using is: Apache 2, Tomcat 5.5, Netscape 7.2, MsAccess 2003 on windows 2000 machine. I integrated tomcat and apache as apache doesn't support jsps. I wrote a JSP called test-db.jsp which in turn calls java program TestSQLLoad.java. This TestSQLLoad.java performs dattabase operation, fetches the data from table and that data is displayed on Netscape thro' jsp. 1. test-db.jsp resides ina directory TOMCAT_HOME/webapps/web/JSP. Contents are as follows: %@ page contentType=text/html import=testpkg.TestSQLLoad% html head titleDB Test/title /head body % TestSQLLoad tst = new TestSQLLoad(); tst.init(); % h2Results/h2 User - %= tst.getUser() %br/ Pwd - %= tst.getPassword() %br/ Id - %= tst.getID() % /body /html 2. TestSQLLoad.java is residing in following directory. TOMCAT_HOME/webapps/web/classes/testpkg direcotry. Contents of this file are as follows: package testpkg; import javax.naming.*; import javax.sql.*; import java.sql.*; public class TestSQLLoad { String user = Not Connected; String pwd = no pwd; int id = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) { throw new Exception(Boom - No Context); } Context envCtx = (Context) ctx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/db1); //DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/db1); if (ds != null) { Connection conn = ds.getConnection(); if(conn != null) { user = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); String q = select name, password, id from user; ResultSet rst = stmt.executeQuery(q); if(rst.next()) { user=rst.getString(1); pwd=rst.getString(2); id = rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getUser() { return user; } public String getPassword() { return pwd; } public int getID() { return id; } } 3. I created a jar file using testpkg directory put it in TOMCAT_HOME/common/lib as well as TOMCAT_HOME/webapps/web/WEB-INF/lib directory. 4. I created MsAccess database called db1.mdb and put it in TOMCAT_HOME/WEBAPPS/WEB/db1 directory. I created a table called user with fields name, password and ID. ID is the primary key. 5. I included following in the server.xml of TOMCAT_HOME/conf directory. Context path=/db1 docBase=C:/tomcat/webapps/db1 debug=5 reloadable=true crossContext=true GlobalNamingResources Resource name=jdbc/db1 auth=Container type=javax.sql.DataSource factory=org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory driverClassName=sun.jdbc.odbc.JdbcOdbcDrive url=jdbc:odbc://localhost/db1 maxActive=20 maxIdle=10 maxWait=-1 / /GlobalNamingResources /Context 6. I included following in context.xml of TOMCAT_HOME/conf directory. ResourceLink global=jdbc/db1 name=jdbc/db1 type=javax.sql.DataSource/ 7. I included following in web.xml of TOMCAT_HOME/webapps/web/WEB-INF directory. resource-ref res-ref-namejdbc/db1/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref 8. I copied commons-collections-2.1.1.jar, commons-dbcp-1.2.1.jar and commons-pool-1.2.jar into TOMCAT_HOME/common/lib directory. 9. I started apache, tomcat and then opened a browser and typed http://localhost/web/JSP/test-db.jsp. 10. I get following on the browser. Results User - Not Connected Pwd - no pwd Id - -1 11. On the tomcat window where tomcat is running i'm getting following error. javax.naming.NameNotFoundException: Name jdbc is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:769) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(Resou rceLinkFactory.java:96) at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source) at
Re: Name jdbc is not bound in this Context error
As just moved the GlobalNamingResources inside the main server in my server.xml residing in TOMCAT_HOME/conf directory. When i restart tomcat 5.5.7 it's throwing up following exception. INFO: Starting Servlet Engine: Apache Tomcat/5.5.7 Feb 22, 2005 11:51:46 AM org.apache.catalina.realm.UserDatabaseRealm start SEVERE: Exception looking up UserDatabase under key UserDatabase javax.naming.NameNotFoundException: Name UserDatabase is not bound in this Conte xt at org.apache.naming.NamingContext.lookup(NamingContext.java:769) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j ava:222) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440 ) at org.apache.catalina.core.StandardService.start(StandardService.java:4 50) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683 ) at org.apache.catalina.startup.Catalina.start(Catalina.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409) Feb 22, 2005 11:51:46 AM org.apache.catalina.startup.Catalina start SEVERE: Catalina.start: LifecycleException: No UserDatabase component found under key UserDatabase at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j ava:228) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440 ) at org.apache.catalina.core.StandardService.start(StandardService.java:4 50) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683 ) at org.apache.catalina.startup.Catalina.start(Catalina.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409) Feb 22, 2005 11:51:46 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 391 ms Pls help to fix the problem. Thanks, Laxmi --- Antony Paul [EMAIL PROTECTED] wrote: It seems you still have problem. You can google for the answer. One thing I know is GlobalNamingResources should come inside the Server element and not inside Context element. rgds Antony Paul On Fri, 18 Feb 2005 22:47:06 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I could able to get thro' JarperException. Thanks for replies. Now facing new problem. I'm getting NameNotFoundException - Name jdbc is not bound in this Context Environment what i'm using is: Apache 2, Tomcat 5.5, Netscape 7.2, MsAccess 2003 on windows 2000 machine. I integrated tomcat and apache as apache doesn't support jsps. I wrote a JSP called test-db.jsp which in turn calls java program TestSQLLoad.java. This TestSQLLoad.java performs dattabase operation, fetches the data from table and that data is displayed on Netscape thro' jsp. 1. test-db.jsp resides ina directory TOMCAT_HOME/webapps/web/JSP. Contents are as follows: %@ page contentType=text/html import=testpkg.TestSQLLoad% html head titleDB Test/title /head body % TestSQLLoad tst = new TestSQLLoad(); tst.init(); % h2Results/h2 User - %= tst.getUser() %br/ Pwd - %= tst.getPassword() %br/ Id - %= tst.getID() % /body /html 2. TestSQLLoad.java is residing in following directory. TOMCAT_HOME/webapps/web/classes/testpkg direcotry. Contents of this file are as follows: package testpkg; import javax.naming.*; import javax.sql.*; import java.sql.*; public class TestSQLLoad { String user = Not Connected; String pwd = no pwd; int id = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) { throw new Exception(Boom - No Context); } Context envCtx = (Context) ctx.lookup(java:comp/env); DataSource ds = (DataSource) envCtx.lookup(jdbc/db1); //DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/db1);
Re: Name jdbc is not bound in this Context error
By default server.xml contains have a GlobalNamingResources. You have to add your resources in there. rgds Antony Paul On Mon, 21 Feb 2005 19:56:23 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: As just moved the GlobalNamingResources inside the main server in my server.xml residing in TOMCAT_HOME/conf directory. When i restart tomcat 5.5.7 it's throwing up following exception. INFO: Starting Servlet Engine: Apache Tomcat/5.5.7 Feb 22, 2005 11:51:46 AM org.apache.catalina.realm.UserDatabaseRealm start SEVERE: Exception looking up UserDatabase under key UserDatabase javax.naming.NameNotFoundException: Name UserDatabase is not bound in this Conte xt at org.apache.naming.NamingContext.lookup(NamingContext.java:769) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j ava:222) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440 ) at org.apache.catalina.core.StandardService.start(StandardService.java:4 50) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683 ) at org.apache.catalina.startup.Catalina.start(Catalina.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409) Feb 22, 2005 11:51:46 AM org.apache.catalina.startup.Catalina start SEVERE: Catalina.start: LifecycleException: No UserDatabase component found under key UserDatabase at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j ava:228) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440 ) at org.apache.catalina.core.StandardService.start(StandardService.java:4 50) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683 ) at org.apache.catalina.startup.Catalina.start(Catalina.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409) Feb 22, 2005 11:51:46 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 391 ms Pls help to fix the problem. Thanks, Laxmi --- Antony Paul [EMAIL PROTECTED] wrote: It seems you still have problem. You can google for the answer. One thing I know is GlobalNamingResources should come inside the Server element and not inside Context element. rgds Antony Paul On Fri, 18 Feb 2005 22:47:06 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I could able to get thro' JarperException. Thanks for replies. Now facing new problem. I'm getting NameNotFoundException - Name jdbc is not bound in this Context Environment what i'm using is: Apache 2, Tomcat 5.5, Netscape 7.2, MsAccess 2003 on windows 2000 machine. I integrated tomcat and apache as apache doesn't support jsps. I wrote a JSP called test-db.jsp which in turn calls java program TestSQLLoad.java. This TestSQLLoad.java performs dattabase operation, fetches the data from table and that data is displayed on Netscape thro' jsp. 1. test-db.jsp resides ina directory TOMCAT_HOME/webapps/web/JSP. Contents are as follows: %@ page contentType=text/html import=testpkg.TestSQLLoad% html head titleDB Test/title /head body % TestSQLLoad tst = new TestSQLLoad(); tst.init(); % h2Results/h2 User - %= tst.getUser() %br/ Pwd - %= tst.getPassword() %br/ Id - %= tst.getID() % /body /html 2. TestSQLLoad.java is residing in following directory. TOMCAT_HOME/webapps/web/classes/testpkg direcotry. Contents of this file are as follows: package testpkg; import javax.naming.*; import javax.sql.*; import java.sql.*; public class TestSQLLoad { String user = Not Connected; String pwd = no pwd; int id = -1; public void init() { try{
Re: Name jdbc is not bound in this Context error
I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i coded all database related stuff in JSP in the way we do in stand alone application. I mean - Coding like this in jspo itself. code -- %@ page contentType=text/html import=java.sql.*% html headtitlesimmPlan - simple material planning system/title script language=JavaScript src=/js/default.js/script % String userid = request.getParameter(userid); String passwd = request.getParameter(passwd); System.out.println(Password: + passwd); String pwd = , str = ; int level = -1, ind = -1; try { Connection conn = null; Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); conn=DriverManager.getConnection(jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=C:/tomcat/webapps/db1/db1.mdb); Statement stmt = conn.createStatement(); String query = SELECT * FROM user where name = ' + userid + '; ResultSet st = stmt.executeQuery(query); if (st.next()) { pwd = st.getString(password); level = st.getInt(level); System.err.println(Query result=+userid+/+pwd+/+level); } else { ind = -2; System.out.println(No user with name + userid + available in the database); } if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } catch (Exception e) { e.printStackTrace(); } if(pwd.equals(passwd)) { ind = level; } // else ind = -1; System.out.println(Ind - + ind); % script language=JavaScript type=text/JavaScript var ind = %= ind % function loadHtml() { //alert(in loadHtml()); if(ind == -2) { alert(Not a valid user); location.href = login.jsp; return; } if (ind == -1) { alert(Incorrect password); location.href = login.jsp; return; } else { //alert(Correct password); location.href = Second_Page.html; return; } } /script /head body onload=javascript:loadHtml() !-- User Name : %= userid %br Password : %= passwd % -- /body /html --- code ends here --- It works. But is it the right way to do? Pls advice. --- Antony Paul [EMAIL PROTECTED] wrote: By default server.xml contains have a GlobalNamingResources. You have to add your resources in there. rgds Antony Paul On Mon, 21 Feb 2005 19:56:23 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: As just moved the GlobalNamingResources inside the main server in my server.xml residing in TOMCAT_HOME/conf directory. When i restart tomcat 5.5.7 it's throwing up following exception. INFO: Starting Servlet Engine: Apache Tomcat/5.5.7 Feb 22, 2005 11:51:46 AM org.apache.catalina.realm.UserDatabaseRealm start SEVERE: Exception looking up UserDatabase under key UserDatabase javax.naming.NameNotFoundException: Name UserDatabase is not bound in this Conte xt at org.apache.naming.NamingContext.lookup(NamingContext.java:769) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j ava:222) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440 ) at org.apache.catalina.core.StandardService.start(StandardService.java:4 50) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683 ) at org.apache.catalina.startup.Catalina.start(Catalina.java:537) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409) Feb 22, 2005 11:51:46 AM org.apache.catalina.startup.Catalina
Re: Name jdbc is not bound in this Context error
U K, It works as you said, but there are a couple of things I'll recommend: First, you should move your Connection, ResultSet and Statement declarations before the try {} block and add a finally {} block where you check for null values and close the resources if not null. Connection conn = null; Statement stmt = null; ResultSet res = null; try { .. } catch { } finally { if (stmt != null ) { try { stmnt.close(); } catch (SQLException se) { log.error(se.getMessage); } } Second, you should use a connection pool. I don't have a Tomcat config readily available. But can follow up with one if you need it. -Robert U K Laxmi wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i coded all database related stuff in JSP in the way we do in stand alone application. I mean - Coding like this in jspo itself. code -- %@ page contentType=text/html import=java.sql.*% html headtitlesimmPlan - simple material planning system/title script language=JavaScript src=/js/default.js/script % String userid = request.getParameter(userid); String passwd = request.getParameter(passwd); System.out.println(Password: + passwd); String pwd = , str = ; int level = -1, ind = -1; try { Connection conn = null; Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); conn=DriverManager.getConnection(jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=C:/tomcat/webapps/db1/db1.mdb); Statement stmt = conn.createStatement(); String query = SELECT * FROM user where name = ' + userid + '; ResultSet st = stmt.executeQuery(query); if (st.next()) { pwd = st.getString(password); level = st.getInt(level); System.err.println(Query result=+userid+/+pwd+/+level); } else { ind = -2; System.out.println(No user with name + userid + available in the database); } if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } catch (Exception e) { e.printStackTrace(); } if(pwd.equals(passwd)) { ind = level; } // else ind = -1; System.out.println(Ind - + ind); % script language=JavaScript type=text/JavaScript var ind = %= ind % function loadHtml() { //alert(in loadHtml()); if(ind == -2) { alert(Not a valid user); location.href = login.jsp; return; } if (ind == -1) { alert(Incorrect password); location.href = login.jsp; return; } else { //alert(Correct password); location.href = Second_Page.html; return; } } /script /head body onload=javascript:loadHtml() !-- User Name : %= userid %br Password : %= passwd % -- /body /html --- code ends here --- It works. But is it the right way to do? Pls advice. --- Antony Paul [EMAIL PROTECTED] wrote: By default server.xml contains have a GlobalNamingResources. You have to add your resources in there. rgds Antony Paul On Mon, 21 Feb 2005 19:56:23 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: As just moved the GlobalNamingResources inside the main server in my server.xml residing in TOMCAT_HOME/conf directory. When i restart tomcat 5.5.7 it's throwing up following exception. INFO: Starting Servlet Engine: Apache Tomcat/5.5.7 Feb 22, 2005 11:51:46 AM org.apache.catalina.realm.UserDatabaseRealm start SEVERE: Exception looking up UserDatabase under key UserDatabase javax.naming.NameNotFoundException: Name UserDatabase is not bound in this Conte xt at org.apache.naming.NamingContext.lookup(NamingContext.java:769) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j ava:222) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440 ) at org.apache.catalina.core.StandardService.start(StandardService.java:4 50) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683 ) at org.apache.catalina.startup.Catalina.start(Catalina.java:537) at
Re: Name jdbc is not bound in this Context error
If you followed the tomcat docs you will have no problem in DBCP getting to work. Going for Globalnamingresources is needed if you need to access it will all applications. Try to configure it as per the doc in following URL. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html follow MySQL config. And no need to put commons*.jar in commons/lib as TC by default comes with it. rgds Antony Paul On Mon, 21 Feb 2005 21:52:13 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i coded all database related stuff in JSP in the way we do in stand alone application. I mean - Coding like this in jspo itself. code -- %@ page contentType=text/html import=java.sql.*% html headtitlesimmPlan - simple material planning system/title script language=JavaScript src=/js/default.js/script % String userid = request.getParameter(userid); String passwd = request.getParameter(passwd); System.out.println(Password: + passwd); String pwd = , str = ; int level = -1, ind = -1; try { Connection conn = null; Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); conn=DriverManager.getConnection(jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=C:/tomcat/webapps/db1/db1.mdb); Statement stmt = conn.createStatement(); String query = SELECT * FROM user where name = ' + userid + '; ResultSet st = stmt.executeQuery(query); if (st.next()) { pwd = st.getString(password); level = st.getInt(level); System.err.println(Query result=+userid+/+pwd+/+level); } else { ind = -2; System.out.println(No user with name + userid + available in the database); } if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } catch (Exception e) { e.printStackTrace(); } if(pwd.equals(passwd)) { ind = level; } // else ind = -1; System.out.println(Ind - + ind); % script language=JavaScript type=text/JavaScript var ind = %= ind % function loadHtml() { //alert(in loadHtml()); if(ind == -2) { alert(Not a valid user); location.href = login.jsp; return; } if (ind == -1) { alert(Incorrect password); location.href = login.jsp; return; } else { //alert(Correct password); location.href = Second_Page.html; return; } } /script /head body onload=javascript:loadHtml() !-- User Name : %= userid %br Password : %= passwd % -- /body /html --- code ends here --- It works. But is it the right way to do? Pls advice. --- Antony Paul [EMAIL PROTECTED] wrote: By default server.xml contains have a GlobalNamingResources. You have to add your resources in there. rgds Antony Paul On Mon, 21 Feb 2005 19:56:23 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: As just moved the GlobalNamingResources inside the main server in my server.xml residing in TOMCAT_HOME/conf directory. When i restart tomcat 5.5.7 it's throwing up following exception. INFO: Starting Servlet Engine: Apache Tomcat/5.5.7 Feb 22, 2005 11:51:46 AM org.apache.catalina.realm.UserDatabaseRealm start SEVERE: Exception looking up UserDatabase under key UserDatabase javax.naming.NameNotFoundException: Name UserDatabase is not bound in this Conte xt at org.apache.naming.NamingContext.lookup(NamingContext.java:769) at org.apache.naming.NamingContext.lookup(NamingContext.java:152) at org.apache.catalina.realm.UserDatabaseRealm.start(UserDatabaseRealm.j ava:222) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440 ) at org.apache.catalina.core.StandardService.start(StandardService.java:4 50) at org.apache.catalina.core.StandardServer.start(StandardServer.java:683 ) at
Re: Name jdbc is not bound in this Context error
Sure to do the changes you mentioned. Pls do send the config file for connection pooling and also guidelines for how to use it in my program. It will be a great help. I'm developing web based application for using it inhouse. Later part of time, it may grow to a big MRP application based on the requirement of the company. If i go ahead with this kind of structure (the one i sent in my previous mail), does it cause any rpoblems? Pls advice. --- Robert F Hall [EMAIL PROTECTED] wrote: U K, It works as you said, but there are a couple of things I'll recommend: First, you should move your Connection, ResultSet and Statement declarations before the try {} block and add a finally {} block where you check for null values and close the resources if not null. Connection conn = null; Statement stmt = null; ResultSet res = null; try { .. } catch { } finally { if (stmt != null ) { try { stmnt.close(); } catch (SQLException se) { log.error(se.getMessage); } } Second, you should use a connection pool. I don't have a Tomcat config readily available. But can follow up with one if you need it. -Robert U K Laxmi wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i coded all database related stuff in JSP in the way we do in stand alone application. I mean - Coding like this in jspo itself. code -- %@ page contentType=text/html import=java.sql.*% html headtitlesimmPlan - simple material planning system/title script language=JavaScript src=/js/default.js/script % String userid = request.getParameter(userid); String passwd = request.getParameter(passwd); System.out.println(Password: + passwd); String pwd = , str = ; int level = -1, ind = -1; try { Connection conn = null; Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); conn=DriverManager.getConnection(jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=C:/tomcat/webapps/db1/db1.mdb); Statement stmt = conn.createStatement(); String query = SELECT * FROM user where name = ' + userid + '; ResultSet st = stmt.executeQuery(query); if (st.next()) { pwd = st.getString(password); level = st.getInt(level); System.err.println(Query result=+userid+/+pwd+/+level); } else { ind = -2; System.out.println(No user with name + userid + available in the database); } if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } catch (Exception e) { e.printStackTrace(); } if(pwd.equals(passwd)) { ind = level; } // else ind = -1; System.out.println(Ind - + ind); % script language=JavaScript type=text/JavaScript var ind = %= ind % function loadHtml() { //alert(in loadHtml()); if(ind == -2) { alert(Not a valid user); location.href = login.jsp; return; } if (ind == -1) { alert(Incorrect password); location.href = login.jsp; return; } else { //alert(Correct password); location.href = Second_Page.html; return; } } /script /head body onload=javascript:loadHtml() !-- User Name : %= userid %br Password : %= passwd % -- /body /html --- code ends here --- It works. But is it the right way to do? Pls advice. --- Antony Paul [EMAIL PROTECTED] wrote: By default server.xml contains have a GlobalNamingResources. You have to add your resources in there. rgds Antony Paul On Mon, 21 Feb 2005 19:56:23 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: As just moved the GlobalNamingResources inside the main server in my server.xml residing in TOMCAT_HOME/conf directory. When i restart tomcat 5.5.7 it's throwing up following exception. INFO: Starting Servlet Engine:
Re: Name jdbc is not bound in this Context error
Yes i read and did as per the document. When it didn't work, i followed the suggetions given to many users in the mailing lists in the internet and now i guess i messed up. Actually in the error, it says, no suitable driver found. I'm using Ms Access as it's free. Do we have any free driver available in the form of jar to use in place of JDBC-ODBC bridge driver? Or it's not required if configuration is correct. Pls let me know. I've pasted all relevant code in my first mail itself. If time permits, any of you can try give me the solution. It'll be a great help. I've integrated tomcat 5.5.7 with apache 2. Does this has any impact on the above. --- Antony Paul [EMAIL PROTECTED] wrote: If you followed the tomcat docs you will have no problem in DBCP getting to work. Going for Globalnamingresources is needed if you need to access it will all applications. Try to configure it as per the doc in following URL. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html follow MySQL config. And no need to put commons*.jar in commons/lib as TC by default comes with it. rgds Antony Paul On Mon, 21 Feb 2005 21:52:13 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i coded all database related stuff in JSP in the way we do in stand alone application. I mean - Coding like this in jspo itself. code -- %@ page contentType=text/html import=java.sql.*% html headtitlesimmPlan - simple material planning system/title script language=JavaScript src=/js/default.js/script % String userid = request.getParameter(userid); String passwd = request.getParameter(passwd); System.out.println(Password: + passwd); String pwd = , str = ; int level = -1, ind = -1; try { Connection conn = null; Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); conn=DriverManager.getConnection(jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=C:/tomcat/webapps/db1/db1.mdb); Statement stmt = conn.createStatement(); String query = SELECT * FROM user where name = ' + userid + '; ResultSet st = stmt.executeQuery(query); if (st.next()) { pwd = st.getString(password); level = st.getInt(level); System.err.println(Query result=+userid+/+pwd+/+level); } else { ind = -2; System.out.println(No user with name + userid + available in the database); } if (stmt != null) { stmt.close(); } if (conn != null) { conn.close(); } } catch (Exception e) { e.printStackTrace(); } if(pwd.equals(passwd)) { ind = level; } // else ind = -1; System.out.println(Ind - + ind); % script language=JavaScript type=text/JavaScript var ind = %= ind % function loadHtml() { //alert(in loadHtml()); if(ind == -2) { alert(Not a valid user); location.href = login.jsp; return; } if (ind == -1) { alert(Incorrect password); location.href = login.jsp; return; } else { //alert(Correct password); location.href = Second_Page.html; return; } } /script /head body onload=javascript:loadHtml() !-- User Name : %= userid %br Password : %= passwd % -- /body /html --- code ends here --- It works. But is it the right way to do? Pls advice. --- Antony Paul [EMAIL PROTECTED] wrote: By default server.xml contains have a GlobalNamingResources. You have to add your resources in there. rgds Antony Paul On Mon, 21 Feb 2005 19:56:23 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: As just moved the GlobalNamingResources inside the main server in my server.xml residing in TOMCAT_HOME/conf directory. When i restart tomcat 5.5.7 it's throwing up following exception. INFO: Starting Servlet Engine: Apache Tomcat/5.5.7 Feb 22, 2005 11:51:46 AM org.apache.catalina.realm.UserDatabaseRealm start SEVERE:
Re: Name jdbc is not bound in this Context error
I dont whether MS Access is considered as RDBMS. For serious development it is not recommended. Using ODBC have several problems. I will recommend PostgreSQL. Now it runs very well on Windows. But requires Windows 2000 or higher. You can find it at http://www.postgresql.org/ftp/binary/v8.0.1/win32/. I am using it and have no problems. I am posting my configuration that I used to set up DBCP. server.xml --- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / Resource name=jdbc/db1 auth=Container type=javax.sql.DataSource factory=org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory driverClassName=org.postgresql.Driver url=jdbc:postgresql://192.168.4.248/antony maxActive=20 maxIdle=10 maxWait=-1 username=benchmark password=benchmark / /GlobalNamingResources TOMCAT_HOME/conf/context.xml --- ResourceLink global=jdbc/db1 name=jdbc/db1 type=javax.sql.DataSource/ TOMCAT_HOME/webapps/web/WEB-INF/web.xml - resource-ref res-ref-namejdbc/db1/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Did you defined your newly created context web in server.xml or at TOMCAT_HOME\conf\Catalina\localhost\some name.xml hope it will help. rgds Antony Paul On Mon, 21 Feb 2005 22:25:59 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Yes i read and did as per the document. When it didn't work, i followed the suggetions given to many users in the mailing lists in the internet and now i guess i messed up. Actually in the error, it says, no suitable driver found. I'm using Ms Access as it's free. Do we have any free driver available in the form of jar to use in place of JDBC-ODBC bridge driver? Or it's not required if configuration is correct. Pls let me know. I've pasted all relevant code in my first mail itself. If time permits, any of you can try give me the solution. It'll be a great help. I've integrated tomcat 5.5.7 with apache 2. Does this has any impact on the above. --- Antony Paul [EMAIL PROTECTED] wrote: If you followed the tomcat docs you will have no problem in DBCP getting to work. Going for Globalnamingresources is needed if you need to access it will all applications. Try to configure it as per the doc in following URL. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html follow MySQL config. And no need to put commons*.jar in commons/lib as TC by default comes with it. rgds Antony Paul On Mon, 21 Feb 2005 21:52:13 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i coded all database related stuff in JSP in the way we do in stand alone application. I mean - Coding like this in jspo itself. code -- %@ page contentType=text/html import=java.sql.*% html headtitlesimmPlan - simple material planning system/title script language=JavaScript src=/js/default.js/script % String userid = request.getParameter(userid); String passwd = request.getParameter(passwd); System.out.println(Password: + passwd); String pwd = , str = ; int level = -1, ind = -1; try { Connection conn = null; Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); conn=DriverManager.getConnection(jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=C:/tomcat/webapps/db1/db1.mdb); Statement stmt = conn.createStatement(); String query = SELECT * FROM user where name = ' + userid + '; ResultSet st = stmt.executeQuery(query); if (st.next()) { pwd = st.getString(password); level = st.getInt(level); System.err.println(Query result=+userid+/+pwd+/+level); } else { ind = -2; System.out.println(No user with name + userid + available in the
Re: Name jdbc is not bound in this Context error
Thank you for the replies. Ms Access is not a relational databaase. It's just DBMS. I didn't know that PostGreSQL is a open source RDBMS system. All the sqls, table creation etc.. works similar to Oracle or any other RDBMS? I'm working on windows 2000 machine. --- Antony Paul [EMAIL PROTECTED] wrote: I dont whether MS Access is considered as RDBMS. For serious development it is not recommended. Using ODBC have several problems. I will recommend PostgreSQL. Now it runs very well on Windows. But requires Windows 2000 or higher. You can find it at http://www.postgresql.org/ftp/binary/v8.0.1/win32/. I am using it and have no problems. I am posting my configuration that I used to set up DBCP. server.xml --- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / Resource name=jdbc/db1 auth=Container type=javax.sql.DataSource factory=org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory driverClassName=org.postgresql.Driver url=jdbc:postgresql://192.168.4.248/antony maxActive=20 maxIdle=10 maxWait=-1 username=benchmark password=benchmark / /GlobalNamingResources TOMCAT_HOME/conf/context.xml --- ResourceLink global=jdbc/db1 name=jdbc/db1 type=javax.sql.DataSource/ TOMCAT_HOME/webapps/web/WEB-INF/web.xml - resource-ref res-ref-namejdbc/db1/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Did you defined your newly created context web in server.xml or at TOMCAT_HOME\conf\Catalina\localhost\some name.xml hope it will help. rgds Antony Paul On Mon, 21 Feb 2005 22:25:59 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Yes i read and did as per the document. When it didn't work, i followed the suggetions given to many users in the mailing lists in the internet and now i guess i messed up. Actually in the error, it says, no suitable driver found. I'm using Ms Access as it's free. Do we have any free driver available in the form of jar to use in place of JDBC-ODBC bridge driver? Or it's not required if configuration is correct. Pls let me know. I've pasted all relevant code in my first mail itself. If time permits, any of you can try give me the solution. It'll be a great help. I've integrated tomcat 5.5.7 with apache 2. Does this has any impact on the above. --- Antony Paul [EMAIL PROTECTED] wrote: If you followed the tomcat docs you will have no problem in DBCP getting to work. Going for Globalnamingresources is needed if you need to access it will all applications. Try to configure it as per the doc in following URL. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html follow MySQL config. And no need to put commons*.jar in commons/lib as TC by default comes with it. rgds Antony Paul On Mon, 21 Feb 2005 21:52:13 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i coded all database related stuff in JSP in the way we do in stand alone application. I mean - Coding like this in jspo itself. code -- %@ page contentType=text/html import=java.sql.*% html headtitlesimmPlan - simple material planning system/title script language=JavaScript src=/js/default.js/script % String userid = request.getParameter(userid); String passwd = request.getParameter(passwd); System.out.println(Password: + passwd); String pwd = , str = ; int level = -1, ind = -1; try { Connection conn = null; Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); conn=DriverManager.getConnection(jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=C:/tomcat/webapps/db1/db1.mdb); Statement stmt = conn.createStatement(); String query = SELECT * FROM user where name = ' + userid + ';
Re: Name jdbc is not bound in this Context error
Most SQL is same and it supports a subset of SQL 92 and SQL 99 standards. Every RDBMS vendor have some proprietory code which dont work in other databases. There is one RDBMS Firebird(http://firebird.sourceforge.net/). The site claims that it is more like Oracle. rgds Antony Paul On Mon, 21 Feb 2005 23:01:40 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Thank you for the replies. Ms Access is not a relational databaase. It's just DBMS. I didn't know that PostGreSQL is a open source RDBMS system. All the sqls, table creation etc.. works similar to Oracle or any other RDBMS? I'm working on windows 2000 machine. --- Antony Paul [EMAIL PROTECTED] wrote: I dont whether MS Access is considered as RDBMS. For serious development it is not recommended. Using ODBC have several problems. I will recommend PostgreSQL. Now it runs very well on Windows. But requires Windows 2000 or higher. You can find it at http://www.postgresql.org/ftp/binary/v8.0.1/win32/. I am using it and have no problems. I am posting my configuration that I used to set up DBCP. server.xml --- GlobalNamingResources !-- Test entry for demonstration purposes -- Environment name=simpleValue type=java.lang.Integer value=30/ !-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -- Resource name=UserDatabase auth=Container type=org.apache.catalina.UserDatabase description=User database that can be updated and saved factory=org.apache.catalina.users.MemoryUserDatabaseFactory pathname=conf/tomcat-users.xml / Resource name=jdbc/db1 auth=Container type=javax.sql.DataSource factory=org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory driverClassName=org.postgresql.Driver url=jdbc:postgresql://192.168.4.248/antony maxActive=20 maxIdle=10 maxWait=-1 username=benchmark password=benchmark / /GlobalNamingResources TOMCAT_HOME/conf/context.xml --- ResourceLink global=jdbc/db1 name=jdbc/db1 type=javax.sql.DataSource/ TOMCAT_HOME/webapps/web/WEB-INF/web.xml - resource-ref res-ref-namejdbc/db1/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Did you defined your newly created context web in server.xml or at TOMCAT_HOME\conf\Catalina\localhost\some name.xml hope it will help. rgds Antony Paul On Mon, 21 Feb 2005 22:25:59 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Yes i read and did as per the document. When it didn't work, i followed the suggetions given to many users in the mailing lists in the internet and now i guess i messed up. Actually in the error, it says, no suitable driver found. I'm using Ms Access as it's free. Do we have any free driver available in the form of jar to use in place of JDBC-ODBC bridge driver? Or it's not required if configuration is correct. Pls let me know. I've pasted all relevant code in my first mail itself. If time permits, any of you can try give me the solution. It'll be a great help. I've integrated tomcat 5.5.7 with apache 2. Does this has any impact on the above. --- Antony Paul [EMAIL PROTECTED] wrote: If you followed the tomcat docs you will have no problem in DBCP getting to work. Going for Globalnamingresources is needed if you need to access it will all applications. Try to configure it as per the doc in following URL. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html follow MySQL config. And no need to put commons*.jar in commons/lib as TC by default comes with it. rgds Antony Paul On Mon, 21 Feb 2005 21:52:13 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i coded all database related stuff in JSP in the way we do in stand alone application. I mean - Coding like this in jspo itself. code -- %@ page contentType=text/html import=java.sql.*% html headtitlesimmPlan - simple material planning system/title script language=JavaScript src=/js/default.js/script % String userid = request.getParameter(userid); String passwd = request.getParameter(passwd); System.out.println(Password: + passwd); String pwd = , str = ;
Re: Name jdbc is not bound in this Context error
Thanks for the replies. What do u mean by the following in ur erlier mail. Did you defined your newly created context web in server.xml or at TOMCAT_HOME\conf\Catalina\localhost\some name.xml Does it mean i need to create a new xml file in TOMCAT_HOME\conf\Catalina\localhost? What should be it's name? What should it contain? Pls let me know. I will try that. I didn't create any file there. Thanks again. hope it will help. rgds Antony Paul On Mon, 21 Feb 2005 22:25:59 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Yes i read and did as per the document. When it didn't work, i followed the suggetions given to many users in the mailing lists in the internet and now i guess i messed up. Actually in the error, it says, no suitable driver found. I'm using Ms Access as it's free. Do we have any free driver available in the form of jar to use in place of JDBC-ODBC bridge driver? Or it's not required if configuration is correct. Pls let me know. I've pasted all relevant code in my first mail itself. If time permits, any of you can try give me the solution. It'll be a great help. I've integrated tomcat 5.5.7 with apache 2. Does this has any impact on the above. --- Antony Paul [EMAIL PROTECTED] wrote: If you followed the tomcat docs you will have no problem in DBCP getting to work. Going for Globalnamingresources is needed if you need to access it will all applications. Try to configure it as per the doc in following URL. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html follow MySQL config. And no need to put commons*.jar in commons/lib as TC by default comes with it. rgds Antony Paul On Mon, 21 Feb 2005 21:52:13 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i === message truncated === __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context error
You can name it the name of the context(web). The content should be similar to any other file there. I am giving a sample Context docBase=${catalina.home}/webapps/web antiResourceLocking=false antiJARLocking=false /Context rgds Antony Paul On Mon, 21 Feb 2005 23:18:55 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Thanks for the replies. What do u mean by the following in ur erlier mail. Did you defined your newly created context web in server.xml or at TOMCAT_HOME\conf\Catalina\localhost\some name.xml Does it mean i need to create a new xml file in TOMCAT_HOME\conf\Catalina\localhost? What should be it's name? What should it contain? Pls let me know. I will try that. I didn't create any file there. Thanks again. hope it will help. rgds Antony Paul On Mon, 21 Feb 2005 22:25:59 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: Yes i read and did as per the document. When it didn't work, i followed the suggetions given to many users in the mailing lists in the internet and now i guess i messed up. Actually in the error, it says, no suitable driver found. I'm using Ms Access as it's free. Do we have any free driver available in the form of jar to use in place of JDBC-ODBC bridge driver? Or it's not required if configuration is correct. Pls let me know. I've pasted all relevant code in my first mail itself. If time permits, any of you can try give me the solution. It'll be a great help. I've integrated tomcat 5.5.7 with apache 2. Does this has any impact on the above. --- Antony Paul [EMAIL PROTECTED] wrote: If you followed the tomcat docs you will have no problem in DBCP getting to work. Going for Globalnamingresources is needed if you need to access it will all applications. Try to configure it as per the doc in following URL. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html follow MySQL config. And no need to put commons*.jar in commons/lib as TC by default comes with it. rgds Antony Paul On Mon, 21 Feb 2005 21:52:13 -0800 (PST), U K Laxmi [EMAIL PROTECTED] wrote: I tried without GlobalNamingResources. No luck. When googled, i found that if we include GlobalNamingResource tag, then it will be available in all web context. After spending enough time on that, now i === message truncated === __ Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Name jdbc is not bound in this Context
Hi, I bet it's just your webapp code that's looking for jdbc instead of jdbc/myapp ;) Your config (original: you don't need to do the GlobalResources stuff, your original config is better) looks fine. Yoav Shapira -Original Message- From: Mauro Romano Trajber [mailto:[EMAIL PROTECTED] Sent: Saturday, October 09, 2004 11:34 AM To: [EMAIL PROTECTED] Subject: Name jdbc is not bound in this Context I have configured the following datasource in $TOMCAT_HOME/conf/Catalina/localhost/myapp.xml: Context ... Resource name=jdbc/myapp type=javax.sql.DataSource/ ResourceParams name=jdbc/myapp parameternamefactory/namevalueorg.apache.commons.dbcp.BasicData Sour ceFactory/value/parameter parameternamedriverClassName/namevaluecom.mysql.jdbc.Driver/va lue /parameter parameternameurl/namevaluejdbc:mysql://localhost/myappt/value /pa rameter ... /ResourceParams /Context Then in my web.xml: ... resource-ref res-ref-namejdbc/myapp/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref ... I'm trying to use Hibernate throung Hibernate Synchronizer Eclipse Plugin, using JNDI. But I keep getting the error: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context What's missing ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.
Re: Name jdbc is not bound in this Context
If you put the ResourceParams stuff in server.xml as GlobalResource, you must put e.g. this into your server.xml's context respectively your myapp.xml context descriptor. ResourceLink name=jdbc/myapp global=jdbc/myapp type=javax.sql.DataSource/ResourceLink Of course name and global can differ, but I think this is easiest. There's some hint in the Tomcat 5 docu that this is needed to make global JNDI resources visible to web apps. But it's too easy to forget... Cheers, Michael Mauro Romano Trajber wrote: I have configured the following datasource in $TOMCAT_HOME/conf/Catalina/localhost/myapp.xml: Context ... Resource name=jdbc/myapp type=javax.sql.DataSource/ ResourceParams name=jdbc/myapp parameternamefactory/namevalueorg.apache.commons.dbcp.BasicDataSourceFactory/value/parameter parameternamedriverClassName/namevaluecom.mysql.jdbc.Driver/value/parameter parameternameurl/namevaluejdbc:mysql://localhost/myappt/value/parameter ... /ResourceParams /Context Then in my web.xml: ... resource-ref res-ref-namejdbc/myapp/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref ... I'm trying to use Hibernate throung Hibernate Synchronizer Eclipse Plugin, using JNDI. But I keep getting the error: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context What's missing ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context
On Sat, 09 Oct 2004 19:48:45 +0200, Michael Echerer [EMAIL PROTECTED] wrote: If you put the ResourceParams stuff in server.xml as GlobalResource, you must put e.g. this into your server.xml's context respectively your myapp.xml context descriptor. Ok, did it ResourceLink name=jdbc/myapp global=jdbc/myapp type=javax.sql.DataSource/ResourceLink Ok, did it Of course name and global can differ, but I think this is easiest. There's some hint in the Tomcat 5 docu that this is needed to make global JNDI resources visible to web apps. But it's too easy to forget... Same error as before ... javax.naming.NameNotFoundException: Name jdbc is not bound in this Context But isn't it strange that it says Name jdbc is ... instead of Name jdbc/myapp is ... ?? Cheers, Michael - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context
On Thu, Sep 09, 2004 at 10:28:32AM -0300, Kelly C. Goedert wrote: : I'm getting this error Name jdbc is not bound in this Context on my : application. My tomcat version is 5.0.27. ResourceLink ? See the Tomcat docs for details. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context
I thought I only needed ResourceLink if I had made the datasource Global. Do I need it even if it is not declared globally? QM wrote: On Thu, Sep 09, 2004 at 10:28:32AM -0300, Kelly C. Goedert wrote: : I'm getting this error Name jdbc is not bound in this Context on my : application. My tomcat version is 5.0.27. ResourceLink ? See the Tomcat docs for details. -QM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context
Most of it looks good. driverClassName on a recent mysql jar should be com.mysql.jdbc.Driver instead of the ancient org.gjt. stuff. The mysql jar should be located in common/lib if you're using the container supplied dbcp pooling. If you happen to move the mysql jar file, you'll have to restart tomcat to register the change with the common/lib classloader. Use the manager app to restart your context if you change anything in the context definition. --David Kelly C. Goedert wrote: Hi, I'm getting this error Name jdbc is not bound in this Context on my application. My tomcat version is 5.0.27. The servlet that is causing this error is trying to access a database with the following code: protected IDatabaseConnection getConnection() throws Exception { Context ic = new InitialContext(); Context ctx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource) ic.lookup(jdbc/boxes-cactus); con = new DatabaseDataSourceConnection( ds); return con; } My web.xml has the following configuration to the datasource: resource-ref descriptionDB Connection/description res-ref-namejdbc/boxes-cactus/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref And in $TOMCAT_HOME/conf/ Catalina/localhost/boxes-cactus.xml I got this Context path=/boxes-cactus docBase=boxes-cactus debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/boxes-cactus auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/boxes-cactus parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter !-- Maximum number of dB connections in pool. Make sure you configure your mysqld max_connections large enough to handle all of your db connections. Set to 0 for no limit. -- parameter namemaxActive/name value100/value /parameter !-- Maximum number of idle dB connections to retain in pool. Set to -1 for no limit. See also the DBCP documentation on this and the minEvictableIdleTimeMillis configuration parameter. -- parameter namemaxIdle/name value30/value /parameter !-- Maximum time to wait for a dB connection to become available in ms, in this example 10 seconds. An Exception is thrown if this timeout is exceeded. Set to -1 to wait indefinitely. -- parameter namemaxWait/name value1/value /parameter !-- MySQL dB username and password for dB connections -- parameter nameusername/name valueroot/value /parameter parameter namepassword/name valuex/value /parameter !-- Class name for the old mm.mysql JDBC driver - uncomment this entry and comment next if you want to use this driver - we recommend using Connector/J though parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter -- !-- Class name for the official MySQL Connector/J driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- The JDBC connection url for connecting to your MySQL dB. The autoReconnect=true argument to the url makes sure that the mm.mysql JDBC Driver will automatically reconnect if mysqld closed the connection. mysqld by default closes idle connections after 8 hours. -- parameter nameurl/name valuejdbc:mysql://localhost:3306/BOXES?autoReconnect=true/value /parameter /ResourceParams /Context Can anyone help? Kelly. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context
Idem error to me, but with realm using DataSource: problem is that DataSourceRealm can not find JNDI name in context. There are a bug in tomcat 4.1, but this was resolved. My xml in Catalina/localhost content: ?xml version='1.0' encoding='utf-8'? Context displayName=Gestion de cunetas. docBase=/home/angel/workspace/yeguadas/tmp/web path=/yeguadas useNaming=false Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=jdbc/YeguadasDB roleNameCol=NOMBRE userCredCol=PASSWORD userNameCol=NOMBRELOGIN userRoleTable=USUARIO_PERFILES userTable=USUARIO/ Resource auth=Container name=jdbc/YeguadasDB type=javax.sql.DataSource/ ResourceParams name=jdbc/YeguadasDB parameter nameurl/name valuejdbc:mysql://localhost:3306/yeguadas?autoReconnect=true/value /parameter parameter namevalidationQuery/name valueselect count(*) from usuario;/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxActive/name value100/value /parameter parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueijdshkhds/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namepassword/name valuefdfdferfr/value /parameter /ResourceParams /Context This is the exception when user try login: 2004-09-09 15:43:46 DataSourceRealm[/yeguadas]: Excepción realizando autenticación javax.naming.NameNotFoundException: El nombre jdbc no este asociado a este contexto at org.apache.naming.NamingContext.lookup(NamingContext.java:768) at org.apache.naming.NamingContext.lookup(NamingContext.java:151) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:437) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:277) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:129) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534) El jue, 09-09-2004 a las 15:28, Kelly C. Goedert escribió: Hi, I'm getting this error Name jdbc is not bound in this Context on my application. My tomcat version is 5.0.27. The servlet that is causing this error is trying to access a database with the following code: protected IDatabaseConnection getConnection() throws Exception { Context ic = new InitialContext(); Context ctx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource) ic.lookup(jdbc/boxes-cactus); con = new DatabaseDataSourceConnection( ds); return con; } My web.xml has the following configuration to the datasource: resource-ref descriptionDB Connection/description res-ref-namejdbc/boxes-cactus/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref And in $TOMCAT_HOME/conf/ Catalina/localhost/boxes-cactus.xml I got this Context path=/boxes-cactus docBase=boxes-cactus debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger
Re: Name jdbc is not bound in this Context
Right. ResourceLink is used when you want to use a global resource in your app. Not necessary when the resource is local to the app. --David Kelly C. Goedert wrote: I thought I only needed ResourceLink if I had made the datasource Global. Do I need it even if it is not declared globally? QM wrote: On Thu, Sep 09, 2004 at 10:28:32AM -0300, Kelly C. Goedert wrote: : I'm getting this error Name jdbc is not bound in this Context on my : application. My tomcat version is 5.0.27. ResourceLink ? See the Tomcat docs for details. -QM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context
I'm using Tomcat 5.0.28 El jue, 09-09-2004 a las 15:56, Angel Cervera Claudio escribió: Idem error to me, but with realm using DataSource: problem is that DataSourceRealm can not find JNDI name in context. There are a bug in tomcat 4.1, but this was resolved. My xml in Catalina/localhost content: ?xml version='1.0' encoding='utf-8'? Context displayName=Gestion de cunetas. docBase=/home/angel/workspace/yeguadas/tmp/web path=/yeguadas useNaming=false Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=jdbc/YeguadasDB roleNameCol=NOMBRE userCredCol=PASSWORD userNameCol=NOMBRELOGIN userRoleTable=USUARIO_PERFILES userTable=USUARIO/ Resource auth=Container name=jdbc/YeguadasDB type=javax.sql.DataSource/ ResourceParams name=jdbc/YeguadasDB parameter nameurl/name valuejdbc:mysql://localhost:3306/yeguadas?autoReconnect=true/value /parameter parameter namevalidationQuery/name valueselect count(*) from usuario;/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxActive/name value100/value /parameter parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueijdshkhds/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namepassword/name valuefdfdferfr/value /parameter /ResourceParams /Context This is the exception when user try login: 2004-09-09 15:43:46 DataSourceRealm[/yeguadas]: Excepción realizando autenticación javax.naming.NameNotFoundException: El nombre jdbc no este asociado a este contexto at org.apache.naming.NamingContext.lookup(NamingContext.java:768) at org.apache.naming.NamingContext.lookup(NamingContext.java:151) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:437) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:277) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:129) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534) El jue, 09-09-2004 a las 15:28, Kelly C. Goedert escribió: Hi, I'm getting this error Name jdbc is not bound in this Context on my application. My tomcat version is 5.0.27. The servlet that is causing this error is trying to access a database with the following code: protected IDatabaseConnection getConnection() throws Exception { Context ic = new InitialContext(); Context ctx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource) ic.lookup(jdbc/boxes-cactus); con = new DatabaseDataSourceConnection( ds); return con; } My web.xml has the following configuration to the datasource: resource-ref descriptionDB Connection/description res-ref-namejdbc/boxes-cactus/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref And in $TOMCAT_HOME/conf/
Re: Name jdbc is not bound in this Context
Please don't hijack other peoples threads. Create a new thread and also post your web.xml stuff. Otherwise read my reply to the original post. --David Angel Cervera Claudio wrote: Idem error to me, but with realm using DataSource: problem is that DataSourceRealm can not find JNDI name in context. There are a bug in tomcat 4.1, but this was resolved. My xml in Catalina/localhost content: ?xml version='1.0' encoding='utf-8'? Context displayName=Gestion de cunetas. docBase=/home/angel/workspace/yeguadas/tmp/web path=/yeguadas useNaming=false Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=jdbc/YeguadasDB roleNameCol=NOMBRE userCredCol=PASSWORD userNameCol=NOMBRELOGIN userRoleTable=USUARIO_PERFILES userTable=USUARIO/ Resource auth=Container name=jdbc/YeguadasDB type=javax.sql.DataSource/ ResourceParams name=jdbc/YeguadasDB parameter nameurl/name valuejdbc:mysql://localhost:3306/yeguadas?autoReconnect=true/value /parameter parameter namevalidationQuery/name valueselect count(*) from usuario;/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxActive/name value100/value /parameter parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueijdshkhds/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namepassword/name valuefdfdferfr/value /parameter /ResourceParams /Context This is the exception when user try login: 2004-09-09 15:43:46 DataSourceRealm[/yeguadas]: Excepción realizando autenticación javax.naming.NameNotFoundException: El nombre jdbc no este asociado a este contexto at org.apache.naming.NamingContext.lookup(NamingContext.java:768) at org.apache.naming.NamingContext.lookup(NamingContext.java:151) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:437) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm.java:277) at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:129) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534) El jue, 09-09-2004 a las 15:28, Kelly C. Goedert escribió: Hi, I'm getting this error Name jdbc is not bound in this Context on my application. My tomcat version is 5.0.27. The servlet that is causing this error is trying to access a database with the following code: protected IDatabaseConnection getConnection() throws Exception { Context ic = new InitialContext(); Context ctx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource) ic.lookup(jdbc/boxes-cactus); con = new DatabaseDataSourceConnection( ds); return con; } My web.xml has the following configuration to the datasource: resource-ref descriptionDB Connection/description res-ref-namejdbc/boxes-cactus/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref And in $TOMCAT_HOME/conf/ Catalina/localhost/boxes-cactus.xml I got this Context path=/boxes-cactus docBase=boxes-cactus debug=5 reloadable=true crossContext=true Logger
RE: Name jdbc is not bound in this Context
Hi, I'm getting this error Name jdbc is not bound in this Context on my application. My tomcat version is 5.0.27. The servlet that is causing this error is trying to access a database with the following code: protected IDatabaseConnection getConnection() throws Exception { Context ic = new InitialContext(); Context ctx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource) ic.lookup(jdbc/boxes-cactus); con = new DatabaseDataSourceConnection( ds); return con; Sometimes people miss the basic things: how about ctx.lookup instead of ic.lookup on the 2nd call? ;) Yoav This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context
Apologies. My response may be in other thread. I will created a new. Thank's David. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context
I fixed this on the code and it still didn't work. I put my datasource as a global resource and used ResourceLink than the error stoped. But when it is not global it doesn't, I don't know why. Kelly. Shapira, Yoav wrote: Hi, I'm getting this error Name jdbc is not bound in this Context on my application. My tomcat version is 5.0.27. The servlet that is causing this error is trying to access a database with the following code: protected IDatabaseConnection getConnection() throws Exception { Context ic = new InitialContext(); Context ctx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource) ic.lookup(jdbc/boxes-cactus); con = new DatabaseDataSourceConnection( ds); return con; Sometimes people miss the basic things: how about ctx.lookup instead of ic.lookup on the 2nd call? ;) Yoav This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Name jdbc is not bound in this Context
i agree, when I define my 5 JNDI datasources within /conf/Catalina/localhost/webapp.xml on startup of tomcat I get a bunch of error messages saying JDBC is not bound for all my resources. I have a servlet context listener that configures a bunch of manager objects each of which attempts to init its private datasource via JNDI resolution. It appears to me that Tomcat is not ready with its JNDI resources yet and manages to call the servlet context listener before JNDI is bound. after these errors, Tomcat appears to initialise my webapp again, and this time the JNDI resources are available and my app works. odd. -Original Message- From: Kelly C. Goedert [mailto:[EMAIL PROTECTED] Sent: 09 September 2004 15:09 To: Tomcat Users List Subject: Re: Name jdbc is not bound in this Context I fixed this on the code and it still didn't work. I put my datasource as a global resource and used ResourceLink than the error stoped. But when it is not global it doesn't, I don't know why. Kelly. Shapira, Yoav wrote: Hi, I'm getting this error Name jdbc is not bound in this Context on my application. My tomcat version is 5.0.27. The servlet that is causing this error is trying to access a database with the following code: protected IDatabaseConnection getConnection() throws Exception { Context ic = new InitialContext(); Context ctx = (Context) ic.lookup(java:comp/env); DataSource ds = (DataSource) ic.lookup(jdbc/boxes-cactus); con = new DatabaseDataSourceConnection( ds); return con; Sometimes people miss the basic things: how about ctx.lookup instead of ic.lookup on the 2nd call? ;) Yoav This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE --- QAS Ltd. Developers of QuickAddress Software a href=http://www.qas.com;www.qas.com/a Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- /FONT - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name jdbc is not bound in this Context
Remove this from your Context.../Context definition: ResourceLink global=jdbc/cd_managerDB name=jdbc/cd_managerDB/ You don't need it and it may interfere since you didn't define your data as a global resource. --David Ben Halton wrote: Hi, I am getting the problem : javax.naming.NameNotFoundException: Name jdbc is not bound in this Context using Tomcat 5.025. I have seen suggested solutions to this problem, none of them seem to work. My web.xml: resource-ref descriptionOracle Datasource example/description res-ref-namejdbc/cd_managerDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref My cd_manager.xml (cd_manager is app context): Context path=/cd_manager docBase=cd_manager debug=1 reloadable=true ResourceLink global=jdbc/cd_managerDB name=jdbc/cd_managerDB/ Resource name=jdbc/cd_managerDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/cd_managerDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:@localhost:1521:ppdb/value /parameter parameter nameusername/name valuecd_manager/value /parameter parameter namepassword/name valuepassword/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams /Context I am trying to access this datasource with Spring: bean id=cdDataSource class=org.springframework.jndi.JndiObjectFactoryBean property name=jndiName valuejdbc/cd_managerDB/value /property /bean Any help much appreciated. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Name JDBC is not bound in this context.
Hi, I think this might be because I have the .war file that is using the JNDI connection pooling loading as the default context. Because it is in the /webapps folder it is also loading as the /name context, even though I have nothing specified for this in server.xml. But this one I have no JNDI resources for, so it produses an error. Is there any way I can stop webapps loading by default? Andoni. - Original Message - From: Andoni [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Wednesday, August 06, 2003 11:43 AM Subject: Name JDBC is not bound in this context. Hi, I am getting this error in my log files: name jdbc is not bound in this context and I cannot see any reason why. I have found multiple examples on the web but nobody seems to answer queries about it! My program is using Tomcat 4.0.4 connection pooling and seems to be working fine (if a little slow) so I cannot see what could be wrong. Can anyone help me? Please! Andoni. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]