Menu

Password protected DB

Help
beekay
2016-12-02
2016-12-03
  • beekay

    beekay - 2016-12-02

    Hi,
    I tried to open a password protected Access 2007 database with jackcess-encrypt-2.1.1.jar but I get the following exception.
    com.healthmarketscience.jackcess.impl.UnsupportedCodecException: Decoding not supported. Please choose a CodecProvider which supports reading the current database encoding.

    Please provide the details to open a password protected db.

     
  • James Ahlborn

    James Ahlborn - 2016-12-02

    any details you can provide regarding the test code you are using and the exact error you are encountering (full stack trace) would be great.

     
  • beekay

    beekay - 2016-12-03

    Database db = new DatabaseBuilder().setReadOnly(true).setCodecProvider(new CryptCodecProvider("test")).open(file);


    com.healthmarketscience.jackcess.impl.UnsupportedCodecException: Decoding not supported. Please choose a CodecProvider which supports reading the current database encoding.
    at com.healthmarketscience.jackcess.impl.DefaultCodecProvider$UnsupportedHandler.decodePage(DefaultCodecProvider.java:126)
    at com.healthmarketscience.jackcess.impl.PageChannel.readPage(PageChannel.java:224)
    at com.healthmarketscience.jackcess.impl.UsageMap.read(UsageMap.java:130)
    at com.healthmarketscience.jackcess.impl.PageChannel.initialize(PageChannel.java:117)
    at com.healthmarketscience.jackcess.impl.DatabaseImpl.<init>(DatabaseImpl.java:524)
    at com.healthmarketscience.jackcess.impl.DatabaseImpl.open(DatabaseImpl.java:393)
    at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:252)
    at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:291)

     
  • Gord Thompson

    Gord Thompson - 2016-12-03

    You are trying to use the static .open(file) method on a new instance of DatabaseBuilder, and that does not seem to work with .setCodecProvider. Try using .setFile(file) and .open() instead:

    Database db = new DatabaseBuilder()
            .setFile(file)
            .setReadOnly(true)
            .setCodecProvider(new CryptCodecProvider("test"))
            .open();
    
     

    Last edit: Gord Thompson 2016-12-03
  • James Ahlborn

    James Ahlborn - 2016-12-03

    Ah, good catch! i didn't notice that myself. you can also pass the file in the DatabaseBuilder constructor.

     

Log in to post a comment.