This is mnoGoSearch's cache of https://lists.gambas-basic.org/pipermail/user/2016-March/056768.html. It is a snapshot of the page as it appeared during last crawling. The current page could have changed in the meantime.

Last modified: Wed, 02 Mar 2016, 21:38:16 CET    Size: 5264
[Gambas-user] "Result is not available" error with ODBC connection and DataSource

[Gambas-user] "Result is not available" error with ODBC connection and DataSource

Charlie Reinl Karl.Reinl at ...2345...
Wed Mar 2 21:38:16 CET 2016


Am Mittwoch, den 02.03.2016, 21:03 +0100 schrieb Markus Schatten:
> Dear friends,
> 
> I'm trying to do a simple thing, connect a DataSource to a ODBC
> connection (unixODBC). The DSN points to a simple sqlite3 database
> which has a table test(a integer, b varchar(10)) in it. The unixODBC
> seems to be working fine, since I can connect to the database using
> isql and see all defined tables and data. The problem is when I try to
> do it with Gambas, when setting the Table attribute of DataSource I
> get the error:
> 
> Result is not available
> 
> The connection seems to load the schema of the table (I can see a and
> b in the header of the DataBrowser) but not the data.
> 
> Here is what I do:
> 
> ' Gambas class file
> 
> Public $con As New Connection
> 
> Public Sub _new()
>   $con.type = "odbc"
>   $con.Host = "sqlite" 'name of the DSN
>   $con.Login = "mylogin"
>   $con.Password = "mypass"
>   $con.port = ""
>   $con.name = ""
>   $con.Open
>   DataSource1.Connection = $con
>   Try DataSource1.Table = "test"
>   If Error Then
>     Print Error.Text
>     Print Error.Where
>     Print Error.Backtrace
>     Print Error.Class
>     Print Error.Code
>   Endif
> 
> End
> 
> The fun part is that the same code works fine with a PostgreSQL
> database over the ODBC connection (no error is risen, both schema and
> data are loaded fine into the DataBrowser). I'm using the following
> entry in /etc/odbc.ini :
> 
> [sqlite]
> Description=My SQLite database
> Driver=SQLite3
> Database=/home/markus/test.sqlite3
> UserName = mylogin
> Password = mypass
> 
> What am I doing wrong?
> 
> All the best,
> 
> M.

Salut Markus,

does your sqlite3 tables have primary keys ?
-- 
Amicalement
Charlie





More information about the User mailing list