Glad to hear you got it working so far! :)

Is your DSN name literally "Simple JSP"?  If so, I suggest trying
something without a space in it... I have a feeling it might not work with
spaces in the name.

Note that the exception you are getting is actually coming from Access, it
is simply being "passed through" JDBC.  So, as you try and Google for a
solution, you can *almost* forget you are working in Java temporarily.

Also, does your DSN actually work via the test function in the ODBC
manager?  I tend to assume you tried that already, but just making sure ;)
 Actually, it looks like your saying you have a test class that does
connect via that DSN, is that correct?  If so, ignore this suggestion! :)

I notice you say your code can switch between two connection methods... is
it possible that somehow it isn't switched to the DSN method and is trying
to connect with the path you specified?  That makes a little more sense
with the exception you are seeing.

Ok, that's all the shots in the dark I have right now :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Mon, June 20, 2005 9:34 am, Gagnon, Joseph M  \(US SSA\) said:
> I've finally (with lots of help) figured out how to do form-based user
> authentication of a simple test JSP webapp.  So far, so good ... it
> seems to be working.
>
> However, the "database" is a list of roles and users currently defined
> in conf/tomcat-users.xml.  While this worked fine while I was learning
> how to do this and finally get it up and running, this is definitely not
> the method I want to use for the "real thing".
>
> So, I started looking around at some more of the Tomcat documentation
> and stumbled upon realms.  This seems to be the vehicle to allow Tomcat
> to provide a better method of performing user authentication.  The
> question now is: how do I make use of this?  The docs refer to the set
> of built-in realm types that are available for use, but I don't
> understand the subtle differences between many of them.  There don't
> seem to be any examples of how to use them.  I don't know which ones
> should be used for different situations.
>
> I'm running on a PC with MS Access installed.  This is the database (at
> least for now) that I intend to use.  I have successfully accessed
> information from an Access DB using a Java class to create the
> connection and execute SQL statements.  I've done only a very simple
> case at this point, just to demonstrate that I can do it successfully.
>
> The class actually has two possible methods of connection to the DB, one
> method defines the actual path to the DB file and a complex (and for the
> most part, not understood) connection string, the other method defines a
> "URL" in the following format: "jdbc:odbc:<DSN name>".  The DSN name was
> set up in the Windows ODBC data source administrator utility.  The
> second method is the one I'm using at this point.
>
> I tried setting up a JDBCRealm realm to use an Access DB with two
> tables, one for user names and passwords, the other for user names and
> roles.  I set up another ODBC DSN as described above and placed a
> reference to that in the realm element.  I *think* I followed the
> directions correctly, but ran into a problem that I don't know how to
> address.
>
> When I restart Tomcat, I'm getting the following error message in the
> logs (stderr and catalina):
>
> Jun 20, 2005 9:06:57 AM org.apache.catalina.realm.JDBCRealm authenticate
> SEVERE: Exception performing authentication
> java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]
> '(unknown)' is not a valid path.  Make sure that the path name is
> spelled correctly and that you are connected to the server on which the
> file resides.
>       at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
>       at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
>       at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
>       at
> sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
>       at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
>       at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:694)
>       at
> org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:344)
>       at
> org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAut
> henticator.java:256)
>       at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
> Base.java:391)
>       at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :126)
>       at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :105)
>       at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
> java:107)
>       at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
> 48)
>       at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:85
> 6)
>       at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
> onnection(Http11Protocol.java:744)
>       at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
> .java:527)
>       at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
> erWorkerThread.java:80)
>       at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
> .java:684)
>       at java.lang.Thread.run(Thread.java:534)
>
> I don't know what the problem is.  What am I not specifying such that it
> reports back with "unknown"?  Am I using the wrong realm type?  Does the
> method I'm trying to use not work with DSNs?
>
> The realm I've defined in my server.xml file is as follows:
>
>       <Realm  className="org.apache.catalina.realm.JDBCRealm"
>              driverName="sun.jdbc.odbc.JdbcOdbcDriver"
>           connectionURL="jdbc:odbc:Simple JSP"
>               userTable="users" userNameCol="user_name"
> userCredCol="user_password"
>           userRoleTable="user_roles" roleNameCol="role_name" />
>
> The connectionURL value (I think) should point to the ODBC DSN name I
> defined for my simple test DB.  The table and field names are correct.
>
> By the way, I had previously commented out the following entry in
> server.xml:
>
>       <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>              resourceName="UserDatabase"/>
>
> I figured I would be causing complications and confusion by leaving this
> entry "active".  The reference to the UserDatabase resource was defined
> earlier in the file (within the GlobalNamingResources element) as:
>
>     <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" />
>
> Any ideas or suggestions on what I'm doing wrong (or a better method
> altogether) would be appreciated.
>
> Thanks,
> Joe
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to