1

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.

3 Answers 3

4

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.

1

Your diagnosis is correct. There is no need to upgrade however, since the two can be installed in parallel.

yum install freetds.x86_64
1
  • When I run the command above, I get the following message: "Package freetds-0.64-11.el5.centos.x86_64 already installed and latest version Nothing to do." Is there something else I need to do?
    – wonder95
    Nov 16, 2010 at 4:40
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.