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

Markus Schatten markus.schatten at ...2005...
Wed Mar 2 21:03:32 CET 2016


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.

--
Markus Schatten, PhD
Assistant professor and head of Artificial Intelligence Lab
University of Zagreb
Faculty of Organization and Informatics
Pavlinska 2, 42000 Varazdin, Croatia
http://www.foi.hr/nastavnici/schatten.markus/index.html
http://www.researchgate.net/profile/Markus_Schatten1
http://ai.foi.hr




More information about the User mailing list