You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert J Emmons <re...@aurigen.com> on 2007/08/02 22:23:58 UTC

Using HSQLDB for Authentication

I am trying to use HSQLDB for container authentication in Tomcat.  When 
I start Tomcat, I get this message in the catalina.YYYY-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: org.hsqldb.persist.NIOLockFile@18ca22fe[file 
=\\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.
remmons@aurigen.com, http://www.aurigen.com
Computer Programming and Consulting


---------------------------------------------------------------------
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 HSQLDB for Authentication

Posted by remmons <re...@aurigen.com>.
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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Using HSQLDB for Authentication

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert,

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

Thanks for posting a followup to this when you found the answer. Often,
dead threads will end in no solution as the OP will disappear thinking
that the community doesn't care.

We do care; it's just that nobody that read your post knew what to do ;)

Now it's in the archives, so hopefully someone will find it when searching.

Nice job,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGzZhD9CaO5/Lv0PARAv9kAJ4kJ+06o4pf6CzW3xAGpd5j6UUhLgCfRjER
AseWX5z6dP+VIzsmhgVd5IU=
=6FzY
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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 HSQLDB for Authentication

Posted by remmons <re...@aurigen.com>.

remmons wrote:
> 
> I am trying to use HSQLDB for container authentication in Tomcat.  When 
> I start Tomcat, I get this message in the catalina.YYYY-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: org.hsqldb.persist.NIOLockFile@18ca22fe[file 
> =\\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.
> remmons@aurigen.com, http://www.aurigen.com
> Computer Programming and Consulting
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> 


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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org