473,549 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

connect to db2 database using dbi?

I am trying to execute a query on a db2 database using the dbi module. I'm wondering if someone can take a look at my code and tell me what I'm doing wrong. I'm assuming it's a problem with my query, but my query works fine in access, so I don't know. I guess I don't really understand how queries work differently in db2. I typically connect to a sql database.

Here is the error I'm getting:
Couldn't execute query: [IBM][CLI Driver][DB2] SQL0204N "(my userid here).ADXSPIT_S PI_MASTER" is an undefined name. SQLSTATE=42704
(SQL-S0002)(DBD: st_execute/SQLExecute err=-1)

My database name is DDXSPI1D, residing on server DB239. ADXSPIT.ADXSPIT _SPI_MASTER is the table name.

Here is my code:

#!/usr/bin/perl

# Include necessary modules
use CGI;
use CGI::Carp ("fatalsToBrows er");
use IO::File;
use DBI;

# create our CGI
$query = new CGI;

print "Content-Type: text/html\n\n";
print $query->start_html(-title=>"SLA DB2 TEST",);

#Include config and database info
require("../config/slaconfig.txt") ;

# Get SLA that is passed into this page
$ProjectNum=$qu ery->param('Project Num');

# If the ProjectNum is undefined, just print out
# the form to search for a ProjectNum
if ($ProjectNum == undef)
{

print<<EOM;
<body>
<center>
<h1>SLA DB2 Project Test</h1>
<form name="GetProj" method="post" action="../../cgi-bin/lrrform_DB2.pl" >
Please enter a Project Number: <input type="text" size="10" name="ProjectNu m">
<p><input type="submit" value="Submit"> &nbsp;<input type="reset" value="Clear Form">
</p>

</form>
</center>
</body>
</html>
EOM
}
else
{
# Connect to the database
$dbh = DBI->connect("dbi:O DBC:DB239", $PROJUSER, $PROJPassword)
or die "Couldn't connect to database: $DBI::errstr\n" ;

$DB2Query="SELE CT ADXSPIT.PROJECT _NUM, ADXSPIT.PROJECT _NAME, ADXSPIT.PROJECT _DESC FROM ADXSPIT.ADXSPIT _SPI_MASTER where
ADXSPIT.PROJECT _NUM=$ProjectNu m;";

#query database
$dbquery=$dbh->prepare($DB2Qu ery) ||
die "Prepare failed: $DBI::errstr\n" ;

$dbquery->execute() ||
die "Couldn't execute query: $DBI::errstr\n" ;

$ProjInfo=$dbqu ery->fetchrow_array ;

$dbquery->finish();

#print results
print <<EOM;
<body>
<center>
<h1>SLA DB2 Project Test RESULTS</h1>
This is cool!
</p>

</form>
</center>
</body>
</html>
EOM
print $ProjInfo;
}

Jul 19 '05 #1
0 4622

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

Similar topics

20
4785
by: Mr Dygi | last post by:
Hi, PHP 4.3.4 installed manually from package *.zip and Apache 2. I have a problem with this simple code: <?php $link = mysql_connect("127.0.0.1","","") or die("Could not connect: " . mysql_error()); echo "Connected successfully"; mysql_close($link);
1
4766
by: DAVID | last post by:
Hello, With regards to the Connect dialog on Oracle forms 6i via which we can connect to Oracle database, should we use the same functionality on forms run time again? I mean, I want to make a window with three screen items for username, password and service name. And on run time after connecting to the database I use this window to...
6
4126
by: Jeff Sandler | last post by:
I have a database I created in mySQL. I've been entering data every day into the database using a Java application that I wrote. The database and the Java program are on the same Win 98 SE machine. I've been working on another program (an applet) to send and receive data over the internet. I got the applet to connect with the database and...
3
6053
by: Lee | last post by:
Hi, I'm developing a socket program to connect to Informix database through the ODBC. In here i called my socket program as "tap" . My tap will listen for data from unix through port 1070. After checking of the data, tap will then insert the data to the informix database. I know we can point the tap to one specified port in Informix database...
4
6448
by: banz | last post by:
Hello I have a problem to resolve: I wrote a Perlscript which caches data from a server (local on my machine) I would like to have a other connection to a remote server but I don't know how to define the servername / hostname in my Perl Progrem.. Here is the code:
5
6619
by: rAinDeEr | last post by:
Hi, Y'day one of my friend showed me how to connect to a Oracle database as SYSDBA, DBA etc I have DB2 UDB installed in Linux machine.Right now, I have a user WADI which has got some previliges on the tables. But I dont know how to connect as SYSDBA etc
1
2036
by: GNoter | last post by:
Scenario: I've a WebFarm with 2 web servers which are NLBs (network load balanced). Web1 and Web2; they are not part of a domain. I have a third server, Server3, which is part of a domain and on the same physical network, and it has an MSAccess database which is used on the external webfarm as well as on the internal intranet. I can connect...
2
9773
by: jeffhan | last post by:
we have os/400 db2 database at the backend. i installed db2 v9 connect server on one windows server which is locating the same network with database server. now how to i configure the connect server and client, so client could access the database through the connect server? like that: db2client <--db2 connect server <--db2 mainframe...
6
4586
by: Al G | last post by:
Can someone tell me what I need to get connected to our AS400? I am trying to write an app in VS2005(Data source, Gridview) that requires data from files on our AS400. I've downloaded DB2, and installed it, but apparently I need an additional product, "DB Connect" to actually make a connection. "DB connect" says that it will only display...
0
7520
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
7450
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
7720
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
7957
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
7470
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
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
5088
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...
1
1059
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.