I've used:

cnn = Gda.Connection.open_from_string ("Sqlite",
"DB_NAME=test.db;DB_DIR=.",null, Gda.ConnectionOptions.READ_ONLY);

and it is working for me. Using libgda 5.2 and Vala 0.22 on Ubuntu GNOME
14.04.

Could you give me some code example.

I've used this one:


using Gda;
class Application : Object {
    public Gda.Connection cnn { get; set; }
    public int run ()
    {
        cnn = Gda.Connection.open_from_string ("SQLite",
"DB_NAME=test;DB_DIR=.",null, Gda.ConnectionOptions.READ_ONLY);
        return 0;
    }
    static int main (string[] args)
  {
    var app = new Application ();
    return app.run ();
  }
}

2014-10-24 9:03 GMT-05:00 Christophe Bastin <[email protected]>:

> Hi everyone,
>
> I'm having some trouble using Vala and libda 5.0 for SQLite.
>
> In Python I have succesfully created a SQLite database with
> conn = Gda.Connection(provider = Gda.Config.get_provider("SQLite"),
>                                           cnc_string =
> "DB_DIR=.;DB_NAME=test")
> conn.open()
> conn.close()
>
> In Vala I tried different solutions:
>
> conn = new Gda.Connection (); // fails with undefined reference to
> `gda_connection_new'
>
> or with:
> conn = new Gda.Connection.open_from_string ("SQLite",
>             "DB_DIR=.;DB_NAME=test", null,
>             Gda.ConnectionOptions.NONE);
>
> // fails because the database file doesn't exist.
>
> So how can I create the SQLite file at connection startup ?
>
> Chris
>
> _______________________________________________
> gnome-db-list mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/gnome-db-list
>
>


-- 
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (en trámite, pero para los
cuates: LIBRE)
_______________________________________________
gnome-db-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-db-list

Reply via email to