jakebur01 Posted March 22, 2011 Share Posted March 22, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/231406-trouble-connecting-to-odbc/ Share on other sites More sharing options...
jakebur01 Posted March 22, 2011 Author Share Posted March 22, 2011 It is some kind of permission issue. If I run: php C:\Inetpub\wwwroot\test.php from the command line, it prints out all the table data. What permissions do I need to set in order to be able to access this data through my browser? Quote Link to comment https://forums.phpfreaks.com/topic/231406-trouble-connecting-to-odbc/#findComment-1190889 Share on other sites More sharing options...
jakebur01 Posted March 22, 2011 Author Share Posted March 22, 2011 Oh... and I'm running php 5.3.6 with IIS 5 on xp professional. Quote Link to comment https://forums.phpfreaks.com/topic/231406-trouble-connecting-to-odbc/#findComment-1190933 Share on other sites More sharing options...
jakebur01 Posted March 22, 2011 Author Share Posted March 22, 2011 also using fastcgi Quote Link to comment https://forums.phpfreaks.com/topic/231406-trouble-connecting-to-odbc/#findComment-1190980 Share on other sites More sharing options...
jakebur01 Posted March 22, 2011 Author Share Posted March 22, 2011 Does anybody have any idea why I can access the data from this odbc connection through the command prompt but not through my web browser? Quote Link to comment https://forums.phpfreaks.com/topic/231406-trouble-connecting-to-odbc/#findComment-1190991 Share on other sites More sharing options...
jakebur01 Posted March 22, 2011 Author Share Posted March 22, 2011 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: Quote Link to comment https://forums.phpfreaks.com/topic/231406-trouble-connecting-to-odbc/#findComment-1191003 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.