Welcome Guest  |  Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help


Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 11
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 1232 times and has 10 replies Next Thread
Female frantma
Newbie




Joined: Jul 8, 2008
Post Count: 15
Status: Offline
Reply to this Post  Reply with Quote 
HSQL db

Dear all,

I am running the sample from datanucleus website and everything seems to work well...

Nevertheles whenever I run the application the old database is deleted and a new one is created even if I avoid to run the enhance,createSchema,deleteSchema tasks.

How is it possible to save the database (HSQL) without loosing my stored info?

Thanks in advance,
/Maria
[Aug 4, 2008 12:09:35 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male ganzuoni
Expert
Member's Avatar


Joined: Nov 16, 2005
Post Count: 804
Status: Offline
Reply to this Post  Reply with Quote 
Re: HSQL db

Dear all,

I am running the sample from datanucleus website and everything seems to work well...

Nevertheles whenever I run the application the old database is deleted and a new one is created even if I avoid to run the enhance,createSchema,deleteSchema tasks.

How is it possible to save the database (HSQL) without loosing my stored info?

Thanks in advance,
/Maria

What's the URL of the database ? (I suspect that you are using an in-memory version)

Guido
----------------------------------------
Guido Anzuoni
http://www.objectmagic.org
[Aug 4, 2008 12:28:56 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Female frantma
Newbie




Joined: Jul 8, 2008
Post Count: 15
Status: Offline
Reply to this Post  Reply with Quote 
Re: HSQL db

Dear all,

I am running the sample from datanucleus website and everything seems to work well...

Nevertheles whenever I run the application the old database is deleted and a new one is created even if I avoid to run the enhance,createSchema,deleteSchema tasks.

How is it possible to save the database (HSQL) without loosing my stored info?

Thanks in advance,
/Maria

What's the URL of the database ? (I suspect that you are using an in-memory version)

Guido


Indeed, I'm using an in-memory version
My properties file is the following:
javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.jdo.JDOPersistenceManagerFactory

javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:assist
javax.jdo.option.ConnectionUserName=sa
javax.jdo.option.ConnectionPassword=

datanucleus.autoCreateSchema=true
datanucleus.validateTables=false
datanucleus.validateConstraints=false


Thanks,
/Maria
[Aug 4, 2008 2:18:19 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male peathal
Newbie




Joined: Dec 30, 2009
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
confused Re: HSQL db

Sorry for opening such an old thread again, but I have a similar problem:

I specified the following url:

javax.jdo.option.ConnectionURL=jdbc:hsqldb:file:db/timefinder
and
datanucleus.autoCreateSchema=true

So I guessed that the schema is created once and the number of persons will increase if I create one person per run and commit this.
But the schema seems to be deleted on every startup, because if I specify datanucleus.autoCreateSchema=false
I get:
Required table missing : "PERSON" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations.

The same is true if I use the h2 database. What is my mistake?
[Dec 30, 2009 12:16:39 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male andy
Expert
Member's Avatar

UK
Joined: Mar 13, 2004
Post Count: 5235
Status: Offline
Reply to this Post  Reply with Quote 
Re: HSQL db

DataNucleus doesn't delete any tables ... ever. The only thing that can do that is the datastore itself, e.g when using embedded. The DataNucleus log tells you everything that it does. The docs for HSQLDB would be the point of reference for what it would do in that particular case
----------------------------------------
-Andy smile

[Dec 30, 2009 8:22:15 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male peathal
Newbie




Joined: Dec 30, 2009
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: HSQL db

Thanks for the hint!
I figured it out: I need to use shutdown=true

javax.jdo.option.ConnectionURL=jdbc:hsqldb:file:db/timefinder;shutdown=true

see http://hsqldb.org/doc/guide/ch01.html

But with that in mind I can imagine that hsqldb is not really ACID conform!?

And now I need a 'deleteAll' method for my test cases. Should I do this via

Extent e = pm.getExtent(Person.class, true);
Query query = pm.newQuery(e);
query.deletePersistentAll();

for all classes or recreate the schema with the schematool? Or is there even a better/faster approach?
[Dec 30, 2009 11:57:30 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male erik
Expert
Member's Avatar

Belgium
Joined: Mar 12, 2004
Post Count: 3105
Status: Offline
Reply to this Post  Reply with Quote 
Re: HSQL db

In our test cases we delete the objects as your example, which ensures that we have full awareness of what is inserted or deleted from database.
----------------------------------------
Erik Bengtson


[Dec 31, 2009 12:42:03 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male mipastgt
Newbie



Germany
Joined: Jan 10, 2010
Post Count: 14
Status: Offline
Reply to this Post  Reply with Quote 
Re: HSQL db

Could someone please confirm that the solution described above really works? I have the same problem with HSQL although I followed the above advice. I even added a final pmf.close() to the code and deleted the portion of the code which removes all stored objects from the database. My properties are:

javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.jdo.JDOPersistenceManagerFactory

javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
javax.jdo.option.ConnectionURL=jdbc:hsqldb:file:data/testdb;shutdown=true
javax.jdo.option.ConnectionUserName=sa
javax.jdo.option.ConnectionPassword=
javax.jdo.option.Mapping=hsql

datanucleus.metadata.validate=false
datanucleus.autoCreateSchema=true
datanucleus.validateTables=false
datanucleus.validateConstraints=false

But after running the code no database file is written. The exact same code works perfectly with postgresql (with adjusted properties of course).
So what can still be wrong in my setup here?
lg Michael
[Feb 8, 2010 2:25:07 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male peathal
Newbie




Joined: Dec 30, 2009
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
Re: HSQL db

My property file is:

javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.jdo.JDOPersistenceManagerFactory

# H2
#javax.jdo.option.ConnectionDriverName=org.h2.Driver
#javax.jdo.option.ConnectionURL=jdbc:h2:db/timefinder

# HSQLDB
javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
javax.jdo.option.ConnectionURL=jdbc:hsqldb:file:db/timefinder;shutdown=true
#javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:timefinder

javax.jdo.option.ConnectionUserName=sa
javax.jdo.option.ConnectionPassword=

datanucleus.autoCreateSchema=true
datanucleus.validateTables=false
datanucleus.validateConstraints=false
[Feb 8, 2010 4:05:53 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male mipastgt
Newbie



Germany
Joined: Jan 10, 2010
Post Count: 14
Status: Offline
Reply to this Post  Reply with Quote 
Re: HSQL db

So it works for you with basically the same settings that I have?
[Feb 8, 2010 5:04:24 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread