473,566 Members | 3,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select From Db2 W/php Error

SimonJ621
12 New Member
I am trying to select from a DB2 database with PHP. To my knowledge, the connection is being made, but the select statement won't run. The following is the error I receive:

Warning: odbc_exec() [function.odbc-exec]: SQL error: [IBM][CLI Driver][DB2/AIX64] SQL0644N Invalid value specified for keyword "CONCURRENC Y" in statement "<ATTRIBUTE-STRING>". SQLSTATE=42615 , SQL state 42615 in SQLExecDirect in C:\wamp\www\db. php on line 24
I can't find much help online, which is why I am posting here. Any help would be much appreciated as I have never attempted to use DB2. Following is my PHP code:

[PHP]<?php

function dbconnect($verb ose) {
$dbname = "**";
$username = "**";
$password = "**";

$dbconn = odbc_pconnect($ dbname, $username, $password);

if (($verbose == TRUE) && ($dbconn == 0 )) {
echo("connectio n to database failed.");
$sqlerror = odbc_errormsg($ dbconn);
echo "<br /><br />".$sqlerror."< br /><br />";
}

return($dbconn) ;
}


function display($dbconn ) {
$select_stmt = "SELECT * FROM blabla";

if ($dbconn != 0) {
$result = odbc_exec($dbco nn, $select_stmt);
if ($result == 0) {
echo "SELECT statement failed.<br />";
$sqlerror = odbc_errormsg($ dbconn);
}
else {
odbc_result_all ($result);
}
}
}

$verbose = TRUE;
$dbconn = dbconnect($verb ose);

display($dbconn );


?>[/PHP]


Thank you for all the help,

Jason
--------------------------
http://www.elefoo.com/
http://www.blackspyral dancer.com/
Aug 15 '07 #1
3 2395
Purple
404 Recognized Expert Contributor
Hi Jason,

What platform is the webserver running on ?

Does the odbc datasource test ok ?

Regards Purple
Aug 15 '07 #2
SimonJ621
12 New Member
The datasource tests ok. I have the DB2 client on my Windows machine but the server itself runs on a UNIX box.
Aug 16 '07 #3
SimonJ621
12 New Member
I used db2_connect instead of the odbc functions and it worked find. The following code worked:

[PHP]$conn = db2_connect($db name, $username, $password);

if ($conn) {
$sql = "SELECT * FROM Table1";
$stmt = db2_prepare($co n, $sql);
db2_execute($st mt);

$rows = array();
$i = 0;

while (db2_fetch_row( $stmt)) {
$rows[$i] = db2_result($stm t, 0);
echo $rows[$i]."<br />";
$i++;
}
}
else {
echo "Connection failed. <br />";
echo db2_conn_errorm sg();
}[/PHP]

Thanks again.

Jason
------------------------------
http://www.elefoo.com/
http://www.blackspyral dancer.com/
Aug 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
9889
by: Greg Bryant | last post by:
Hi folks. I'm porting a cf site to php, everything's going very well, I like php much better (this, of course, being the correct forum to make that statement :). One problem I have is with validating a form that has a couple multi- select list boxes. The idea is that when the user submits the form, it goes to it's process script. The...
9
3620
by: Kevin | last post by:
Hi, I am getting a syntax error Microsoft VBScript compilation error '800a03ea' Syntax error On the code below. The error references the "End Select" line Can anyone help me with what I am doing wrong? Thanks
0
10179
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the database table, using dynamic sql. Executing 'EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;' the error code -2149 is returned That means...
3
6436
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I COULD be wrong... :) I've tried the access group...twice...and all I get is "Access doesn't like ".", which I know, or that my query names are too...
19
8353
by: Steve | last post by:
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without FOR UPDATE, it is fine and no error. I also tried Set objRs = objConn.Execute("SELECT * FROM EMP UPDATE OF EMPNO"), but it still couldn't help. ...
16
2733
by: Richard Maher | last post by:
Hi, I have this Applet-hosted Socket connection to my server and in an ONevent/function I am retrieving all these lovely rows from the server and inserting them into the Select-List. (The on screen appearance of the Select List grows for the first 5 rows then the scroll bar appears if there's more). So far so good. . . The problem is...
3
6419
by: iitt2007 | last post by:
In my SP, I am using SELECT @error_message= 'string' . My collegue asked me to use SET@error_message= 'string' , I would like to know the differences for using SELECT vs SET. Here's the snippet of SP : set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE .
2
3399
by: kxyz | last post by:
Hello everyone, I need help with a stored procedure or two. My stored procedures are supposed to check if a certain record exists. If it does exist, then I select everything from that row, as well as a value for the exit status of the SP. If the record doesn't exist, it selects an error message as the exit status. I've recreated the SP...
2
1721
by: FlashCreations | last post by:
Hello, I am trying to use javascript to validate a form that has three select inputs. Here is the form: <form name="select" action="main.php" method="post" onsubmit="return ValidateSelect(this)"> <select name="one"> <option value="0" selected="selected">-Select An Option-</option> </select> <select name="two"> <option...
2
1926
by: msridhar87 | last post by:
hi, am doing a multi server chat program using select()..in the client side i need to multiplex thei/p from server and stdin. #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include<fcntl.h> #include<string.h> #include<errno.h>
0
7673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7893
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.