David,

I'm quickly losing track of where you are because you answered so many posts 
from days ago trying to help you and now mysql seems to be mentioned. Let me 
try and explain some of what you are doing and why it might be going wrong.

"I am not explicitly specifying iODBC"

When DBD::ODBC was built (maybe not by you) or installed from some MAC package it was 
linked against an ODBC driver manager. The ODBC Driver manager is what loads the ODBC 
driver when you call connect. Your error contained "[iODBC][Driver Manager]" so 
I think you are using the iODBC Driver Manager which is a common one in use on Macs.

"Specified driver could not be loaded"
when you used a connect string of "DBI:ODBC:Driver={SQL 
Server};Server=$server;Database=$db"

The first thing to note here is that the "DBI" should be "dbi" so if this 
connect string was copied from Windows it cannot be working there either.

The second thing is that what you are requesting the iODBC driver manager to do if find the ODBC 
Driver called "SQL Server" and load it with dlopen. When you do this iODBC needs to 
locate the path to the driver shared object for the driver called "SQL Server" and iODBC 
uses a configuration file to tie drivers to shared objects - probably iodbc.ini. Whatever is in 
your iODBC config files points it at a shared object which cannot be loaded. I don't use iODBC so I 
don't know what it does if it cannot find a driver but given the last error mentions dlopen it 
suggests to me:

1. you have an iODBC configuration file that iODBC knows about
2. it contains a definition for the driver "SQL Server"
3. it contains a "driver" key for "SQL Server" which points at some file
4. dlopen cannot load the file named in 3.

4 fails because of:

1. file does not exist
2. shared object exists but permissions are wrong
3. shared object exists and permissions ok but it depends on something else 
either not on your system or not in your path or having problem 2

Given your error was "dlopen({SQL Server}, 6): image not found" I'd suggest 1.

Other things you said in other replies:

I am running a test script that lists the drivers and then connects to list the 
tables. I get this:

$ perl testdbi.pl

Driver: DBM
Driver: ExampleP
Driver: File
Driver: Gofer
Driver: ODBC
Driver: Proxy
Driver: Sponge

DBI connect('Driver={SQL 
Server};Server=database.domain.com;Database=MyDB','readonly',...) failed: 
[iODBC][Driver Manager]Specified driver could not be loaded (SQL-IM003) [state 
was IM003 now 00000]

I cannot see who that script automatically knows to use "Driver={SQL Server}" 
etc in that connect string - this muct be hard-coded in your script somewhere.

What is the recommended course of action? Do I need to install/uninstall 
something? Or is it an ODBC configuration setting I need to change?

To use DBD::ODBC you need an ODBC Driver. It sounds like you at least have parts of a 
driver since iODBC seems to think you have a driver called "SQL Server". You 
need to find the iODBC config file and see what it says. To connect to MS SQL Server you 
will need an ODBC driver that talks to MS SQL Server such as freeTDS or other commercial 
solutions. BTW, I think there is a GUI config program for iODBC - try fining that.

Clapper SQLCMD is a Python application that uses '/usr/local/lib/libmyodbc3.so'.

So do you want to connect to MS SQL Server or MySQL? You need different ODBC 
drivers for each.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to