Am 16.03.20 um 20:01 schrieb Allin Cottrell:
On Mon, 16 Mar 2020, Artur Tarassow wrote:
> At least with latest git version on Ubuntu 18.10, I am experiencing
> problems with ODBC. Both of the following queries are pretty
> standard, and I've succesfully used the first one before. Stuff also
> works fine using the isql client via the terminal.
>
>
> <QUERY_1>
> open dsn=@DSN user=@USER password=@PW --odbc
> data klima query="SELECT KLIMA FROM OV_AS_LAB_LUMEN.IFO_DATA" --odbc
> </QUERY_1>
>
> <ERROR_1>
> ERROR: Error executing script: halting
>> data klima query="SELECT KLIMA FROM OV_AS_LAB_LUMEN.IFO_DATA" --odbc
> </ERROR_1>
>
> The weird thing is that I obtain a new series but which has only zero
> values which is wrong.
>
> <TERMINAL_1>
> SQLDisconnect(dbc): SQL_SUCCESS
> SQLFreeHandle(SQL_HANDLE_DBC, dbc): SQL_SUCCESS
> SQLFreeHandle(SQL_HANDLE_ENV, OD_env): SQL_SUCCESS
> SQL query: 'SELECT KLIMA FROM OV_AS_LAB_LUMEN.IFO_DATA'
> Number of columns = 1
> col 1 (KLIMA): data_type SQL_DECIMAL, size 4, digits 1, nullable 2
> Number of Rows (from SQLRowCount) = 1886
> SQLFreeHandle(SQL_HANDLE_STMT): SQL_SUCCESS
> SQLDisconnect: SQL_SUCCESS
> SQLFreeHandle(SQL_HANDLE_DBC): SQL_SUCCESS
> SQLFreeHandle(SQL_HANDLE_ENV): SQL_SUCCESS
> </TERMINAL_1>
>
>
>
> Here "sektor" is a string variable.
>
> <QUERY_2>
> open dsn=@DSN user=@USER password=@PW --odbc
> data sektor query="SELECT SEKTOR FROM OV_AS_LAB_LUMEN.IFO_DATA" --odbc
> </QUERY_2>
>
> <ERROR_2>
> ERROR: Error executing script: halting
>> data sektor query="SELECT KLIMA FROM OV_AS_LAB_LUMEN.IFO_DATA" --odbc
> </ERROR_2>
>
> Again I get a new series but all values are missings which is also
> wrong.
>
> <TERMINAL_2>
> SQLDisconnect(dbc): SQL_SUCCESS
> SQLFreeHandle(SQL_HANDLE_DBC, dbc): SQL_SUCCESS
> SQLFreeHandle(SQL_HANDLE_ENV, OD_env): SQL_SUCCESS
> SQL query: 'SELECT SEKTOR FROM OV_AS_LAB_LUMEN.IFO_DATA'
> Number of columns = 1
> col 1 (SEKTOR): data_type SQL_VARCHAR, size 20, digits 0, nullable 2
> binding data col 1 to strvals[0] (len = 20)
> Number of Rows (from SQLRowCount) = 1886
> SQLFreeHandle(SQL_HANDLE_STMT): SQL_SUCCESS
> SQLDisconnect: SQL_SUCCESS
> SQLFreeHandle(SQL_HANDLE_DBC): SQL_SUCCESS
> SQLFreeHandle(SQL_HANDLE_ENV): SQL_SUCCESS
> </TERMINAL_2>
>
> Any idea what's going on here?
Hard to say without access to the database in question. But if you're
using self-compiled gretl you could redefine ODBC_DEBUG
in plugin/odbc_import.c, line 247, to 1 and see more of what's going on.
It's me again. I hope you're all doing well during this crisis time!
I had again a look at this issue. So the connection is there and the
correct data gets fetched. However, the resulting series "klima" has
only zeros. The error message is "Error executing script: halting". The
terminal output is:
<Terminal>
SQL query: 'SELECT KLIMA FROM OV_AS_LAB_LUMEN.IFO_DATA LIMIT 5'
Number of columns = 1
col 1 (KLIMA): data_type SQL_DECIMAL, size 4, digits 1, nullable 2
Number of Rows (from SQLRowCount) = 5
Fetch, row 0: col 0: data value 102.2
Fetch, row 1: col 0: data value 102.5
Fetch, row 2: col 0: data value 99.7
Fetch, row 3: col 0: data value 102.6
Fetch, row 4: col 0: data value 101.5
SQLFreeHandle(SQL_HANDLE_STMT): SQL_SUCCESS
SQLDisconnect: SQL_SUCCESS
SQLFreeHandle(SQL_HANDLE_DBC): SQL_SUCCESS
SQLFreeHandle(SQL_HANDLE_ENV): SQL_SUCCESS
</Terminal>
I know that it worked before latest feature implementing fetching
string-valued series.
Thanks,
Artur