473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Output differs between browser and console

This may be covered already, but I've yet to hit upon the search
terms to find it...

I'm running PHP v4.4.0 on a Windows 2000 Server (SP4) running IIS
v5. A simple script I'm using is generating ODBC errors (not finding
my tables) when I run the script through a web browser connected to
the IIS server.

If I then run the unchanged script locally, from a Windows console
window, the PHP script connects to the database and I can dump the
table listing and access a particular table fine - I see the database
contents scrolling by.

Could this be a problem with the ODBC driver? An IIS issue? A PHP
issue?

What blindingly obvious thing am I not seeing in my configuration?

Thanks.

Joe

Jul 5 '07 #1
9 2031
*** go****@thefifthimperium.com escribió/wrote (Thu, 05 Jul 2007 10:21:35
-0700):
I'm running PHP v4.4.0 on a Windows 2000 Server (SP4) running IIS
v5. A simple script I'm using is generating ODBC errors (not finding
my tables) when I run the script through a web browser connected to
the IIS server.

If I then run the unchanged script locally, from a Windows console
window, the PHP script connects to the database and I can dump the
table listing and access a particular table fine - I see the database
contents scrolling by.
Are you using a system-wide DSN or a user DSN? When you run a script from
the command line it uses your user credentials, but when you run it through
a web server it uses the credentials of whatever user the web server runs
as (typically "LocalSystem").

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Jul 5 '07 #2
On Jul 5, 1:56 pm, "Alvaro G. Vicario"
<webmas...@NOSPAMdemogracia.comwrote:
Are you using a system-wide DSN or a user DSN? When you run a script from
the command line it uses your user credentials, but when you run it through
a web server it uses the credentials of whatever user the web server runs
as (typically "LocalSystem").
Thanks, I ought to have included that in my original message.

The connection is being made through a system-wide DSN.

-JPB

Jul 5 '07 #3

<go****@thefifthimperium.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
This may be covered already, but I've yet to hit upon the search
terms to find it...

I'm running PHP v4.4.0 on a Windows 2000 Server (SP4) running IIS
v5. A simple script I'm using is generating ODBC errors (not finding
my tables) when I run the script through a web browser connected to
the IIS server.

If I then run the unchanged script locally, from a Windows console
window, the PHP script connects to the database and I can dump the
table listing and access a particular table fine - I see the database
contents scrolling by.

Could this be a problem with the ODBC driver? An IIS issue? A PHP
issue?

What blindingly obvious thing am I not seeing in my configuration?

Thanks.

Joe
Do you get any error messages?
Can you trim your script down to only the failing part?

Richard.
Jul 5 '07 #4
On Jul 5, 4:00 pm, "Richard" <root@localhostwrote:
Do you get any error messages?
Can you trim your script down to only the failing part?
As stated in the original, I'm getting what appears to be a general
'can't find tables' error:

PHP Warning: odbc_exec(): SQL error: [SmartWare Software][SmartWare
ODBC Driver][ISAM]Table access error, SQL state S0000 in SQLExecDirect
in D:\path\CustView\sw265test.php on line 52
PHP Warning: odbc_fetch_row(): supplied argument is not a valid ODBC
result resource in D:\path\sw265test.php on line 57

The ODBC driver is for an ANGOSS Smartware database, SWODBC32.DLL
V4.60.00.2127

The script code is pretty simple:

44 $conn = odbc_connect($dbhost, $dbuser, $dbpw);
45 $result = odbc_tables($conn);
46 odbc_result_all( $result );

//This returns No Results, but no error, either
// commented out lines here

51 $sql = "SELECT * FROM $dbname";
52 $result2 = odbc_exec( $conn, $sql );

// commented out lines here

57 while (odbc_fetch_row($result2)) {
echo odbc_result_all( $result2 );
}
-JPB

Jul 5 '07 #5
go****@thefifthimperium.com wrote:
<snip>
The script code is pretty simple:

44 $conn = odbc_connect($dbhost, $dbuser, $dbpw);
45 $result = odbc_tables($conn);
46 odbc_result_all( $result );

//This returns No Results, but no error, either
// commented out lines here

51 $sql = "SELECT * FROM $dbname";
52 $result2 = odbc_exec( $conn, $sql );

// commented out lines here

57 while (odbc_fetch_row($result2)) {
echo odbc_result_all( $result2 );
}
should the SQL read "SELECT * FROM $dbname.$tablename" ?
Jul 5 '07 #6
go****@thefifthimperium.com wrote:
On Jul 5, 4:00 pm, "Richard" <root@localhostwrote:
>Do you get any error messages?
Can you trim your script down to only the failing part?

As stated in the original, I'm getting what appears to be a general
'can't find tables' error:

PHP Warning: odbc_exec(): SQL error: [SmartWare Software][SmartWare
ODBC Driver][ISAM]Table access error, SQL state S0000 in SQLExecDirect
in D:\path\CustView\sw265test.php on line 52
PHP Warning: odbc_fetch_row(): supplied argument is not a valid ODBC
result resource in D:\path\sw265test.php on line 57

The ODBC driver is for an ANGOSS Smartware database, SWODBC32.DLL
V4.60.00.2127

The script code is pretty simple:

44 $conn = odbc_connect($dbhost, $dbuser, $dbpw);
45 $result = odbc_tables($conn);
46 odbc_result_all( $result );

//This returns No Results, but no error, either
// commented out lines here

51 $sql = "SELECT * FROM $dbname";
52 $result2 = odbc_exec( $conn, $sql );

// commented out lines here

57 while (odbc_fetch_row($result2)) {
echo odbc_result_all( $result2 );
}
-JPB
Maybe a stupid question - but does your web host have authority to open
the database files?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 5 '07 #7

<go****@thefifthimperium.comwrote in message
news:11**********************@57g2000hsv.googlegro ups.com...
On Jul 5, 4:00 pm, "Richard" <root@localhostwrote:
>Do you get any error messages?
Can you trim your script down to only the failing part?

As stated in the original, I'm getting what appears to be a general
'can't find tables' error:

PHP Warning: odbc_exec(): SQL error: [SmartWare Software][SmartWare
ODBC Driver][ISAM]Table access error, SQL state S0000 in SQLExecDirect
in D:\path\CustView\sw265test.php on line 52
PHP Warning: odbc_fetch_row(): supplied argument is not a valid ODBC
result resource in D:\path\sw265test.php on line 57

The ODBC driver is for an ANGOSS Smartware database, SWODBC32.DLL
V4.60.00.2127

The script code is pretty simple:

44 $conn = odbc_connect($dbhost, $dbuser, $dbpw);
45 $result = odbc_tables($conn);
46 odbc_result_all( $result );

//This returns No Results, but no error, either
// commented out lines here

51 $sql = "SELECT * FROM $dbname";
52 $result2 = odbc_exec( $conn, $sql );

// commented out lines here

57 while (odbc_fetch_row($result2)) {
echo odbc_result_all( $result2 );
}
-JPB
Hi JPB,
I read the "Table access error" as: there is something wrong with accessing
the table you specify, not necesarily that the table doesnt exist... could
also be a permissions problem, or a lot of other things.

As stated by someone else in this thread:
On line 51 it says dbname, but this is of course tablename I hope?

Does the webserver have permission to access the database? Do you need to
specify the allowed hosts anywhere (as in MySQL)? Maybe the hostname is
reported differently when running from the IIS. Or not at all.
Can you turn on error logging for the ODBC so you can see whats going on?
What does ANGOSS docs say about this specific error?

Good luck,
Richard.
Jul 6 '07 #8
On Jul 6, 9:29 am, "Richard" <root@localhostwrote:
Hi JPB,
I read the "Table access error" as: there is something wrong with accessing
the table you specify, not necesarily that the table doesnt exist... could
also be a permissions problem, or a lot of other things.
The driver in question has always struck me as being a bit on the
primitive side. From what I can discern, access control is only due to
file read/write file system settings (in this case Windows 2000).
As stated by someone else in this thread:
On line 51 it says dbname, but this is of course tablename I hope?
Funny that you spotted that... it was, indeed a table name reference.

One of the things that's always bugged me about ANGOSS and SmartWare
is that they do not use the terms 'database' and 'table' in an
industry-standard manner.

To them, a single table resides in a single file (along with seperate
key and view files, which they then call a 'database'. In their
usage, a 'table' is part of a custom view - a linked table, usually
with a one-to-many relationship which is then rendered in a literally
tabular fashion.

In terms of their ODBC driver, they treat a single directory
containing many 'databases' as other servers would treat a database
and a many tables within that database.

Sometimes I mix & match my usage of the terminology. Sloppy, I
admit.
Does the webserver have permission to access the database? Do you need to
specify the allowed hosts anywhere (as in MySQL)? Maybe the hostname is
reported differently when running from the IIS. Or not at all.
As far as I can tell, the server, running as LocalSystem, has read/
write access to the the database directory.
Can you turn on error logging for the ODBC so you can see whats going on?
Tried that... I never managed to generate a log file. I may have
simply misplaced it, but I thought I set the paths correctly.
What does ANGOSS docs say about this specific error?
The docs I have are kinda thin on the errors - especially ODBC-
related ones.
Good luck,
Richard
Thanks for the wishes and the questions.

-Joe

Jul 6 '07 #9
On Jul 5, 7:18 pm, Charles Polisher <cpol...@nonesuch.comwrote:
should the SQL read "SELECT * FROM $dbname.$tablename"
I'll give it a whirl, but the query, given the tablename, returned
results in a console session.

-Joe

Jul 6 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Boba | last post by:
Hi, I'm programming a WinForm application. I would like to enter commands that will send output that will help me to locate bugs in the future. I know that there is a way to send output by...
3
by: Liren Zhao | last post by:
I use some "Console.WriteLine(some strings here)" to display some debug information in my winform program. How can I get the information in my programe or same them in a text file ?
4
by: John Bowman | last post by:
Hi, How can I disable the right click capability of the Web Browser control that's on a form? I only want it to display the HTML, w/ no popup menu. TIA, -- John C. Bowman
2
by: Steve | last post by:
I have created a console app that simply prints out a message a couple times, then exits, here is the code: <code> for(int i = 0; i < 10; i++) { System.Threading.Thread.Sleep(500);...
4
by: garyusenet | last post by:
Hi. I am trying to learn about array lists, and found an example on MSDN. I tried to compile it but it's not producing any output. I can't see why. Any ideas? Here is what I did. 1....
3
by: TC | last post by:
I'm trying to debug a console application, but I can't see the console output. I've seen many references which say that console output is supposed to appear on the Output window when the...
11
by: gnewsgroup | last post by:
In my web application, I would like to dynamically display the progress of a process, something like: Collecting user input ... Saving user profile ... Generating report in PDF ... Dispatching...
2
by: gnewsgroup | last post by:
Well, I initiated this discussion a few days ago at: ...
6
by: =?Utf-8?B?R3JlZw==?= | last post by:
I am using the following command to output my results to the Output window (for testing things out). Console.WriteLine ("Output") I'd like to clear the Output window of any previous output. I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.