简体   繁体   中英

Using HSQLDB in Google-App-Engine

In my light web-app that will work on google-app-engine, I want to use HSQLDB.

While initiating the HSQLDB I'm using a url like that: "jdbc:hsqldb:file:./database/".

On local tomcat everything goes well but on google-app-engine I'm getting the exception below;

Constructor threw exception; nested exception is com.hp.hpl.jena.sdb.SDBException: SQL Exception while connecting to database: jdbc:hsqldb:file:./database/appname : File input/output error ./database/appname.properties java.security.AccessControlException: access denied (java.io.FilePermission ./database write)

Does anyone can give a clue to define the proper url for running an HSQL db on google-app-engine?

I don't think GAE lets you write files in this level.

You may use an HSQLDB Memory Database which does not require a file but get erased when you app restarts.

Why don't you use JDO?

In GAE you cannot write to a file, which obviously means HSQLDB won't work on GAE. As Mikhas suggested you can use an HSQLDB IN Memory,which won't be persisted anywhere. If you are using GAE, you have no option other than using JDO or JPA. For which Appengine has been optimised for. But in future we might get support for using relational databases inside app engine. But as if for now, the answer is NO.

The (also open source Java) H2 database might work. See project H2GAE (please not it is experimental). I didn't test this myself however.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM