Results 1 to 8 of 8
  1. #1
    Ranjiz is offline Member
    Join Date
    Jun 2012
    Posts
    4
    Rep Power
    0

    Default Compress database using java coding?????..........

    Hai Friends,

    Can u any one help me plz.... How to compress database using java coding?... It is possible in java?........

    Thanks in advance...

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Compress database using java coding?????..........

    You can zip up the directory structure that the database uses I suppose.
    This all depends on the type of db, though. I wouldn't do this with Oracle or SQL server, but something like Derby, which refers to databases by the directory they live in, it should work.

    What are you trying to achieve?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Ranjiz is offline Member
    Join Date
    Jun 2012
    Posts
    4
    Rep Power
    0

    Default Re: Compress database using java coding?????..........

    n my program i populate tables in an Ms access Database. The database is huge sometimes (aroung 600 MB). When this Database is Compacted through Access it becomes around 80 MB.
    How do i perform the same compact operation through Java code.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Compress database using java coding?????..........

    I suspect that's an Access thing, so may not be accessible through JDBC.
    If it's a tool outside of Access then you could try and run that using Runtime.exec().
    I will say that databases like to get to a certain size, entirely dependent on the sort of work they have to do, so any compression may well be temporary if the compressed db is going to be used in the same way as the pre-compressed one.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    achill is offline Member
    Join Date
    Jan 2011
    Location
    Bielefeld, Germany
    Posts
    10
    Rep Power
    0

    Default Re: Compress database using java coding?????..........

    It depends on the reason why the database is so huge. Are there so many datasets or is one single dataset so huge because there are blobs in it.
    I don't know MS Access very well. What does Access do while compacting the database?
    Does it delete dead tuples or compresses it single attributes / fields?

    In the first case you have to vacuum the database and in the latter case you can compress the data before you insert it into the dataset.

    However, it depends on the structure of the database, the type of data you stored in it and whether the database is so huge because of the number of datasets or the single date in one field.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Compress database using java coding?????..........

    It'll be gaps in the data blocks (depending on how exactly Access stores its data) I'd have thought?
    Remove an entry and the space occupied by that entry is not going to be "reclaimed", unless a convenient insert will do the job.
    They all do it, and it's often not worth compressing them as the database will simply expand again until it hits a size that's right for the work it does.
    There can be cases where it's worthwhile, where something non-standard happens (deletion of a load of data for whatever reason).
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Compress database using java coding?????..........

    Access 'compacts' a database by replicating its content to a new database, deleting the old one and renaming the new one. I've worked on a computer slow enough to actually watch this happening in Windows Explorer.

    At the cost of reinventing the wheel, that functionality could probably be duplicated in Java.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Compress database using java coding?????..........

    That's almost how you would do it on Oracle.
    If I have an extent with data at the beginning and data at the end, but nothing in the middle, there is nothing you can do short of recreating that data elsewhere then removing the old one.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Compress and decompress streams
    By Milanek in forum New To Java
    Replies: 4
    Last Post: 11-19-2011, 12:15 AM
  2. How to compress .dmp file using java
    By razzzmatazzz in forum New To Java
    Replies: 1
    Last Post: 02-25-2010, 11:34 AM
  3. Compress text in java
    By rakesh_n_mehta in forum Threads and Synchronization
    Replies: 2
    Last Post: 10-21-2009, 10:12 PM
  4. Help with a Compress File
    By Thomasheen in forum New To Java
    Replies: 1
    Last Post: 08-31-2009, 04:34 PM
  5. how to compress of arraylist
    By hai789 in forum Web Frameworks
    Replies: 0
    Last Post: 05-20-2008, 01:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •