Connect to a ODBC DB

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
RedRasper
Forum Commoner
Posts: 48
Joined: Thu Apr 24, 2003 6:36 am

Connect to a ODBC DB

Post by RedRasper »

Hi all,

I've been looking on the web, and I'm completely at a blank, so i thought i'd ask you guys if you could help me!

Basically I have php 4.3.4 running apache 2 on a redhat system.

All I want to do is connect to a MS SQL server, but I don't know how to do it.

Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect

I keep getting that error, I think it might be due to setting up a DSN, but I'm not sure how to go about that in linux.

If anyone can point me in the right direction it would be very much appreciated!

RedRasper
User avatar
igoy
Forum Contributor
Posts: 203
Joined: Fri May 02, 2003 11:57 pm
Location: India
Contact:

Post by igoy »

Allthough I'm not that deep in Linux systems, maybe you will require ODBC connector drivers of Linux ??

pardon me if I'm wrong but just a guess, or maybe Database Abstraction Layer in PHP (trust me, I've never used it or worked on it but have heard this quite a few time)
RedRasper
Forum Commoner
Posts: 48
Joined: Thu Apr 24, 2003 6:36 am

Post by RedRasper »

OK, it seems more the problem now is how to get php in redhat working with odbc.

I have it working from my windows machine, but can't seem to run it from the redhat machine.

What ./configure do i need to get the odbc commands imported into php. I tried --with-odbc, but that doesn't seem to have worked, and so i'm getting errors that odbc_connect is an undefined function.

Any help?

Cheers

RedRasper
User avatar
devork
Forum Contributor
Posts: 213
Joined: Fri Aug 08, 2003 6:44 am
Location: p(h) developer's network

Post by devork »

./configure --with-odbc --enable-odbc
try this

I think red hat 9 has built in support for odbc in php 4.3.x

you want to connect to odbc on the same linux machine or other windows machine?
RedRasper
Forum Commoner
Posts: 48
Joined: Thu Apr 24, 2003 6:36 am

Post by RedRasper »

Hi,

Yes its from the linux box to a windows 2k server.

I'll give the configure arguments you gave me a go and see how i get on!

Many thanks!

RedRasper
RedRasper
Forum Commoner
Posts: 48
Joined: Thu Apr 24, 2003 6:36 am

Post by RedRasper »

Hi,

I gave that ago. The actual ./configure was :

./configure --enable-ftp --enable-xml --with-mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-odbc --enable-odbc

I still get Fatal error: Call to undefined function: odbc_connect() though.

Any ideas?

Thanks for your help!

RedRasper
Post Reply