By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,969 Members | 2,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,969 IT Pros & Developers. It's quick & easy.

odbc error - need help

P: n/a
Dan
Hi,

I am using the Employee.fdb sample that comes with Firebird 1.5.1.
Everything resides on a WinXP Pro pc. I set up an ODBC connection
called "FB Employee Sample" and tested it with MS Access and Brio; works
OKAY. When I try to run the following script:

***************************
<html>
<body>

<?php
$conn=odbc_connect('FB Employee Sample','SYSDBA','masterkey');
if (!$conn)
{
exit("Connection Failed: " . $conn);
}
$sql="SELECT * FROM EMPLOYEES";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{
exit("Error in SQL");
}
echo "<table><tr>";
echo "<th>Employee Name</th>";
echo "<th>Employee ID</th></tr>";
while (odbc_fetch_row($rs))
{
$empname=odbc_result($rs,"Full Name");
$empid=odbc_result($rs,"ContactName");
echo "<tr><td>$empname</td>";
echo "<td>$empid</td></tr>";
}
odbc_close($conn);
echo "</table>";
?>

</body>
</html>
***************************

this is waht I get in the browser window: "Warning: odbc_connect()
[function.odbc-connect]: SQL error: unavailable database, SQL state
08004 in SQLConnect in C:\Inetpub\test\odbc-test2.php on line 5
Connection Failed::. Can someone please tell why this is not working in
PHP?

TIA,
Dan

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
LJR
I'm only guessing to be honest but I'd be seriously tempted to change the
DSN name to something 8 characters or less and without spaces:

resource odbc_connect ( string dsn, string user, string password [, int
cursor_type] )

In your case:
$res = odbc_connect('fbsamp', 'SYSDBA', 'masterkey');

Give it a go.

"Dan" <da*@nospam.com> wrote in message
news:u9***************@news.uswest.net...
Hi,

I am using the Employee.fdb sample that comes with Firebird 1.5.1.
Everything resides on a WinXP Pro pc. I set up an ODBC connection called
"FB Employee Sample" and tested it with MS Access and Brio; works OKAY.
When I try to run the following script:

***************************
<html>
<body>

<?php
$conn=odbc_connect('FB Employee Sample','SYSDBA','masterkey');
if (!$conn)
{
exit("Connection Failed: " . $conn);
}
$sql="SELECT * FROM EMPLOYEES";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{
exit("Error in SQL");
}
echo "<table><tr>";
echo "<th>Employee Name</th>";
echo "<th>Employee ID</th></tr>";
while (odbc_fetch_row($rs))
{
$empname=odbc_result($rs,"Full Name");
$empid=odbc_result($rs,"ContactName");
echo "<tr><td>$empname</td>";
echo "<td>$empid</td></tr>";
}
odbc_close($conn);
echo "</table>";
?>

</body>
</html>
***************************

this is waht I get in the browser window: "Warning: odbc_connect()
[function.odbc-connect]: SQL error: unavailable database, SQL state 08004
in SQLConnect in C:\Inetpub\test\odbc-test2.php on line 5
Connection Failed::. Can someone please tell why this is not working in
PHP?

TIA,
Dan

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.