Re: Using HSQLDB for Authentication

2007-09-04 Thread remmons

Sorry, further testing showed that Tomcat was locating one of my databases,
but not the one I thought.  It was locating a database in
%CATALINA_HOME%/data.  So the database location and connectionURL which I
posted previously are not consistent.  Here is the corrected database
location:

* Locate the HSQLDB database files in %CATALINA_HOME%/data


Here is the complete corrected Info:

* Locate hsqldb.jar in %CATALINA_HOME%/common/lib
* Locate the HSQLDB database files in %CATALINA_HOME%/data
* Use the following Realm element in server.xml:

  Realm  className=org.apache.catalina.realm.JDBCRealm
 driverName=org.hsqldb.jdbcDriver
  connectionURL=jdbc:hsqldb:data/Auth
 connectionName=SA connectionPassword=
  userTable=USER userNameCol=USERNAME userCredCol=PASSWORD
  userRoleTable=USER_ROLE roleNameCol=ROLENAME /

-- 
View this message in context: 
http://www.nabble.com/Using-HSQLDB-for-Authentication-tf4208687.html#a12478808
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using HSQLDB for Authentication

2007-08-23 Thread remmons


remmons wrote:
 
 I am trying to use HSQLDB for container authentication in Tomcat.  When 
 I start Tomcat, I get this message in the catalina.-MM-DD.log:
 
 INFO: Starting Servlet Engine: Apache Tomcat/5.5.23
 Aug 2, 2007 3:10:29 PM org.apache.catalina.realm.JDBCRealm start
 SEVERE: Exception opening database connection
 java.sql.SQLException: The database is already in use by another 
 process: [EMAIL PROTECTED] 
 =\\localhost\data\Auth.lck, exists=false, locked=false, valid=false, fl 
 =null]: java.io.FileNotFoundException: \\localhost\data\Auth.lck (The 
 network path was not found)
 
 Apparently, Tomcat cannot find my database files.  Without success, I 
 have located them in various places:
 
 webbapps/MyApp/WEB-INF/data
 webbapps/MyApp/WEB-INF/classes/data
 webbapps/MyApp/WEB-INF/lib/data
 webapps/data
 
 I am using the following connectionURL:
 
 connectionURL=jdbc:hsqldb://localhost/data/Auth
 
 where Auth is the name of my HSQLDB database with the following files:
 
 data/Auth.log
 data/Auth.properties
 data/Auth.script
 
 I setup my realm in server.xml as follows:
 
 Realm  className=org.apache.catalina.realm.JDBCRealm
 driverName=org.hsqldb.jdbcDriver
 connectionURL=jdbc:hsqldb://localhost/data/Auth
 connectionName=SA connectionPassword=
 userTable=USER userNameCol=USERNAME 
 userCredCol=PASSWORD
 userRoleTable=USER_ROLE roleNameCol=ROLENAME /
 
 Can someone tell me where to put the database files so Tomcat can find 
 them?  I am using Tomcat 5.5.
 
 -- 
 Robert Emmons, P.E., Aurigen Inc.
 [EMAIL PROTECTED], http://www.aurigen.com
 Computer Programming and Consulting
 
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


In case anyone is interested, I found the secrets to getting Tomcat to use
my HSQLDB database for container authentication:

* Locate hsqldb.jar in %CATALINA_HOME%/common/lib
* Locate the HSQLDB database files in webapps/myApp/data
* Use the following Realm element in server.xml:

  Realm  className=org.apache.catalina.realm.JDBCRealm
 driverName=org.hsqldb.jdbcDriver
  connectionURL=jdbc:hsqldb:data/Auth
 connectionName=SA connectionPassword=
  userTable=USER userNameCol=USERNAME userCredCol=PASSWORD
  userRoleTable=USER_ROLE roleNameCol=ROLENAME /

That is the same Realm element as I used above, except for the
connectionURL:

* Correct: connectionURL=jdbc:hsqldb:data/Auth
* Incorrect: connectionURL=jdbc:hsqldb:/localhoast/data/Auth


-- 
View this message in context: 
http://www.nabble.com/Using-HSQLDB-for-Authentication-tf4208687.html#a12293244
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Using MSAccess database for container authentication

2007-08-10 Thread remmons

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.-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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using MSAccess database for container authentication

2007-08-10 Thread remmons


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]