odbc_connect fails
| From: | Boris Pran | Date: | Sat, 14 Apr 2001 19:29:29 +0000 |
| Subject: | odbc_connect fails | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-8571@lists.php.net to get a copy of this message | ||
Hi,
I have compiled php-4.0.4pl1 + apache-1.3.19 + iodbc-3.0.4 (2.50.3) +
postgresql-7.1 (7.0.3)
odbc_connect returns error:
Warning: SQL error: Missing server name, port, or database name in call
to CC_connect., SQL state IM002 in SQLConnect in
/usr/local/apache/htdocs/test.php on line 9
Any ideas ?
Thanks,
Boris.
-----------------------------------------
My odbc.ini looks like:
[ODBC Data Sources]
test = PostgreSQL
[test]
Driver = /usr/local/pgsql/lib/libpsqlodbc.so
ServerName = localhost
Database = test
Port = 5432
Username = boris
Password = something
and script looks like:
<?
putenv("ODBCINSTINI=/usr/local/etc/odbcinst.ini");
putenv("ODBCINI=/usr/local/etc/odbc.ini");
$dsn = "DSN=test";
$user = "boris";
$password = "something";
if($conn=odbc_connect("$dsn","","")){
echo "connected";
odbc_close($conn);
}
else {
echo "not connected";
}
?>