Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 11:38 AM
yoyo
Guest
 
Posts: n/a
Default DB2 Program to connect to 2 databases

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
  #2  
Old November 12th, 2005, 11:38 AM
yoyo
Guest
 
Posts: n/a
Default Re: DB2 Program to connect to 2 databases

yoyo wrote:[color=blue]
> 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[/color]


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?
  #3  
Old November 12th, 2005, 11:38 AM
Matt Emmerton
Guest
 
Posts: n/a
Default Re: DB2 Program to connect to 2 databases


"yoyo" <yoyo@ma.com> wrote in message
news:OsOdnRzWIowB0p_eRVn-ig@centurytel.net...[color=blue]
> yoyo wrote:[color=green]
> > 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?[/color][/color]

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


  #4  
Old November 12th, 2005, 11:38 AM
yoyo
Guest
 
Posts: n/a
Default Re: DB2 Program to connect to 2 databases

Matt Emmerton wrote:[color=blue]
> "yoyo" <yoyo@ma.com> wrote in message
> news:OsOdnRzWIowB0p_eRVn-ig@centurytel.net...
>[color=green]
>>yoyo wrote:
>>[color=darkred]
>>>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?[/color][/color]
>
>
> 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
>
>[/color]

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.
  #5  
Old November 12th, 2005, 11:38 AM
Matt Emmerton
Guest
 
Posts: n/a
Default Re: DB2 Program to connect to 2 databases


"yoyo" <yoyo@ma.com> wrote in message
news:Hoqdnf82rrmUDZ_eRVn-ug@centurytel.net...[color=blue]
> Matt Emmerton wrote:[color=green]
> > "yoyo" <yoyo@ma.com> wrote in message
> > news:OsOdnRzWIowB0p_eRVn-ig@centurytel.net...
> >[color=darkred]
> >>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?[/color]
> >
> >
> > Break your code into two sqc files, each with the code to interact with[/color][/color]
one[color=blue][color=green]
> > database (file1 = connect/disconnect/select, file2 =
> > connect/disconnect/insert). Prep each one against the respective[/color][/color]
databases.[color=blue][color=green]
> > Then link them together along with some glue code that calls the[/color][/color]
"select"[color=blue][color=green]
> > 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[/color][/color]
avoids[color=blue][color=green]
> > the problem you are encountering.
> >
> > --
> > Matt Emmerton
> >
> >[/color]
>
> 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.[/color]

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


  #6  
Old November 12th, 2005, 11:39 AM
yoyo
Guest
 
Posts: n/a
Default Re: DB2 Program to connect to 2 databases

Matt Emmerton wrote:[color=blue]
> "yoyo" <yoyo@ma.com> wrote in message
> news:Hoqdnf82rrmUDZ_eRVn-ug@centurytel.net...
>[color=green]
>>Matt Emmerton wrote:
>>[color=darkred]
>>>"yoyo" <yoyo@ma.com> wrote in message
>>>news:OsOdnRzWIowB0p_eRVn-ig@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[/color][/color]
>
> one
>[color=green][color=darkred]
>>>database (file1 = connect/disconnect/select, file2 =
>>>connect/disconnect/insert). Prep each one against the respective[/color][/color]
>
> databases.
>[color=green][color=darkred]
>>>Then link them together along with some glue code that calls the[/color][/color]
>
> "select"
>[color=green][color=darkred]
>>>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[/color][/color]
>
> avoids
>[color=green][color=darkred]
>>>the problem you are encountering.
>>>
>>>--
>>>Matt Emmerton
>>>
>>>[/color]
>>
>>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.[/color]
>
>
> 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
>
>[/color]
A classic case of: RTFM. I'm guilty as charged.
  #7  
Old November 12th, 2005, 11:39 AM
yoyo
Guest
 
Posts: n/a
Default Re: DB2 Program to connect to 2 databases

Matt Emmerton wrote:[color=blue]
> "yoyo" <yoyo@ma.com> wrote in message
> news:Hoqdnf82rrmUDZ_eRVn-ug@centurytel.net...
>[color=green]
>>Matt Emmerton wrote:
>>[color=darkred]
>>>"yoyo" <yoyo@ma.com> wrote in message
>>>news:OsOdnRzWIowB0p_eRVn-ig@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[/color][/color]
>
> one
>[color=green][color=darkred]
>>>database (file1 = connect/disconnect/select, file2 =
>>>connect/disconnect/insert). Prep each one against the respective[/color][/color]
>
> databases.
>[color=green][color=darkred]
>>>Then link them together along with some glue code that calls the[/color][/color]
>
> "select"
>[color=green][color=darkred]
>>>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[/color][/color]
>
> avoids
>[color=green][color=darkred]
>>>the problem you are encountering.
>>>
>>>--
>>>Matt Emmerton
>>>
>>>[/color]
>>
>>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.[/color]
>
>
> 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
>
>[/color]
Thanks for your help!
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.