Project

Profile

Help

SQL extension with hsqldb?

Added by Anonymous over 17 years ago

Legacy ID: #4162897 Legacy Poster: Michal Urban (miuatsf)

I tried to use the SQL extension (Saxon-B 8.9J) with hsqldb (1.8.0.7). I used the books.xml and books-sql.xsl examples. Connection works fine, however inserts fail with this error: SXSQ0004: SQL INSERT failed: Table not found in statement [INSERT INTO book (title,author,category) VALUES (?,?,?)] When I commented out the sql:insert, I got a similar error for select: (SQL) Table not found in statement [SELECT * FROM book] I believe the "book" table was created correctly: create table book (title VARCHAR, author VARCHAR, category VARCHAR) I can work with it from my Eclipse plug-in (Quantum DB). Equivalent thing worked for me in Oracle, but I'd like to use a lighter, Java only database. Any hints will be appreciated.


Replies (4)

Please register to reply

Some progress, more questions - Added by Anonymous over 17 years ago

Legacy ID: #4163622 Legacy Poster: Michal Urban (miuatsf)

Sorry for the confusion, I'm new to hsqldb. I'll have to learn more about how it handles instances and access to them, apparently Saxon and Eclipse were not looking at the same DB... Now I'm able to connect and insert rows via Saxon, however they don't seem to be committed (unlike when I use Oracle with the same xml/xsl). From an external tool (Quantum/Eclipse) I can only see rows inserted manually, not the ones added by XSLT. Although I get this: Inserted 6 records. There are now 8 books. when I refresh view in Quantum DB, I only see 2 rows that I created by hand before. Repeated runs still report the same numbers. I'm also experiencing locking issues, Saxon only succeeds (without committing inserts) when I close Eclipse. Disconnecting from DB in Quantum DB plug-in is not enough. Otherwise, I get: SXSQ0003: JDBC Connection Failure: The database is already in use by another process: org.hsqldb.persist.NIOLockFile@8cd2782e[file =/install/Java/DB/test.lck, exists=true, locked=false, valid=false, fl =null]: java.lang.Exception: checkHeartbeat(): lock file [/install/Java/DB/test.lck] is presumably locked by another process. With Oracle, each run adds 6 rows as expected and I can stay connected via Eclipse/Quantum DB and see changes immediately. Again, any hints/insights into using hsqldb with Saxon will be appreciated.

RE: Some progress, more questions - Added by Anonymous over 17 years ago

Legacy ID: #4163655 Legacy Poster: Michael Kay (mhkay)

Are you issuing a sql:close instruction? You need to be aware that the Saxon SQL extension is not really intended to be a "product quality" SQL interface to XSLT: it was produced essentially as a demonstration of how to write extension instructions in XSLT. It has many known restrictions, and it hasn't been tested with a variety of different databases. And I can't really offer much support, especially in relation to situations where different back-end databases behave differently. If you can identify improvements to the code to make it more robust, please contribute them - that's essentially how this feature has developed. Michael Kay

Thanks for your reply, Michael! - Added by Anonymous over 17 years ago

Legacy ID: #4166148 Legacy Poster: Michal Urban (miuatsf)

I really appreciate your dedication in supporting this forum! I'm using your example from Saxon's distribution, books-sql.xsl with books.xml/dtd. The only change is DB driver/connection/user/password parameter values. So sql:close should be called. I understand that various DB back-ends have their specifics and this module is not guaranteed to work. Having had trouble with hsqldb, I tried Oracle which worked as expected with no hassle. I'll also try Derby as a free Java alternative to hsqldb.

Update - Derby works! - Added by Anonymous over 17 years ago

Legacy ID: #4166479 Legacy Poster: Michal Urban (miuatsf)

My tests with Derby (which is as new to me as hsqldb) worked fine. Behaviour was identical to Oracle - rows are inserted and committed, Saxon could run while I monitored tables from Eclipse/Quantum DB. It's likely that I missed something in hsqldb config. I may revisit this one day, although I'll stick with Derby for the moment.

    (1-4/4)

    Please register to reply