'rm -R myDbDirectory' in *nix' How do you programmatically, from java do that (OS independent)? What I do is I iterate over the db folder and delete all contents, as returned by the java.io API. However, even doing that seems not sufficient.
I delete the db in the tearDown, see it deleted, but then in setup I'm told that it already exists. As if I execute the setUp twice, but I checked that it wasn't the case. 2010/3/18, Gabriele Kahlout <[email protected]>: > Hello, > > I shutdown the database in the tearDown method, and all the files are > deleted. > Yet at the setUp() method when it inits (creates) the database it gives: > java.sql.SQLException: Table/View 'EXPRESSIONS' already exists in > Schema 'APP', which probably arises due to this checkpoint you are > talking about? > > For testing, how can I make sure the tearDown completely deletes the > db, and setUp creates a completely new copy, without using in-memory > db? > > 2010/3/3, Kristian Waagan <[email protected]>: >> On 03.03.2010 13:01, Gabriele Kahlout wrote: >>> Okay. In my unit tests I try to delete the previous database >>> completely, so as to run each test from scratch. >>> I close the connection, and then delete all files, however this sticks: >>> >>> seg0, c4b0.dat. Does it have any special meaning? Eitherway, how can I >>> get rid of it? >>> I thought con.close() did the job. >>> >> >> Gabriele, >> >> Connection.close() only closes the connection - it neither shuts down >> nor deletes the database itself. >> If you want to delete the database files on disk, you really should shut >> down the database first (this is done by connecting to the database with >> "shutdown=true" in the URL, see the manuals for details). Note that >> shutting down the database also invokes a checkpoint, so in most cases >> it should be done also when you are not going to delete the database >> (the checkpoint makes opening the database again faster, as Derby won't >> have to do recovery). >> >> If you don't need the database to be stored on disk at all, you should >> consider using the in-memory back end. In this case the database will be >> deleted when you shut it down. More information at >> http://wiki.apache.org/db-derby/InMemoryBackEndPrimer >> >> >> Regards, >> -- >> Kristian >> >>> 2010/3/3, Knut Anders Hatlen<[email protected]>: >>> >>>> Gabriele Kahlout<[email protected]> writes: >>>> >>>> >>>>> That's interesting. I catch the opportunity to ask, is it possibly to >>>>> alias/retrieve the ROWID, of the row? In SQLite that is ROWID, while >>>>> reading the Java DB doc, I found no such thing and so tried to >>>>> 'simulate' it with RID. However as you pointed above it doesn't alias >>>>> the ROWID, which I extensively depend on. >>>>> >>>> Hi Gabriele, >>>> >>>> There's currently no ROWID support in Derby. >>>> >>>> -- >>>> Knut Anders >>>> >>>> >>> >>> >> >> > > > -- > Regards, > K. Gabriele > > --- unchanged since 25/1/10 --- > P.S. Unless a notification (LON), please reply either with an answer > OR with " ACK" appended to this subject within 48 hours. Otherwise, I > might resend. > In(LON, this) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x, > this) ∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧ > ¬IsAnswerTo(x,this)) ⇒ ¬IResend(this). > > Also note that correspondence may be received only from specified a > priori senders, or if the subject of this email ends with a code, eg. > -LICHT01X, then also from senders whose reply contains it. > ∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y. > In(y, subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ). > -- Regards, K. Gabriele --- unchanged since 25/1/10 --- P.S. Unless a notification (LON), please reply either with an answer OR with " ACK" appended to this subject within 48 hours. Otherwise, I might resend. In(LON, this) ∨ In(48h, TimeNow) ∨ ∃x. In(x, MyInbox) ∧ IsAnswerTo(x, this) ∨ (In(subject(this), subject(x)) ∧ In(ACK, subject(x)) ∧ ¬IsAnswerTo(x,this)) ⇒ ¬IResend(this). Also note that correspondence may be received only from specified a priori senders, or if the subject of this email ends with a code, eg. -LICHT01X, then also from senders whose reply contains it. ∀x. In(x, MyInbox) ⇒ In(senderAddress(x), MySafeSenderList) ∨ (∃y. In(y, subject(this) ) ∧ In(y,x) ∧ isCodeLike(y, -LICHT01X) ).
