Jump to content

Trouble connecting to ODBC


jakebur01

Recommended Posts

I have "UPC" setup as a system dsn, type "CodeBaseOdbcStand", and I can connect to it from access.  However, I am not having success yet using php.  This is a connection to .dbf /.cdx files for data associated with our inventory program.

 

 

ERROR

PHP Warning:  odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: [simba][simbaEngine ODBC Driver][DRM File Library]No such database., SQL state 08004 in SQLConnect in C:\Inetpub\wwwroot\test.php on line 6

 

CODE

<html>
<body>


<?php
$conn=odbc_connect('UPC','','');
if (!$conn)
  {exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM ARUPC";
$rs=odbc_exec($conn,$sql);
if (!$rs)
  {exit("Error in SQL");}
echo "<table><tr>";
echo "<th>UPC</th>";
echo "<th>ITEM</th></tr>";
while (odbc_fetch_row($rs))
  {
  $UPC=odbc_result($rs,"UPC");
  $ITEM=odbc_result($rs,"ITEM");
  echo "<tr><td>$UPC</td>";
  echo "<td>$ITEM</td></tr>";
  }
odbc_close($conn);
echo "</table>";

?>

</body>
</html> 

Link to comment
Share on other sites

cmd output:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\bruser>php C:\Inetpub\wwwroot\test.php
<html>
<body>


<table><tr><th>UPC</th><th>ITEM</th></tr><tr><td></td><td></td></tr><tr><td>7895
9-02120</td><td>6105</td></tr><tr><td>2959900038</td><td>8623</td></tr><tr><td>0
72564053048</td><td>0553</td></tr><tr><td>03874402233</td><td>0898</td></tr><tr>
<td>03874402277</td><td>0899</td></tr><tr><td>85771-24508-9</td><td>6940</td></t
r><tr><td>10099709600120</td><td>8972</td></tr><tr><td>052100010762</td><td>8252
</td></tr><tr><td>41799853811</td><td>0634</td></tr><tr><td>72714100113</td><td>
0992</td></tr><tr><td>9357388262</td><td>1000</td></tr><tr><td>9357388263</td><t
d>1002</td></tr><tr><td>9357388264</td><td>1004</td></tr><tr><td>9357388265</td>
<td>1006</td></tr><tr><td>9357388794</td><td>1008</td></tr><tr><td>9357388266</t
d><td>1010</td></tr><tr><td>9357728040</td><td>1428</td></tr><tr><td>9047821211<
/td><td>1552</td></tr><tr><td>9047821241</td><td>1553</td></tr><tr><td>904782121
2</td><td>1554</td></tr><tr><td>9047821240</td><td>1556</td></tr><tr><td>9047821
214</td><td>1558</td></tr><tr><td>9047821243</td><td>1560</td></tr><tr><td>90478
21213</td><td>1562</td></tr><tr><td>9047821218</td><td>1563</td></tr><tr><td>904
7821621</td><td>1564</td></tr><tr><td>9047821622</td><td>1566</td></tr><tr><td>9
047821628</td><td>1568</td></tr><tr><td>9047821630</td><td>1570</td></tr><tr><td
>9047821623</td><td>1572</td></tr><tr><td>8615415131</td><td>1574</td></tr><tr><
td>4230100006</td><td>1576</td></tr><tr><td>8615475139</td><td>1578</td></tr><tr
><td>2986000101</td><td>1580</td></tr><tr><td>9047821220</td><td>1582</td></tr><
tr><td>5100001296</td><td>1606</td></tr><tr><td>93573882639</td><td>1002</td></t
r><tr><td>30908382380</td><td>0776</td></tr><tr><td>21952006229</td><td>0398</td
></tr><tr><td>93573882622</td><td>1000</td></tr><tr><td>51353001025</td><td>0089
</td></tr></table>
</body>
</html>
C:\Documents and Settings\bruser>^A^A

 

safari/ie output:

<html>
<body>


<br />
<b>Warning</b>:  odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: [simba][simbaEngine ODBC Driver][DRM File Library]No such database., SQL state 08004 in SQLConnect in <b>C:\Inetpub\wwwroot\test.php</b> on line <b>6</b><br />
Connection Failed: 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.