Hi all,
I'm doing my very first steps with DB2 programming, so please forgive
me my stupid question.
I try a very simple first db-access using embedded sql with plain
C-code (MS-VC++ on windows). I did a simple
EXEC SQL SELECT COUNT (*)
INTO :CNT
FROM TESTTAB;
The prep and bind on db2 has no errors, the C-code compiles and links
errorfree, too.
When running the program, I get a code -1024 (not connected?). What
have I to do to run the code? I tried a db2logon in the command
window first, but this did not help.
Please help me.
Regards,
Gerd 10 16158
PS: I've got a hint, that I have to set some Windows environment
variables first. Is this correct? And if, which variables , which
values?
Gerd schrieb: Hi all,
I'm doing my very first steps with DB2 programming, so please forgive me my stupid question.
I try a very simple first db-access using embedded sql with plain C-code (MS-VC++ on windows). I did a simple
EXEC SQL SELECT COUNT (*) INTO :CNT FROM TESTTAB;
The prep and bind on db2 has no errors, the C-code compiles and links errorfree, too.
When running the program, I get a code -1024 (not connected?). What have I to do to run the code? I tried a db2logon in the command window first, but this did not help.
Please help me.
Regards, Gerd
Do you have DB2 Connect installed? Do you have an alias setup to
connect to the database? Did you use the configuration client to "test"
the connection? Was the test succesful?
Connecting to a DB2 database takes a few pieces of information to
identify it, and a DB2 client to do the connection itself. The
information is input once, and assigned an alias. Then, a connect
statement is used with the alias to connect.
B.
Yes, DB2 is installed. My alias is created as TESTDB. I can connect
successfully via command editor and I can successfully submit select
statements. If I add an explicit connect to my code (EXEC SQL CONNECT
TO TESTDB ... ;) then it works. But if I do not explizitly connect but
try an implizit connect it does not work.
I've got an answer stating that I would have to declare some
environment variables (DB2DBDFT, DB2USER, DB2PASSWORD), but when doing
this I get an other error (see my other thread).
OK, i see, i was just making sure you had the basics covered, and you
seem to have done that pretty well. :)
B.
Gerd wrote: PS: I've got a hint, that I have to set some Windows environment variables first. Is this correct? And if, which variables , which values?
Are you actually connecting to your database in your application?
EXEC SQL CONNECT TO TESTDB USER :U USING :P;
No I'm not explicitly connecting from my application. The dokumentation
says, that declaring the environment variables DB2DBDFT, DB2USER and
DB2PASSWORD results in automatic connect. But when I declare this
variables, I get sqlcode -30082 "Password missing". So now I'm looking
how to specify the password correctly.
In article <11**********************@i39g2000cwa.googlegroups .com>, Ge*****@t-online.de says... No I'm not explicitly connecting from my application. The dokumentation says, that declaring the environment variables DB2DBDFT, DB2USER and DB2PASSWORD results in automatic connect. But when I declare this variables, I get sqlcode -30082 "Password missing". So now I'm looking how to specify the password correctly.
AFAIK DB2PASWORD is not some default variable used by DB2. Could it be
that it's used by the development tool you use when running your program
from the tool to automatically create a connection?
I think not, because I've checked this information, and found it in
some redbooks:
CONNECT TO database: If both the userid and the password are missing in
the
connect statement, they are extracted from the DB2USERID and
DB2PASSWORD
environment variables.
In article <11*********************@u72g2000cwu.googlegroups. com>, Ge*****@t-online.de says... I think not, because I've checked this information, and found it in some redbooks: CONNECT TO database: If both the userid and the password are missing in the connect statement, they are extracted from the DB2USERID and DB2PASSWORD environment variables.
In which redbook did you find that one? When searching the online docs
this environment variable can't be found.
In article <MP************************@news.xs4all.nl>, no****@nl.invalid says... In article <11*********************@u72g2000cwu.googlegroups. com>, Ge*****@t-online.de says... I think not, because I've checked this information, and found it in some redbooks: CONNECT TO database: If both the userid and the password are missing in the connect statement, they are extracted from the DB2USERID and DB2PASSWORD environment variables.
In which redbook did you find that one? When searching the online docs this environment variable can't be found.
I've found one reference to DB2USER and DB2PASSWORD within a VisualAge
redbook which mentions it's usage in implicit connections. I didn't find
any other reference to it in the DB2 docs so I don't think you can use
them automatically using a implicit connect when running your C program. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tborn2b |
last post by:
DB2 V 7, Z/OS:
I receive an SQLCODE -104 for the following trigger :
CREATE TRIGGER TRSERED1
NO CASCADE BEFORE
INSERT
ON SEMINAR
REFERENCING
NEW AS ZUGANG
|
by: Jean-Marc Blaise |
last post by:
Dear all,
Could you explain why some SQL messages do not possess a SQLSTATE ?
Why not transmitting the SQLSTATE of the original <sqlcode>, for example if
you get a -911 on a RUNSTATS ?
...
|
by: JDPope |
last post by:
I have a situation which I cannot get a good lead on how to resolve.
One of the applications I support uses the Hibernate software to
generate SQL. The app is JAVA with JDBC. In testing the users...
|
by: Twan Kennis |
last post by:
Hi,
I have a DB2 database on the IBM iSeries platform, on which I created
several Stored Procedures with the SQLCODE as a return-parameter.
These Stored Procedures are called from a Windows...
|
by: Richard |
last post by:
Our web programmer was looking in his application log an found the
following error:
2006-08-31 16:33:35,129 ERROR org.hibernate.util.JDBCExceptionReporter
- < SQL0723N An error occurred in a...
| |
by: misterutterbag |
last post by:
Stack trace below.
Only happens in WebSphere 6.0.
DB2 v 8.2. FP12.
Only against 1 database. I have other databases in this database
instance, but they don't seem to have this problem.
...
|
by: scoonie999 |
last post by:
I'm having a problem that I can't seem to find any solution for online.
I'm using a cursor in a cobol program to fetch some data. I know for a
fact that the select should return 2 rows. The...
|
by: Sri |
last post by:
All
Recenetly our shop migrated to DB2 V8 from V7. We are in IBM System Level:
z/OS 1.6.1 @ RSU 0702.
Processor : IBM 2064-1C7 (z/900) # 1B89 Mode: 64-bit
One of my application is facing...
|
by: Gregor =?UTF-8?B?S292YcSN?= |
last post by:
Hi!
I was searching through DB2 InfoCenter, but didn't find an answer to my
question:
When I get an SQLCODE from an SQL command (ADMIN_CMD for example) when I
want to know what this code means;...
|
by: lenygold via DBMonster.com |
last post by:
Thank you very much SERGE for your help.
I found example in Graeme Birchall COOKBOOK wich i think exactly what i need
for SQL
check in triggers:
• User query joins to table function - sends...
|
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,...
| |
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,...
|
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,...
|
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...
|
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...
|
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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |