hi,

 

I have attached a little test program that shows what I'm trying to do, namely to rename programmatically a DB.

 

as far as I can see there is no derby command to accomplish that. however, I found out that just renaming the folder of the DB files will do the trick.

of course the db should be closed for that and hence I issue the shutdown command via opening a connection to that DB.

 

the problem is: this doesn’t always work b/c sometimes the rename of the folder fails ( right now the test cases run thru while before they didn’t…)

therefore, the problem doesn’t appear to be consistent but I had checked with sysinternal's handle util and that showed me that the java process still had one handle to a .dat file open, despite of the shutdown. also a complete derby shutdown didn’t help there.

 

below is an example of this, albeit produced with different code:

here one nicely sees that one mere handle is still open to the "DataStoreManagerImplDerbyTest.testMerge" index that prevents me from renaming that folder/db.

 

javaw.exe          pid: 3400    890: E:\Audi\temp\derby_data\derby.log

javaw.exe          pid: 3400    B08: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c290.dat

javaw.exe          pid: 3400    CB0: E:\Audi\temp\derby_data\DataStoreManagerImplDerbyTest.testMerge\seg0\c411.dat

javaw.exe          pid: 3400    D04: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c2c1.dat

javaw.exe          pid: 3400    D20: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\db.lck

javaw.exe          pid: 3400    D24: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\log\log1.dat

javaw.exe          pid: 3400    D28: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c10.dat

javaw.exe          pid: 3400    D2C: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\cc0.dat

javaw.exe          pid: 3400    D30: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\cd1.dat

javaw.exe          pid: 3400    D34: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c60.dat

javaw.exe          pid: 3400    D38: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c71.dat

javaw.exe          pid: 3400    D3C: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c90.dat

javaw.exe          pid: 3400    D40: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\ca1.dat

javaw.exe          pid: 3400    D44: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c20.dat

javaw.exe          pid: 3400    D48: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c51.dat

javaw.exe          pid: 3400    D4C: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c2d0.dat

javaw.exe          pid: 3400    D50: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c2e1.dat

javaw.exe          pid: 3400    D54: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c400.dat

javaw.exe          pid: 3400    D58: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c411.dat

javaw.exe          pid: 3400    D5C: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\cf0.dat

javaw.exe          pid: 3400    D60: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c121.dat

javaw.exe          pid: 3400    D64: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c130.dat

javaw.exe          pid: 3400    D68: E:\Audi\temp\derby_data\.merge_DataStoreManagerImplDerbyTest3625883451529451304.tmp\seg0\c141.dat

 

my system is vistsa x64 with 32bit sun's JVM 1.5.

I hope u can make smth. of it.

 

I worked around the problem now by creating a backup and then restoring from that backup, which is less than an ideal solution….

 

tmenzel