db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oldmhe <mhe1943-oldnab...@yahoo.com>
Subject Re: can't delete my DB directory
Date Wed, 09 Jun 2010 01:32:54 GMT

The OS is Windows XP.

Since I'm using the embedded driver, I don't think it's possible to check
what process is hanging on to the file.  I.e., I believe it's the same
process as my program.  When my program exits, I'm able to delete the
directory manually.

Regarding your last question, my program does shutdown explicitly (as shown
in my original post).

Since posting, I found a solution, but I don't understand why it works.

Below is a simplification of what the program does:

1.     load the embedded driver
        set AutoCommit to false
        connect to the DB engine, and create a DB
        create tables
        load the tables with data, and commit all work

2.     using SELECT, read some data records, and create an output file.

3.     shutdown the DB engine

4.     try to delete the DB directory (and all files and subdirectories)

With regard to my initial post, Step 4 fails to delete all the files and
directories (it's able to delete most of them).


1.  If I omit Step 2 (the reading of the DB), Step 4 succeeds.

2.  Or, if I add "xxx.commit()" between Step 2 and Step 3, then Step 4

It seems that a commit() is needed even though Step 2 makes no change to the
DB.  This is contrary to my expectations for two reasons:

a)  Since Step 2 is a read-only operation, I don't see why commit() is

b)  Even if a commit() is needed, the shutdown should release all DB
resources (and not hang on to any files).

Any thoughts?

Kristian Waagan-4 wrote:
> Hello,
> What operating system are you using?
> Are you able to use the operation system's proper tool to check which 
> process (if any) is hanging on to the file?
> (i.e. pfiles or lsof)
> Also, do you see the same behavior if you in addition shut down the 
> database explicitly?
> (i.e. 'DriverManager.getConnection("jdbc:derby:myDB;shutdown=true");')
> Regards,
> -- 
> Kristian

View this message in context: http://old.nabble.com/can%27t-delete-my-DB-directory-tp28782490p28825037.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

View raw message