You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by remmons <re...@aurigen.com> on 2007/08/10 17:40:17 UTC
Using MSAccess database for container authentication
I am trying to use an MSAccess database for container authentication in
Tomcat 5.5.23. When I start Tomcat, I get this message in the
catalina.YYYY-MM-DD.log:
Aug 10, 2007 10:50:30 AM org.apache.catalina.realm.JDBCRealm start
SEVERE: Exception opening database connection
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not
found and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:701)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:769)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1006)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Aug 10, 2007 10:50:30 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
I setup my realm in server.xml as follows:
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:Auth"
userTable="User" userNameCol="UserName" userCredCol="Password"
userRoleTable="User_Role" roleNameCol="RoleName" />
where Auth.mdb is the name of my MSAccess database. I configured Auth.mdb
in my ODBC Data Source Administrator, and I am able to access it and display
its tables from a Java application.
I am using Tomcat 5.5.23.
Has anyone used an MSAccess database via JDBC-ODBC for authentication in
Tomcat? Can anyone tell me what I am doing wrong?
--
View this message in context: http://www.nabble.com/Using-MSAccess-database-for-container-authentication-tf4249487.html#a12093749
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Using MSAccess database for container authentication
Posted by remmons <re...@aurigen.com>.
Christopher Schultz-2 wrote:
>
>
> This is a standard class that comes with the Sun JRE. There is no need
> for any additional JAR files.
>
> I would advise the OP to check online for how to connect Java to Access
> in general before adding Tomcat into the mix. Using MS Access requires
> you to setup an ODBC DataSource in Windows. Have you done that? Is it
> called "Auth"? The connection URL was "jdbc:odbc:Auth", so it should be.
>
>
Yes, sun.jdbc.odbc.JdbcOdbcDriver is in the Java distrubition rt.jar, and I
did not think it had to be added to Tomcat/common/lib, but I tried it
anyhow. It had no effect.
Yes, I did set up and configure a DSN, named Auth, in the ODBC Data source
administrator. I can connect to Auth via JDBC-ODBC from a stand alone Java
Application I wrote. I am able to access Auth it and display its tables. I
did state this in my original message.
The ODBC data source is definitely working, but I cannot get Tomcat to
connect to it. The driver sun.jdbc.odbc.JdbcOdbcDriver is definitely
working because I use it in my stand alone Java application to connect to
Auth and display its tables.
I do not seem to be able to get Tomcat to connect to any ODBC data source.
The ODBC administrator has a trace function. When I access Auth from my
stand alone Java App, it generates a bunch of log entries in the ODBC log.
When I start Tomcat, and try to open a secured document, zero entries are
generated in the ODBC log. It is as if Tomcat does not know ODBC exists.
Christopher Schultz-2 wrote:
>
>
> I've never used Access with Java (or by itself, for that matter), but
> I've seen connection URLs like this, too:
>
> "jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);
> DBQ=D:\\path_to_db\db.mdb;PWD=mypass"
>
> This appears to define it's own data source instead of requiring you to
> create one in the control panel.
>
>
The server.xml Realm entry which I used (below) was copied directly from the
original server.xml supplied with Tomcat, where it was commented out. I
commented out the Realm entry which directs Tomcat to use the
tomcat-users.xml file for authentication. All I did was change
"jdbc:odbc:CATALINA" to "jdbc:odbc:Auth", and edit the names of the tables
and columns to reflect my actual MSAccess database.
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:Auth"
userTable="User" userNameCol="UserName" userCredCol="Password"
userRoleTable="User_Role" roleNameCol="RoleName" />
Do I need to make some other entry in server.xml? Do I need to make an
entry in some other configuration file?
Thanks for any additional hints you can provide.
--
View this message in context: http://www.nabble.com/Using-MSAccess-database-for-container-authentication-tf4249487.html#a12097330
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org