473,394 Members | 1,845 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,394 software developers and data experts.

DB2SetCLPEnv_api not working with DB2 version 9

Hello,
I am trying to port an exising product to support DB v9.
This is a piece of code similar to the one in the product

if(DB2SetCLPEnv_api (GetCurrentProcessId()) == 0)
{
char buff[2048];
FILE *fp = NULL;

runCmd = L"\"C:\\Program Files\\IBM\\SQLLIB\\BIN\\DB2\" connect to MYDB user db2admin using \'db2admin\'";

if ( (fp = _popen(runCmd.c_str(), "rt")) != NULL)
{
while (fgetts(buff, 2048, fp) != NULL )
{
printf(L"%s",buff);
}
}
else
{
printf("Unable to execute command \n");
}
runCmd = L"\"C:\\Program Files\\IBM\\SQLLIB\\BIN\\DB2\" select grantee, granteetype, grantor from syscat.dbauth where bindaddauth = \'Y\'";

if((fp = _wpopen(runCmd.c_str(), L"rt")) != NULL)
{
while (fgetts(buff, 2048, fp) != NULL )
{
printf(L"%s",buff);
}
}
else
{
printf(L"Unable to execute command \n");
}
}
else
{
printf("Unable to set DB2 CLP \n");
}

Basically what i am try to do is to call DB2SetCLPEnv_api and execute two commands using _popen. The _popen function creates a pipe and asynchronously executes a spawned copy of the command processor with the specified string command. The first command connects to MYDB using the username and password provided. The second command executes a select query.

In v8 the connection establised using the command
DB2 connect to MYDB user db2admin using 'db2admin'
seems to persist until a
DB2 connect reset
is called and the select query executes correctly.

in v9 the connection establised using the command
DB2 connect to MYDB user db2admin using 'db2admin'
gets terminated immediately and when i try to execute the second command i get an error that says

SQL1024N A database connection does not exist. SQLSTATE=08003

The above mentioned code is being built on different platforms including most flavours of windows and Linux. A major code change would require significant development and testing effort. Can anyone provide me with a solution to fix this.

Thnaks and Regards
myDB2Queries
Feb 5 '07 #1
0 1015

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

Similar topics

4
by: zalekbloom | last post by:
I noticed on my PC with win98/IE 6.028 applets are not working. Applets are working when I use Netscape 7.1. When I open the DOS win and I check for a Java version I am getting: C:\WINDOWS>java...
4
by: matt | last post by:
I have an image randomizer that was working fine. I added five images to it today, and none of the new five are ever called. Here's the script: <!-- Begin var theImages = new Array() ...
14
by: Mark B | last post by:
Our webhost (www.usbusinessweb.net) had a W2K IIS5 server crash after a scheduled hard-boot occurred during a ms-security patch install overnight. They couldn't get the server working again so they...
8
by: jojobar | last post by:
Okay, I am trying to do is to test the webresource in 2.0 1. I created a new project with assembly name (and default assembly name) "Office". 2. I added the following to the AssemblyInfo.cs...
1
by: harinathch | last post by:
Hi, Iam working with myapplication.exe.config file in my vb.net windows application.Its working fine in my development environment. When i test this application in some other machine using exe and...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
4
by: qbproger | last post by:
I'm developing a plugin for some software. The previous version of the software didn't require a start in directory to be set. This allowed me to leave the working directory to the default in the...
3
by: KidSensation | last post by:
Hello all, I ran into a couple applications written in c#, but we do not have the full version of visual studio.net 2003, so I thought they were most likely written in the beta version. After...
3
by: Russ | last post by:
I have a Web Service that was originally created with .NET VC 2003, and subsequently converted to the 2005 version. It works fine when built as a debug version, and run on the workstation it was...
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
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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...

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.