Reputation: 4245
I am working on a site where I need to import data from a remote MS SQL Server database into a MySQL database on a Unix server via PHP. Thanks to answers to this post, I was able to get everything up and running on my dev environment (Mac OS X 10.6). Now, however, I'm trying to get my server environment set up, which is CentOS 5.4. I have unixODBC and FreeTDS installed and configured, but when I try to connect, I get the following error:
Connection Failed:[unixODBC][Driver Manager]Can't open lib '/usr/lib/libtdsodbc.so.0' : /usr/lib/libtdsodbc.so.0: wrong ELF class: ELFCLASS32
From what I've been able to find on the internets, it seems that I have 32 bit unixODBC (or FreeTDS, I'm not sure) installed (libtdsodbc.so.0 is symlinked to libtdsodbc.so.0.0.0) and it needs to be 64 bit. Is that correct? If so, how do I upgrade to 64 bit version? I'm a developer, not a server guru, so this is a bit outside of my server knowledge.
Thanks.
Upvotes: 1
Views: 8759
Reputation: 2657
This fix didn't work for me. I did install freetds.x86_64
as well (it let me install but reported conflicts) and the path ./usr/lib/libtdsodbc.so.0
was correct. Created a symbolic link anyway in case internals would be looking for it.
ln -s /usr/lib/libtdsodbc.so.0 /usr/lib64/libtdsodbc.so.0
I originally followed the instructions at MediaTemple, but have seen other articles for Cent OS on 64-bit. Will report back if I find anything that works for me.
Indeed, removing FreeTDS, restarting Apache, installing the 64-bit package mentioned above and updating the odbcinst.ini path, I was able to get past the above error, and in fact, remove errors.
I am now successfully "talking" to the MS SQL server, although it is now giving me generic errors. sigh. Anyway, got most of the way there. Hope this helps someone.
Upvotes: 0
Reputation: 553
Changing the reference in odbcinst.ini from /usr/lib/libtdsodbc.so.0
to /usr/lib64/libtdsodbc.so.0
fixed this error for us in the same configuration as you describe.
Upvotes: 4
Reputation: 798456
Your diagnosis is correct. There is no need to upgrade however, since the two can be installed in parallel.
yum install freetds.x86_64
Upvotes: 1