Page 1 of 1

Connect to a ODBC DB

Posted: Fri Dec 19, 2003 4:31 am
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

Posted: Fri Dec 19, 2003 7:21 am
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)

Posted: Fri Dec 19, 2003 9:15 am
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

Posted: Wed Dec 24, 2003 9:09 am
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?

Posted: Mon Dec 29, 2003 7:37 am
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

Posted: Mon Jan 05, 2004 3:27 am
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