473,507 Members | 2,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP - DB2 weird error while refreshing page

Hello.

I have developed a medical application with php 4 linked to IBM DB2
database.

The database connection is right and i can access data with no
problem...but sometimes when i reload the page which has been already
loaded (by pressing CTRL-R) i receive an SQL STATE Error:

"(...) SQL State: X (..)"

it looks like the error i receive when i was having my first trouble
with ibm db2 as i did not exported the DB2 istance.

but i can not understand while sometimes it works and sometimes no...
anyone can help me?

regards
crunix.
Nov 12 '05 #1
5 1905

"crunix" <cr******@spymac.com> wrote in message
news:4u********************************@4ax.com...
Hello.

I have developed a medical application with php 4 linked to IBM DB2
database.

The database connection is right and i can access data with no
problem...but sometimes when i reload the page which has been already
loaded (by pressing CTRL-R) i receive an SQL STATE Error:

"(...) SQL State: X (..)"

it looks like the error i receive when i was having my first trouble
with ibm db2 as i did not exported the DB2 istance.

but i can not understand while sometimes it works and sometimes no...
anyone can help me?

Which particular SQLState are you getting in the error message? The precise
value will enable people to have some idea of what might be wrong. It will
also enable you to look this up for yourself in the DB2 manuals.

Also, the SQLCode is often more useful than the SQLState since the messages
for the SQLCode are more detailed. If you can determine the SQLCode, that
would be very helpful.

Rhino
Nov 12 '05 #2
Sometimes SQLSTATE is unreadeble other times it is just like this one:
SQLState: X

On Thu, 19 Aug 2004 15:10:13 -0400, "Rhino"
<rh****@NOSPAM.sympatico.ca> wrote:

"crunix" <cr******@spymac.com> wrote in message
news:4u********************************@4ax.com.. .
Hello.

I have developed a medical application with php 4 linked to IBM DB2
database.

The database connection is right and i can access data with no
problem...but sometimes when i reload the page which has been already
loaded (by pressing CTRL-R) i receive an SQL STATE Error:

"(...) SQL State: X (..)"

it looks like the error i receive when i was having my first trouble
with ibm db2 as i did not exported the DB2 istance.

but i can not understand while sometimes it works and sometimes no...
anyone can help me?

Which particular SQLState are you getting in the error message? The precise
value will enable people to have some idea of what might be wrong. It will
also enable you to look this up for yourself in the DB2 manuals.

Also, the SQLCode is often more useful than the SQLState since the messages
for the SQLCode are more detailed. If you can determine the SQLCode, that
would be very helpful.

Rhino


Nov 12 '05 #3
I think you'll need to improve the error handling in your php program. I
don't know the php language myself but every other language I know offers
ways to display the values of SQLState, SQLCode, and often the SQLMessage.
All you have to do is display those values if your program hits an
unexpected condition.

I don't know if php and Perl are related - they certainly *look* similar -
but this fragment from the Application Development Guide shows how to store
the values of the SQLState and the SQLCode in Perl. Perhaps the technique
for php is the same?

----------------------------------------------------------------------------
----------------------------------
To return the SQLSTATE associated with a Perl DBI database handle or
statement handle, call the state method. For example, to return the SQLSTATE
associated with the database handle $dbhandle, include the following Perl
statement in your application:

my $sqlstate = $dbhandle->state;
To return the SQLCODE associated with a Perl DBI database handle or
statement handle, call the err method. To return the message for an SQLCODE
associated with a Perl DBI database handle or statement handle, call the
errstr method. For example, to return the SQLCODE associated with the
database handle $dbhandle, include the following Perl statement in your
application:

my $sqlcode = $dbhandle->err;
----------------------------------------------------------------------------
----------------------------------

When you know the SQLState and SQLCode, it will be MUCH easier to determine
what your problem is.

Rhino

"crunix" <cr******@spymac.com> wrote in message
news:f9********************************@4ax.com...
Sometimes SQLSTATE is unreadeble other times it is just like this one:
SQLState: X

On Thu, 19 Aug 2004 15:10:13 -0400, "Rhino"
<rh****@NOSPAM.sympatico.ca> wrote:

"crunix" <cr******@spymac.com> wrote in message
news:4u********************************@4ax.com.. .
Hello.

I have developed a medical application with php 4 linked to IBM DB2
database.

The database connection is right and i can access data with no
problem...but sometimes when i reload the page which has been already
loaded (by pressing CTRL-R) i receive an SQL STATE Error:

"(...) SQL State: X (..)"

it looks like the error i receive when i was having my first trouble
with ibm db2 as i did not exported the DB2 istance.

but i can not understand while sometimes it works and sometimes no...
anyone can help me?

Which particular SQLState are you getting in the error message? The precisevalue will enable people to have some idea of what might be wrong. It willalso enable you to look this up for yourself in the DB2 manuals.

Also, the SQLCode is often more useful than the SQLState since the messagesfor the SQLCode are more detailed. If you can determine the SQLCode, that
would be very helpful.

Rhino

Nov 12 '05 #4
To display SQLSTATE and SQLCODE values in a PHP program using the
Unified ODBC driver, you can create a function like the following:

function display_error($connection) {
// odbc_errormsg returns last SQLCODE and error text
$message = odbc_errormsg($connection);

// odbc_error returns last SQLSTATE
$sqlstate = odbc_error($connection);

print("<p>Error message = $message</p>");
print("<p>SQLSTATE = $sqlstate</p>");
}

Then you can call the function when you detect an error condition:

$rc = odbc_exec($connection, $sql_statement);
if ($rc == FALSE) {
display_error($connection);
}

Hopefully this helps you retrieve some more useful information for
debugging the problem.

Dan

P.S. Sorry for the late reply, my usual newsgroup server appears to be
rather intermittent.

Rhino wrote:
I think you'll need to improve the error handling in your php program. I
don't know the php language myself but every other language I know offers
ways to display the values of SQLState, SQLCode, and often the SQLMessage.
All you have to do is display those values if your program hits an
unexpected condition.

I don't know if php and Perl are related - they certainly *look* similar -
but this fragment from the Application Development Guide shows how to store
the values of the SQLState and the SQLCode in Perl. Perhaps the technique
for php is the same?

----------------------------------------------------------------------------
----------------------------------
To return the SQLSTATE associated with a Perl DBI database handle or
statement handle, call the state method. For example, to return the SQLSTATE
associated with the database handle $dbhandle, include the following Perl
statement in your application:

my $sqlstate = $dbhandle->state;
To return the SQLCODE associated with a Perl DBI database handle or
statement handle, call the err method. To return the message for an SQLCODE
associated with a Perl DBI database handle or statement handle, call the
errstr method. For example, to return the SQLCODE associated with the
database handle $dbhandle, include the following Perl statement in your
application:

my $sqlcode = $dbhandle->err;
----------------------------------------------------------------------------
----------------------------------

When you know the SQLState and SQLCode, it will be MUCH easier to determine
what your problem is.

Rhino

"crunix" <cr******@spymac.com> wrote in message
news:f9********************************@4ax.com...
Sometimes SQLSTATE is unreadeble other times it is just like this one:
SQLState: X

On Thu, 19 Aug 2004 15:10:13 -0400, "Rhino"
<rh****@NOSPAM.sympatico.ca> wrote:

"crunix" <cr******@spymac.com> wrote in message
news:4u********************************@4ax.com ...

Hello.

I have developed a medical application with php 4 linked to IBM DB2
database.

The database connection is right and i can access data with no
problem...but sometimes when i reload the page which has been already
loaded (by pressing CTRL-R) i receive an SQL STATE Error:

"(...) SQL State: X (..)"

it looks like the error i receive when i was having my first trouble
with ibm db2 as i did not exported the DB2 istance.

but i can not understand while sometimes it works and sometimes no...
anyone can help me?
Which particular SQLState are you getting in the error message? The
precise
value will enable people to have some idea of what might be wrong. It
will
also enable you to look this up for yourself in the DB2 manuals.

Also, the SQLCode is often more useful than the SQLState since the
messages
for the SQLCode are more detailed. If you can determine the SQLCode, that
would be very helpful.

Rhino


Nov 12 '05 #5
Thanks a lot for your help, i'm going in newxt days to have some
beta testing time...i will let you know if i solve my problem.
Thanks
crunix83

On Mon, 23 Aug 2004 10:23:13 -0400, Dan Scott <da*******@ca.ibm.com>
wrote:
To display SQLSTATE and SQLCODE values in a PHP program using the
Unified ODBC driver, you can create a function like the following:

function display_error($connection) {
// odbc_errormsg returns last SQLCODE and error text
$message = odbc_errormsg($connection);

// odbc_error returns last SQLSTATE
$sqlstate = odbc_error($connection);

print("<p>Error message = $message</p>");
print("<p>SQLSTATE = $sqlstate</p>");
}

Then you can call the function when you detect an error condition:

$rc = odbc_exec($connection, $sql_statement);
if ($rc == FALSE) {
display_error($connection);
}

Hopefully this helps you retrieve some more useful information for
debugging the problem.

Dan

P.S. Sorry for the late reply, my usual newsgroup server appears to be
rather intermittent.

Rhino wrote:
I think you'll need to improve the error handling in your php program. I
don't know the php language myself but every other language I know offers
ways to display the values of SQLState, SQLCode, and often the SQLMessage.
All you have to do is display those values if your program hits an
unexpected condition.

I don't know if php and Perl are related - they certainly *look* similar -
but this fragment from the Application Development Guide shows how to store
the values of the SQLState and the SQLCode in Perl. Perhaps the technique
for php is the same?

----------------------------------------------------------------------------
----------------------------------
To return the SQLSTATE associated with a Perl DBI database handle or
statement handle, call the state method. For example, to return the SQLSTATE
associated with the database handle $dbhandle, include the following Perl
statement in your application:

my $sqlstate = $dbhandle->state;
To return the SQLCODE associated with a Perl DBI database handle or
statement handle, call the err method. To return the message for an SQLCODE
associated with a Perl DBI database handle or statement handle, call the
errstr method. For example, to return the SQLCODE associated with the
database handle $dbhandle, include the following Perl statement in your
application:

my $sqlcode = $dbhandle->err;
----------------------------------------------------------------------------
----------------------------------

When you know the SQLState and SQLCode, it will be MUCH easier to determine
what your problem is.

Rhino

"crunix" <cr******@spymac.com> wrote in message
news:f9********************************@4ax.com...
Sometimes SQLSTATE is unreadeble other times it is just like this one:
SQLState: X

On Thu, 19 Aug 2004 15:10:13 -0400, "Rhino"
<rh****@NOSPAM.sympatico.ca> wrote:
"crunix" <cr******@spymac.com> wrote in message
news:4u********************************@4ax.co m...

>Hello.
>
>I have developed a medical application with php 4 linked to IBM DB2
>database.
>
>The database connection is right and i can access data with no
>problem...but sometimes when i reload the page which has been already
>loaded (by pressing CTRL-R) i receive an SQL STATE Error:
>
>"(...) SQL State: X (..)"
>
>it looks like the error i receive when i was having my first trouble
>with ibm db2 as i did not exported the DB2 istance.
>
>but i can not understand while sometimes it works and sometimes no...
>anyone can help me?
>

Which particular SQLState are you getting in the error message? The


precise
value will enable people to have some idea of what might be wrong. It


will
also enable you to look this up for yourself in the DB2 manuals.

Also, the SQLCode is often more useful than the SQLState since the


messages
for the SQLCode are more detailed. If you can determine the SQLCode, that
would be very helpful.

Rhino



Nov 12 '05 #6

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

Similar topics

3
2068
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed...
5
14567
by: NanQuan | last post by:
I'm hoping someone can help me solve this error since I am at a total loss here. Usually I don't bother posting on any forums or groups on the internet and prefer to solve stuff myself but this is...
10
1816
by: Don Munroe | last post by:
This one has me stumped. I have three web applications running on two different servers. The first that works fine is hosted by a .Net hosting company. Everyone that uses it has no problems...
6
1543
by: gh0st54 | last post by:
Hi I have a weird javascript error that only happens on my live server when i open the page http://www.imrated.co.uk/reg.aspx i get the error 'Problems with this page ... blablabla Line : 3...
5
3472
by: Jensen Bredal | last post by:
Hello, I need to display self refreshing information on a web page written with asp.net. I would image that the info would be displayed either as part of a user control or a web control. How can...
0
2014
by: Alan Silver | last post by:
Hello, I have two weird problems here. I have a master page file that works absolutely fine. When I load it up in VWD, I get a couple of weird (to me) errors. First, I get the error...
4
5043
by: Dan | last post by:
Hi, i'm not sure to understand the difference between refreshing the pagina by clicking on 'refresh' in the browser and a postback. What i think it is: Suppose a page with a form containing a...
13
7428
by: honey99 | last post by:
Hi! I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window...
4
2599
by: d3vkit | last post by:
I recently had a friend pass along some web work for me; a simple update. I for some reason decided I would do some overhauling of the page (he had been doing straight html and I figured some php...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5042
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.