gbattinelli <giuseppe.battine...@gmail.com> writes:

> Dear all,
> I'm developing my first java application with derby db, using hibernate.
> What 's strange for me is that with empty db (6 tables about) my derby db
> appears to be about 30MB.
> I created it by Netbans and I lave log,seg0 and temp folder.
> So my question is...can I reduce space of initial (empty) db acting on some
> factor? 

The size of an empty database is much less than that, ca 2Mb, cf. this
test:

dag@T61pOS:~$ ij
ij version 10.6
ij> connect 'jdbc:derby:wombat;create=true';
ij> create table t1(i int);
0 rows inserted/updated/deleted
ij> create table t2(i int); create table t3(i int);
0 rows inserted/updated/deleted
ij> 0 rows inserted/updated/deleted
ij> create table t4(i int); create table t5(i int); create table t6(i int);
0 rows inserted/updated/deleted
ij> 0 rows inserted/updated/deleted
ij> 0 rows inserted/updated/deleted
ij> connect 'jdbc:derby:wombat;shutdown=true';
ERROR 08006: Database 'wombat' shutdown.
ij> connect 'jdbc:derby:;shutdown=true';
ERROR XJ015: Derby system shutdown.
ij> exit;

dag@T61pOS:~$ du -sh wombat
1.9M    wombat

Not sure why yours is so large. Of course, with a more complex schema it
would be somewhat larger than in my experiment, but not that large. Did
you insert and delete any data at all? And is so, did you close down the
database properly so a checkpoint could happen (otherwise you might have
large log files). Updates could also leave "holes" in database files
which you would need to run compress to remove[1].


> Besides...is there a way to have just a file for db (not zip),
> instead of 3 subfolders?

No. Read-only databases can be put in a jar or zip file:
http://db.apache.org/derby/docs/10.7/devguide/cdevdvlp24155.html

Thanks,
Dag

[1] http://db.apache.org/derby/docs/10.7/ref/rrefaltertablecompress.html

Reply via email to