[unixODBC-support] Seting up unixODBC text file driver for basic tests

Mike Roze mike.roze at gmail.com
Fri Jun 22 20:18:07 BST 2007


I've installed unixODBC and I'm trying to run some basic tests with
the text file driver.  My isql queries are failing with a "Could not
SQLPrepare" error and I'm having trouble finding thorough instructions
on the web for performing tests with the text file driver.  Does
anyone have suggestions?

Here's the isql output from a failed SQL select on table "hello" and
the output from an apparently successful SQL "help hello" command
(lines truncated):

$ isql -v Text
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> select * from hello
[-----][unixODBC]START: hStmt = 0x8a37340 nAttribute = 10010
[-----][unixODBC]END: Attribute not supported.
[-----][unixODBC]START: hStmt = 0x8a37340 nAttribute = 10011
[-----][unixODBC]END: Attribute not supported.
[-----][unixODBC]START: hStmt = 0x8a37340 nAttribute = 10012
[-----][unixODBC]END: Attribute not supported.
[-----][unixODBC]START: hStmt = 0x8a37340 nAttribute = 10013
[-----][unixODBC]END: Attribute not supported.
[-----][unixODBC]hStmt = 0x8a37340
[-----][unixODBC]syntax error processing 'select' on line 1
[ISQL]ERROR: Could not SQLPrepare
SQL> help hello
+---------------------------------------------------+-------------
| TABLE_CAT                                         | TABLE_SCHEM
+---------------------------------------------------+-------------
| Text                                              | Text
| Text                                              | Text
+---------------------------------------------------+-------------
SQLRowCount returns 2
2 rows fetched


Here is my current configuration:
$ cat odbc.ini
[Text]
Description             = TextFile
Driver          = TextFile
Directory               = /tmp/odbcText
ReadOnly                = No
CaseSensitive           = Yes
Catalog         = No
ColumnSeperator         = ,

$ cat odbcinst.ini
[TextFile]
Description             = ODBC for text file tables
Driver          = /usr/local/unixODBC/lib/libodbctxt.so
Driver64                = /usr/local/unixODBC/lib/libodbctxt.so
Setup           = /usr/local/unixODBC/lib/libodbctxtS.so
Setup64         = /usr/local/unixODBC/lib/libodbctxtS.so
UsageCount              = 1
CPTimeout               =
CPReuse         =

[PostgreSQL]
Description             = ODBC for PostgreSQL
Driver          = /usr/lib/libodbcpsql.so
Driver64                = /usr/lib/libodbcpsql.so
Setup           = /usr/lib/libodbcpsqlS.so
Setup64         = /usr/lib/libodbcpsqlS.so
UsageCount              =
CPTimeout               =
CPReuse         =
FileUsage               = 1

I haven't found a file format description for the text file tables.
What is the format?
I've tried placing these lines in file 'hello' as a test
id,name
1,mike
2,ed

Thanks!



More information about the unixODBC-support mailing list