By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,924 Members | 1,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,924 IT Pros & Developers. It's quick & easy.

DB2 Program to connect to 2 databases

P: n/a
Mabey I'm missing something very basic, but I can't seem to get it to
work. I'm trying to follow along in the sample programs that tells how
to do that, but mine still doesn't work.

In my program I want to do a select from one database, and insert some
stuff into another database. I've got all the connects and disconnects
declared and the pre-compile doesn't complain about any of that, but
when I say bldapp, the precompiler does say that the table name in my
insert statment (the second database) is not found.

How do you get bldapp to bind to 2 databases? It seems I have to say
either one or the other for the bldapp part. Is there another utility?

--------------------------------------------------------------------------------------
$ ./bldapp vpmsync lcar14

Database Connection Information

Database server = DB2/AIX64 8.2.1
SQL authorization ID = VPMSYNC
Local database alias = LCAR14
LINE MESSAGES FOR vpmsync.sqC
------ --------------------------------------------------------------------
SQL0060W The "C++" precompiler is in progress.
161 SQL0204N "LCAENV.PART_LIST" is an undefined name.
SQLSTATE=42704
SQL0091W Precompilation or binding was ended with "0"
errors and "1" warnings.

LINE MESSAGES FOR utilemb.sqC
------ --------------------------------------------------------------------
SQL0060W The "C++" precompiler is in progress.
SQL0091W Precompilation or binding was ended with "0"
errors and "0" warnings.

LINE MESSAGES FOR vpmsync.bnd
------ --------------------------------------------------------------------
SQL0061W The binder is in progress.
161 SQL0204N "LCAENV.PART_LIST" is an undefined name.
SQLSTATE=42704
SQL0082C An error has occurred which has terminated
processing.
SQL0092N No package was created because of previous errors.
SQL0091N Binding was ended with "3" errors and "0" warnings.

--------------------------------------------------------------------------------------

if I say bldapp vpmsync vpm15 (the second datbase) it tells me my select
table reference (the first database) is not found. So how is bldapp
support 2 different databases?

Thanks for any input

Ken
Nov 12 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
yoyo wrote:
Mabey I'm missing something very basic, but I can't seem to get it to
work. I'm trying to follow along in the sample programs that tells how
to do that, but mine still doesn't work.

In my program I want to do a select from one database, and insert some
stuff into another database. I've got all the connects and disconnects
declared and the pre-compile doesn't complain about any of that, but
when I say bldapp, the precompiler does say that the table name in my
insert statment (the second database) is not found.

How do you get bldapp to bind to 2 databases? It seems I have to say
either one or the other for the bldapp part. Is there another utility?

--------------------------------------------------------------------------------------

$ ./bldapp vpmsync lcar14

Database Connection Information

Database server = DB2/AIX64 8.2.1
SQL authorization ID = VPMSYNC
Local database alias = LCAR14
LINE MESSAGES FOR vpmsync.sqC
------
--------------------------------------------------------------------
SQL0060W The "C++" precompiler is in progress.
161 SQL0204N "LCAENV.PART_LIST" is an undefined name.
SQLSTATE=42704
SQL0091W Precompilation or binding was ended with "0"
errors and "1" warnings.

LINE MESSAGES FOR utilemb.sqC
------
--------------------------------------------------------------------
SQL0060W The "C++" precompiler is in progress.
SQL0091W Precompilation or binding was ended with "0"
errors and "0" warnings.

LINE MESSAGES FOR vpmsync.bnd
------
--------------------------------------------------------------------
SQL0061W The binder is in progress.
161 SQL0204N "LCAENV.PART_LIST" is an undefined name.
SQLSTATE=42704
SQL0082C An error has occurred which has terminated
processing.
SQL0092N No package was created because of previous errors.
SQL0091N Binding was ended with "3" errors and "0" warnings.

--------------------------------------------------------------------------------------
if I say bldapp vpmsync vpm15 (the second datbase) it tells me my select
table reference (the first database) is not found. So how is bldapp
support 2 different databases?

Thanks for any input

Ken

Ok, I found bldmc, which is for building applications with multiple
connections, but I can't figure how to use it yet.
It says:

--------------------------------------------------------------------------------------
# SCRIPT: bldmc
# Builds AIX C++ multi-connection applications
# Requires a second database: <alias2>. Suggested name: sample2
# Also requires 3 program source files: <prog_name> and <prog_name1> to be
# bound to the first database; <prog_name2> to be bound to the second
database.

if (($# < 3))
then
echo "Usage: bldmc <prog_name> <alias1> <alias2> [ <uid1> <pwd1>
<uid2> <pwd2> ]"
exit
fi
--------------------------------------------------------------------------------------

if just issue bldmc vpmsync lcar14 vpm15 it just runs the precomiler
twice, each time crapping out on references to the "other" databases
tables. What does that needing 3 program files mean? I thought DB2 was
supposed to support multiple connections in one file, do I have to break
this thing apart or something and it builds 1 executable in the end?
Nov 12 '05 #2

P: n/a

"yoyo" <yo**@ma.com> wrote in message
news:Os********************@centurytel.net...
yoyo wrote:
Mabey I'm missing something very basic, but I can't seem to get it to
work. I'm trying to follow along in the sample programs that tells how
to do that, but mine still doesn't work.

In my program I want to do a select from one database, and insert some
stuff into another database. I've got all the connects and disconnects
declared and the pre-compile doesn't complain about any of that, but
when I say bldapp, the precompiler does say that the table name in my
insert statment (the second database) is not found.

How do you get bldapp to bind to 2 databases? It seems I have to say
either one or the other for the bldapp part. Is there another utility?


Break your code into two sqc files, each with the code to interact with one
database (file1 = connect/disconnect/select, file2 =
connect/disconnect/insert). Prep each one against the respective databases.
Then link them together along with some glue code that calls the "select"
code for database1 and passes the results to the "insert" code for
database2.

Or you could abandon static C and use CLI instead. Since CLI is all
dynamic, there is no explicit prep step at compilation time, which avoids
the problem you are encountering.

--
Matt Emmerton
Nov 12 '05 #3

P: n/a
Matt Emmerton wrote:
"yoyo" <yo**@ma.com> wrote in message
news:Os********************@centurytel.net...
yoyo wrote:
Mabey I'm missing something very basic, but I can't seem to get it to
work. I'm trying to follow along in the sample programs that tells how
to do that, but mine still doesn't work.

In my program I want to do a select from one database, and insert some
stuff into another database. I've got all the connects and disconnects
declared and the pre-compile doesn't complain about any of that, but
when I say bldapp, the precompiler does say that the table name in my
insert statment (the second database) is not found.

How do you get bldapp to bind to 2 databases? It seems I have to say
either one or the other for the bldapp part. Is there another utility?

Break your code into two sqc files, each with the code to interact with one
database (file1 = connect/disconnect/select, file2 =
connect/disconnect/insert). Prep each one against the respective databases.
Then link them together along with some glue code that calls the "select"
code for database1 and passes the results to the "insert" code for
database2.

Or you could abandon static C and use CLI instead. Since CLI is all
dynamic, there is no explicit prep step at compilation time, which avoids
the problem you are encountering.

--
Matt Emmerton


Thanks. Breaking it up works well, a size benefit is it's a little more
organized.
Not really a DB2 programmer, mucking in territory I really shouldn't be
here, but got no choice, customer demands are needing solution. Is CLI
better? I thought I was using CLI, guess not.
Nov 12 '05 #4

P: n/a

"yoyo" <yo**@ma.com> wrote in message
news:Ho********************@centurytel.net...
Matt Emmerton wrote:
"yoyo" <yo**@ma.com> wrote in message
news:Os********************@centurytel.net...
yoyo wrote:

Mabey I'm missing something very basic, but I can't seem to get it to
work. I'm trying to follow along in the sample programs that tells how
to do that, but mine still doesn't work.

In my program I want to do a select from one database, and insert some
stuff into another database. I've got all the connects and disconnects
declared and the pre-compile doesn't complain about any of that, but
when I say bldapp, the precompiler does say that the table name in my
insert statment (the second database) is not found.

How do you get bldapp to bind to 2 databases? It seems I have to say
either one or the other for the bldapp part. Is there another utility?

Break your code into two sqc files, each with the code to interact with one database (file1 = connect/disconnect/select, file2 =
connect/disconnect/insert). Prep each one against the respective databases. Then link them together along with some glue code that calls the "select" code for database1 and passes the results to the "insert" code for
database2.

Or you could abandon static C and use CLI instead. Since CLI is all
dynamic, there is no explicit prep step at compilation time, which avoids the problem you are encountering.

--
Matt Emmerton


Thanks. Breaking it up works well, a size benefit is it's a little more
organized.
Not really a DB2 programmer, mucking in territory I really shouldn't be
here, but got no choice, customer demands are needing solution. Is CLI
better? I thought I was using CLI, guess not.


The choice between static versus CLI depends on a lot of things. A thorough
reading of the Application Developer's guide is in order.

--
Matt Emmerton
Nov 12 '05 #5

P: n/a
Matt Emmerton wrote:
"yoyo" <yo**@ma.com> wrote in message
news:Ho********************@centurytel.net...
Matt Emmerton wrote:
"yoyo" <yo**@ma.com> wrote in message
news:Os********************@centurytel.net...
yoyo wrote:
>Mabey I'm missing something very basic, but I can't seem to get it to
>work. I'm trying to follow along in the sample programs that tells how
>to do that, but mine still doesn't work.
>
>In my program I want to do a select from one database, and insert some
>stuff into another database. I've got all the connects and disconnects
>declared and the pre-compile doesn't complain about any of that, but
>when I say bldapp, the precompiler does say that the table name in my
>insert statment (the second database) is not found.
>
>How do you get bldapp to bind to 2 databases? It seems I have to say
>either one or the other for the bldapp part. Is there another utility?
Break your code into two sqc files, each with the code to interact with
one
database (file1 = connect/disconnect/select, file2 =
connect/disconnect/insert). Prep each one against the respective
databases.
Then link them together along with some glue code that calls the
"select"
code for database1 and passes the results to the "insert" code for
database2.

Or you could abandon static C and use CLI instead. Since CLI is all
dynamic, there is no explicit prep step at compilation time, which
avoids
the problem you are encountering.

--
Matt Emmerton


Thanks. Breaking it up works well, a size benefit is it's a little more
organized.
Not really a DB2 programmer, mucking in territory I really shouldn't be
here, but got no choice, customer demands are needing solution. Is CLI
better? I thought I was using CLI, guess not.

The choice between static versus CLI depends on a lot of things. A thorough
reading of the Application Developer's guide is in order.

--
Matt Emmerton

A classic case of: RTFM. I'm guilty as charged.
Nov 12 '05 #6

P: n/a
Matt Emmerton wrote:
"yoyo" <yo**@ma.com> wrote in message
news:Ho********************@centurytel.net...
Matt Emmerton wrote:
"yoyo" <yo**@ma.com> wrote in message
news:Os********************@centurytel.net...
yoyo wrote:
>Mabey I'm missing something very basic, but I can't seem to get it to
>work. I'm trying to follow along in the sample programs that tells how
>to do that, but mine still doesn't work.
>
>In my program I want to do a select from one database, and insert some
>stuff into another database. I've got all the connects and disconnects
>declared and the pre-compile doesn't complain about any of that, but
>when I say bldapp, the precompiler does say that the table name in my
>insert statment (the second database) is not found.
>
>How do you get bldapp to bind to 2 databases? It seems I have to say
>either one or the other for the bldapp part. Is there another utility?
Break your code into two sqc files, each with the code to interact with
one
database (file1 = connect/disconnect/select, file2 =
connect/disconnect/insert). Prep each one against the respective
databases.
Then link them together along with some glue code that calls the
"select"
code for database1 and passes the results to the "insert" code for
database2.

Or you could abandon static C and use CLI instead. Since CLI is all
dynamic, there is no explicit prep step at compilation time, which
avoids
the problem you are encountering.

--
Matt Emmerton


Thanks. Breaking it up works well, a size benefit is it's a little more
organized.
Not really a DB2 programmer, mucking in territory I really shouldn't be
here, but got no choice, customer demands are needing solution. Is CLI
better? I thought I was using CLI, guess not.

The choice between static versus CLI depends on a lot of things. A thorough
reading of the Application Developer's guide is in order.

--
Matt Emmerton

Thanks for your help!
Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.