Menu

How to pass the DB character encoding the driver using dbeaver?

Help
2016-08-19
2016-08-20
  • Jayson Sabino

    Jayson Sabino - 2016-08-19

    I need to set the character encoding for mdb using the dbeaver.
    As I understand in this thread, this is only possible by creating a class in java. Is there any way to set the encoding by dbeaver?

     
  • Gord Thompson

    Gord Thompson - 2016-08-20

    You can try this. It seems to be working for me.

    Download the JAR file attached to this message. It contains a single .class

    package ucaextension;
    
    import java.io.File;
    import java.io.IOException;
    import java.nio.charset.Charset;
    import com.healthmarketscience.jackcess.Database;
    import com.healthmarketscience.jackcess.DatabaseBuilder;
    
    import net.ucanaccess.jdbc.JackcessOpenerInterface;
    
    public class UcanaccessCharsetOpener implements JackcessOpenerInterface {
        public Database open(File f, String pwd) throws IOException {
            DatabaseBuilder db = new DatabaseBuilder(f);
            db.setCharset(Charset.forName(System.getProperty("UCANACCESS_CHARSET")));
            try {
                db.setReadOnly(false);
                return db.open();
            } catch (IOException e) {
                db.setReadOnly(true);
                return db.open();
            }
       }
    }
    

     
    Launch DBeaver with the following command ...

    dbeaver -vmargs -DUCANACCESS_CHARSET=windows-1256
    

     
    ... substituting the name of the character set you want to use.

    In DBeaver, create a new Driver with the following properties

    DBeaverDriver.png
     
    Then, create a new Connection for your database, using the Driver you just created.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.