Defining DSN and Driver

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Defining DSN and Driver

Rich Shepard
   Just built and installed unixODBC-2.3.2 on Slackware-14.1. There is no
ODBCConfig file on the system, and it was built with GUI support enabled.

   I want to use it with sqlite3odbc. When I try to establish a connection to
a sqlite3 .db from LibreOffice-4.3.5 an error message is displayed:

"[unixODBC][Driver Manager] Data source name not found, and no default
driver specified."

   /etc/uniodbc.ini contains:

[SQLITE3]
Description = SQLite3 ODBC Driver
Driver      = /usr/local/lib/libsqlite3odbc.so
Setup       = /usr/local/lib/libsqlite3odbc.so
Threading   = 2

   If this is sufficient configuation for unixODBC, then the issue is located
in not being able -- yet -- to defining the DSN and driver in LO.

Advice needed,

Rich
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Nick Gorham-2
On 19/01/15 19:04, Rich Shepard wrote:

>   Just built and installed unixODBC-2.3.2 on Slackware-14.1. There is no
> ODBCConfig file on the system, and it was built with GUI support enabled.
>
>   I want to use it with sqlite3odbc. When I try to establish a
> connection to
> a sqlite3 .db from LibreOffice-4.3.5 an error message is displayed:
>
> "[unixODBC][Driver Manager] Data source name not found, and no default
> driver specified."
>
>   /etc/uniodbc.ini contains:
>
> [SQLITE3]
> Description = SQLite3 ODBC Driver
> Driver      = /usr/local/lib/libsqlite3odbc.so
> Setup       = /usr/local/lib/libsqlite3odbc.so
> Threading   = 2
>
>   If this is sufficient configuation for unixODBC, then the issue is
> located
> in not being able -- yet -- to defining the DSN and driver in LO.
>
> Advice needed,

You just need to create a entry in /etc/odbc.ini

--
Nick
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Rich Shepard
On Mon, 19 Jan 2015, Nick Gorham wrote:

> You just need to create a entry in /etc/odbc.ini

Nick,

   Have those:

  /etc/odbc.ini
[SQLite]
Description=SQLite ODBC Driver
Driver=/usr/local/lib/libsqlite3odbc.so
Setup=/usr/local/lib/libsqlite3odbc.so
Threading=2

  /etc/obcinst.ini
[SQLite]
Description=SQLite ODBC Driver
Driver=/usr/local/lib/libsqlite3odbc.so
Setup=/usr/local/lib/libsqlite3odbc.so
Threading=2

  ~/.odbc.ini
[no-mdf-banquetdb]
Description=North Oregon MDF chapter banquet database
Driver=SQLite3
Database=/documents/mdf/banquet-mgr/or-mdf-banquet.db
Timeout=2000

   Is there a syntax error in any of these?

Thanks,

Rich
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Nick Gorham-2
On 19/01/15 21:31, Rich Shepard wrote:

> On Mon, 19 Jan 2015, Nick Gorham wrote:
>
>> You just need to create a entry in /etc/odbc.ini
>
> Nick,
>
>   Have those:
>
>     /etc/odbc.ini
> [SQLite]
> Description=SQLite ODBC Driver
> Driver=/usr/local/lib/libsqlite3odbc.so
> Setup=/usr/local/lib/libsqlite3odbc.so
> Threading=2
>
That is what you would have in odbcinst.ini
>     /etc/obcinst.ini
> [SQLite]
> Description=SQLite ODBC Driver
> Driver=/usr/local/lib/libsqlite3odbc.so
> Setup=/usr/local/lib/libsqlite3odbc.so
> Threading=2

Check the lib loads with

dltest /usr/local/lib/libsqlite3odbc.so SQLConnect
>
>     ~/.odbc.ini
> [no-mdf-banquetdb]
> Description=North Oregon MDF chapter banquet database
> Driver=SQLite3
> Database=/documents/mdf/banquet-mgr/or-mdf-banquet.db
> Timeout=2000
>
>   Is there a syntax error in any of these?

The

Driver=SQLite3

Needs to match the entry in odbcinst.ini

[SQLite]

So I would try

Driver=SQLite

--
Nick
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Rich Shepard
On Mon, 19 Jan 2015, Nick Gorham wrote:

>>     /etc/obcinst.ini

   typo: that's /etc/odbcinst.ini
> Check the lib loads with
> dltest /usr/local/lib/libsqlite3odbc.so SQLConnect

[rshepard@salmo ~]$ dltest /usr/local/lib/libsqlite3odbc.so SQLConnect
SUCCESS: Loaded /usr/local/lib/libsqlite3odbc.so
SUCCESS: Found SQLConnect

   Forgot that there's also /etc/unixodbc.ini with

[SQLITE3]
Description = SQLite3 ODBC Driver
Driver      = /usr/local/lib/libsqlite3odbc.so
Setup       = /usr/local/lib/libsqlite3odbc.so
Threading   = 2


> The
>
> Driver=SQLite3
>
> Needs to match the entry in odbcinst.ini
>
> [SQLite]
>
> So I would try
>
> Driver=SQLite

   Just tried that, and changed to [SQLite3], neither fixed the problem.

THanks,

Rich
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Nick Gorham-2
On 19/01/15 21:44, Rich Shepard wrote:

> On Mon, 19 Jan 2015, Nick Gorham wrote:
>
>>>     /etc/obcinst.ini
>
>   typo: that's /etc/odbcinst.ini
>> Check the lib loads with
>> dltest /usr/local/lib/libsqlite3odbc.so SQLConnect
>
> [rshepard@salmo ~]$ dltest /usr/local/lib/libsqlite3odbc.so SQLConnect
> SUCCESS: Loaded /usr/local/lib/libsqlite3odbc.so
> SUCCESS: Found SQLConnect
>
>   Forgot that there's also /etc/unixodbc.ini with
>
> [SQLITE3]
> Description = SQLite3 ODBC Driver
> Driver      = /usr/local/lib/libsqlite3odbc.so
> Setup       = /usr/local/lib/libsqlite3odbc.so
> Threading   = 2
>
>
>> The
>>
>> Driver=SQLite3
>>
>> Needs to match the entry in odbcinst.ini
>>
>> [SQLite]
>>
>> So I would try
>>
>> Driver=SQLite
>
>   Just tried that, and changed to [SQLite3], neither fixed the problem.
>
> THanks,
>
> Rich

Try using isql

isql -v no-mdf-banquetdb

What does that report?

--
Nick
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Rich Shepard
On Mon, 19 Jan 2015, Nick Gorham wrote:

> Try using isql
> isql -v no-mdf-banquetdb
> What does that report?

Nick,

   Aha! that looks like the source of the problem:

[rshepard@salmo ~]$ isql -v no-mdf-banquetdb
[S1000][unixODBC][SQLite]connect failed
[ISQL]ERROR: Could not SQLConnect

   The man page says that isql is the cli to unixODBC. Could that be the
interface that LO is using?

Thanks,

Rich

_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Nick Gorham-2
On 19/01/15 22:08, Rich Shepard wrote:

> On Mon, 19 Jan 2015, Nick Gorham wrote:
>
>> Try using isql
>> isql -v no-mdf-banquetdb
>> What does that report?
>
> Nick,
>
>   Aha! that looks like the source of the problem:
>
> [rshepard@salmo ~]$ isql -v no-mdf-banquetdb
> [S1000][unixODBC][SQLite]connect failed
> [ISQL]ERROR: Could not SQLConnect

Ok, so its got through unixODBC to the driver and the driver is
reporting that it failed to connect.

I would check the ini file entries. I would also try setting

export ODBCINI=/etc/odbc.ini

it may be that the driver is reading the ini file itself and is not sure
which one to read.
>
>   The man page says that isql is the cli to unixODBC. Could that be the
> interface that LO is using?

No, LO uses the ODBC API, isql is just a simple app that makes ODBC calls.

--
Nick
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Rich Shepard
On Mon, 19 Jan 2015, Nick Gorham wrote:

> I would check the ini file entries. I would also try setting
> export ODBCINI=/etc/odbc.ini

Nick,

   This makes no difference.

> it may be that the driver is reading the ini file itself and is not sure
> which one to read.

   Perhaps I have too many? The three in /etc are odbc.ini, obdcinst.ini, and
unixodbc.ini; the one in ~/ is .odbc.ini.

/etc/odbc.ini:
[SQLite3]
Description=SQLite ODBC Driver
Driver=/usr/local/lib/libsqlite3odbc.so
Setup=/usr/local/lib/libsqlite3odbc.so
Threading=2

/etc/odbcinst.ini:
[SQLite3]
Description=SQLite ODBC Driver
Driver=/usr/local/lib/libsqlite3odbc.so
Setup=/usr/local/lib/libsqlite3odbc.so
Threading=2

/etc/unixodbc.ini:
[SQLITE3]
Description = SQLite3 ODBC Driver
Driver      = /usr/local/lib/libsqlite3odbc.so
Setup       = /usr/local/lib/libsqlite3odbc.so
Threading   = 2

~/.odbc.ini:
[no-mdf-banquetdb]
Description=North Oregon MDF chapter banquet database
Driver=SQLite3
Database=/documents/mdf/banquet-mgr/or-mdf-banquet.db
Timeout=2000

> No, LO uses the ODBC API, isql is just a simple app that makes ODBC calls.

   Thanks for clarifying.

Rich
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Rich Shepard
In reply to this post by Nick Gorham-2
On Mon, 19 Jan 2015, Nick Gorham wrote:

> Ok, so its got through unixODBC to the driver and the driver is reporting
> that it failed to connect.
>
> I would check the ini file entries.

Nick,

   The .ini files in /etc/ match what every source says they should be. I
changed ~/.odbc.ini to ~/odbc.ini with no effect.

   Is there a way of stepping through the isql test to see just where it's
failing?

   I'm sure this is as frustrating to you as it is to me. Everything _seems_
to be correct, but it just won't work.

Thanks,

Rich
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Nick Gorham-2
On 20/01/15 17:11, Rich Shepard wrote:

> On Mon, 19 Jan 2015, Nick Gorham wrote:
>
>> Ok, so its got through unixODBC to the driver and the driver is
>> reporting that it failed to connect.
>>
>> I would check the ini file entries.
>
> Nick,
>
>   The .ini files in /etc/ match what every source says they should be. I
> changed ~/.odbc.ini to ~/odbc.ini with no effect.
>
>   Is there a way of stepping through the isql test to see just where it's
> failing?

No, its calling SQLConnect in the driver, and that is returning that it
failed to connect, so there are no steps available for isql to step through.
>
>   I'm sure this is as frustrating to you as it is to me. Everything
> _seems_
> to be correct, but it just won't work.

At this point, try using strace to see if the drive is connecting and
where it fails

strace -o st.log isql -v no-mdf-banquetdb

I would also check if the database exists and can be opened.

ls -l /documents/mdf/banquet-mgr/or-mdf-banquet.db

Beyond that I would ask the folk behind the driver. There may be
specific driver logging options that would help debug the problem.

--
Nick
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Rich Shepard
In reply to this post by Rich Shepard
On Tue, 20 Jan 2015, Nick Gorham wrote:

> At this point, try using strace to see if the drive is connecting and where
> it fails
> strace -o st.log isql -v no-mdf-banquetdb

   Looks like the problem is that isql is looking in /usr/local/eclipse/ and
I have neither /etc/ld.so.preload nor a /usr/local/eclipse/ subdirectory here:

execve("/usr/bin/isql", ["isql", "-v", "no-mdf-banquetdb"], [/* 49 vars */]) =
0
brk(0)                                  = 0x983f000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7735000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/usr/local/eclipse/tls/i686/sse2/libodbc.so.2", O_RDONLY|O_CLOEXEC) = -1
ENOENT (No such file or directory)
stat64("/usr/local/eclipse/tls/i686/sse2", 0xbff6c900) = -1 ENOENT (No such
file or directory)
open("/usr/local/eclipse/tls/i686/libodbc.so.2", O_RDONLY|O_CLOEXEC) = -1

   Here, libodbc.so.2 is installed in /usr/lib/, as follows;

open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=197432, ...}) = 0
mmap2(NULL, 197432, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7704000
close(3)                                = 0
open("/usr/lib/libodbc.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000=\0\0004\0\0\0"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=442368, ...}) = 0
mmap2(NULL, 444036, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0xb7697000
mmap2(0xb76ff000, 16384, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x68000) = 0xb76ff000
mmap2(0xb7703000, 1668, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7703000
close(3)                                = 0

open("/usr/lib/qt/lib/libreadline.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No
such file or directory)

   Here, it's /usr/lib/libreadline.so.5, found below:

open("/usr/lib/libreadline.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0`\273\0\0004\0\0\0"...,
512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=193020, ...}) = 0
mmap2(NULL, 195668, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0xb7667000
mmap2(0xb7692000, 16384, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2b000) = 0xb7692000
mmap2(0xb7696000, 3156, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7696000
close(3)                                = 0

   It turns out that I do have an issue with libncurses: /lib/libncurses.so
is a softlink to /lib/libncurses.so.5, which is a softlink to
/lib/libncurses.so. Circular links! Let me straighten this out first.

> I would also check if the database exists and can be opened.
> ls -l /documents/mdf/banquet-mgr/or-mdf-banquet.db

   No problem opening it with sqlite3. And, the perms are 644.

Rich
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Nick Gorham-2
On 20/01/15 17:59, Rich Shepard wrote:

> On Tue, 20 Jan 2015, Nick Gorham wrote:
>
>> At this point, try using strace to see if the drive is connecting and
>> where it fails
>> strace -o st.log isql -v no-mdf-banquetdb
>
>   Looks like the problem is that isql is looking in
> /usr/local/eclipse/ and
> I have neither /etc/ld.so.preload nor a /usr/local/eclipse/
> subdirectory here:
>
> execve("/usr/bin/isql", ["isql", "-v", "no-mdf-banquetdb"], [/* 49
> vars */]) = 0
> brk(0)                                  = 0x983f000
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
> 0) = 0xb7735000
> access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or
> directory)
> open("/usr/local/eclipse/tls/i686/sse2/libodbc.so.2",
> O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> stat64("/usr/local/eclipse/tls/i686/sse2", 0xbff6c900) = -1 ENOENT (No
> such file or directory)
> open("/usr/local/eclipse/tls/i686/libodbc.so.2", O_RDONLY|O_CLOEXEC) = -1

isql doesnt look explicit anywhere (other than the Driver= entry), its
whatever your system load path is set to.

Also, it doesnt try once and give up, you will find in the log the
system will try a few places lo load a library.

--
Nick
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support
Reply | Threaded
Open this post in threaded view
|

Re: Defining DSN and Driver

Rich Shepard
On Tue, 20 Jan 2015, Nick Gorham wrote:

> Also, it doesnt try once and give up, you will find in the log the system
> will try a few places lo load a library.

   I saw that. I'll try again when I clean up the duplicate libncurses.so
(one from 2010 the other from 2014, with 1 byte file size differencs). If
that doesn't work I'll give up and write the application with
Python/wxPython.

   Nothing shows up as a reason for LO's Base to not connect to the sqlite3
.db.

Thanks, Nick,

Rich
_______________________________________________
unixODBC-support mailing list
[hidden email]
http://mailman.unixodbc.org/mailman/listinfo/unixodbc-support