Tom (and anyone else having problems with HSQLDB)

HSQLDB is used in this project in its 'in-process' mode, this means
that it does not run as a seperate server process as a 'normal'
database would such as MySQL or Oracle.  The database instance is
started by the first call to getConnection in HSQLDBCOnnectionManager


 protected Connection getConnection() throws Exception
    {  
        return DriverManager.getConnection( "jdbc:hsqldb:file:" +
dbPath + getSchema()
      , getUsername()
      , getPassword() );  
    }


So Tomcat starts, Flex Gateway calls the method (probably after first
remote call) and the HSQLDB Driver Manager creates the database files
at the path specified by  'dbpath'

When the java process that is holding the database in memory is
running (Tomcat), various files are created, including lock files, etc.

At the same point that the first connection is created, hsqldb code
looks at the dbpath and tries to read in a .script file, which will
include the product details.

We currently have the db_path set to ..\db in the store.cfg  file
which gets copied by Ant (or manualy by you) to the classpath of the
tomcat webapp.

In Tomcat  '..' (atleast on all the machines we have tested on) points
to the next directory up from webapps (NOT the webapp, but the webapps  
directory). This would be  TOMCAT_HOME/db  (jakarta-tomcat-5.0.25/db)
in your case.

You should either have your .script file under that directory, or you
can change store.cfg to point to another relative or explicit
directory, for example c:/db  . But to be honest, I would try and get
it working with the default settings.

If you are getting the can't find user messages, it is almost
certainly the case that the code is not finding your .script file, as
the second line of the .script file creates the user.

Can I suggest the following steps to get it working:

stop Tomcat
create a directory called 'db' under your TOMCAT_HOME.
make sure the .script file is there
make sure your store.cfg is pointing to where it was when it shipped (
db_path=..\\db\\ ) (the double slashes are a java thing)
DELETE any .lck files
ENSURE that there are no other processes pointing at those files which
may cause a lock to occur.
Start TOmcat

.... that should work

We realise that HSQLDB has caused several people some config problems
(we had them too). However, we were torn between providing code which
could (in theory ;-) ) run out of the box and code which would require
the downloading of a database server and running of database scripts.

We have found HSQLDB can sometimes cause problems particularly when
developing, due to the way it locks files. Be aware that there is a
ten second timeout on the .lck file mandated by HSQLDB (not us).

So if you are running unit tests or writing dev/debug code, you should
be aware that for ten seconds after your code has run, there will
still be a lock, maybe also if you have those files open in an editor?

If you have MySQL, you could change the store.cfg to point to the
MySQLConnectionManager instead ( there is a mysql script under db in
the download).

Links which may be of help:

HsqlDB Manual (see 'in-process') 
http://hsqldb.sourceforge.net/web/hsqlDocsFrame.html
About the ten second timeout  
http://blog.taragana.com/index.php/archive/how-to-close-all-connections-in-hsqldb-to-prevent-a-locking-defect/


I'm sorry to hear there were errors in the documentation, I spent
several hours 'testing' them, please let me know what they are and I
will ammend the docs

hope this helps

dan





--- In flexcoders@yahoogroups.com, Tom Fitzpatrick <[EMAIL PROTECTED]> wrote:
> Still trying to get the cairngorm store products to show up. I
thought I 
> had done everything right - but there are several errors in the docs
and I 
> had to do some guessing, plus working with hints from Steven and
Alex from 
> iteration2.
> 
> On startup, I'm getting a couple of warnings from the server:
> 
> - log4j: WARN No appenders could be found for logger
> - log4j: WARN Please initialize the log4j system properly
> 
> And, when I access the app, the server throws this error:
> 
> Error: java.sql.SQLException: User not found: CAIRNGORMSTORE
> 
> To make things easier, here's my current relevant directory structure:
> 
> C:
> \servers
>  > db
>  >> file: catalog.lck
>  >> file: catalog.log
>  >> file: catalog.properties
>  >> file: catalog.script
>  > jakarta-tomcat-5.0.25
>  >>...
>  >> db
>  >>> file: catalog.properties
>  >>> file: catalog.script
>  >> webapps
>  >>> cairngormstore
>  >>>> assets
>  >>>> data
>  >>>> META-INF
>  >>>> org
>  >>>> tests
>  >>>> WEB-INF
>  >>>>> classes
>  >>>>>> conf
>  >>>>>>> file: log4j.properties
>  >>>>>>> file: store.cfg
>  >>>>>> org
>  >>>>>>> nevis...
>  >>>>> flex
>  >>>>>> file: cairngorm-manifest.xml
>  >>>>>> file: flex-config.xml
>  >>>>>>user_classes
>  >>>>>>> file: cairngorm.swc
>  >>>>>>> file: FlexUnit.swc
>  >>>>> lib
>  >>>>>> files: jar files
> 
> The db folder at the top level appears to be created automatically.
> 
> Any other info I can provide to track this down?
> 
> Thanks.
> 
> - Tom




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to