Re: [gnome-db] Libgdamm + SQLCipher



Hi,

I have downloaded and compiled libgda and libgdamm with SQLCipher provider.
When i run :
gda-sql-5.0 -L
i have the SQLCipher enabled :                           
Ldap        │ Provider for database where tables are based on data contained in an LDAP direc
SQLCipher   │ Fournisseur pour SQLCipher                                                    
SQLite      │ Fournisseur pour bases de données SQLite                                      
Web         │ Fournisseur pour serveurs mandataires de serveur Web                          
(4 rows)

But i dont know why i cannot to read and write a database with SQLCipher.

My code :

    Gnome::Gda::init ();
    try {
      con =
        Gnome::Gda::Connection::open_from_string ("SQLCipher",
                "DB_DIR=.;DB_NAME=db5", "", Gnome::Gda::CONNECTION_OPTIONS_THREAD_SAFE);
    } catch (Gnome::Gda::ConnectionError e) {
        std::cout << "error = " << e.code()  << endl;
        if (code == Gnome::Gda::ConnectionError::CONNECTION_OPEN_ERROR ){
                std::cout << "error = " << "CONNECTION_OPEN_ERROR" << endl;
        }
con->statement_execute_select ("PRAGMA KEY='demo'");
con->statement_execute_non_select ("CREATE TABLE sample(col1 TEXT");

At the first run, there is no error. At the second run, i get CONNECTION_OPEN_ERROR.
When i try to connect to the database from command line, i cannot read the database :
sqlite> PRAGMA KEY='demo';
sqlite> .tables
Error: file is encrypted or is not a database

When i replace SQLCipher by SQLite it works but the database is not encrypted...


2012/5/19 Vivien Malerba <vmalerba gmail com>


On 19 May 2012 16:00, Vivien Malerba <vmalerba gmail com> wrote:


On 19 May 2012 14:34, sylvain mouquet <sylvain mouquet gmail com> wrote:
Hi,

I am looking for using the sqlcipher with libgdamm but i dont found example for doing it.
When i try (http://developer-next.gnome.org/libgda/5.0/provider_notes_sqlcipher.html) : gda-sql-4.0 "SQLCipher://DB_NAME=testcrypt"
i get this error : "Impossible d'ouvrir la connexion 1 : Pas de fournisseur « SQLCipher » installé". How can i do for adding the SQLCipher provider ?
The reason is probably you don't have the SQLCipher provider installed. If you have installed Libgda using your distribution's, check you have installed the package named "libgda-sqlcipher" (or similar). If you have installed Libgda from sources, make sure you have compiled the SQLCipher provider as well.

In any case, you can always obtain the list of installed providers using the "gda-sql-4.0 -l" command.

Read  "gda-sql-4.0 -L" insdead (upper case L).
Regards,

Vivien



--
Cordialement,
Sylvain


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]