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>
> > 
> >  <head><title>simmPlan - 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)
> > > >
> 
=== message truncated ===



                
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to