Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

using VB6 to load a DB2 table.

Is it possible to use VB6 to load a DB2 table from a flat file via a db2
utility?
Any code samples would be appreciated.
My environment is Windows NT, DB2 7.1, VB6.
Thanks in advance for any help.
James
[242 byte] By [James] at [2007-11-9 18:51:31]
# 1 Re: using VB6 to load a DB2 table.
James, Why must it be from a db2 utility?

"James" <tbt102@hotmail.com> wrote:
>
>Is it possible to use VB6 to load a DB2 table from a flat file via a db2
>utility?
>
>Any code samples would be appreciated.
>
>My environment is Windows NT, DB2 7.1, VB6.
>
>Thanks in advance for any help.
>
>James
>
Mark at 2007-11-12 0:02:30 >
# 2 Re: using VB6 to load a DB2 table.
Mark,

My VB program has to load 1000s of records to 2 DB2 tables before it
can begin processing. Inserting these records via the program is kind
of slow. I'm guessing that a utility is going to be more efficient.

Thanks in advance for any help.

James

"Mark" <mknuttall@nospam.com> wrote:
>
>James, Why must it be from a db2 utility?
>
>"James" <tbt102@hotmail.com> wrote:
>>
>>Is it possible to use VB6 to load a DB2 table from a flat file via a db2
>>utility?
>>
>>Any code samples would be appreciated.
>>
>>My environment is Windows NT, DB2 7.1, VB6.
>>
>>Thanks in advance for any help.
>>
>>James
>>
>
James at 2007-11-12 0:03:30 >
# 3 Re: using VB6 to load a DB2 table.
Hi,

It shouldn't take very long to insert 1000 records; it depends a bit how many
1000's, how often you have to do the load / insert, what methods you're using
to insert the data -- appending to an updateable recordset? using a generated
insert? prepared insert within a single routine so the "prepare" (hidden) can
be cached and reused?
ADO? DAO?
There could be some more efficient ways of doing inserts... care to post some
sample code and the table structures?

In terms of calling an import utility from VB, you could
- call them as shell commands, in which the challenges are more about running
other programs and displaying/handling the results rather than anything
DB2-specific
- write / find wrappers for DB2's API, which would involve more research.

--Greg

James wrote:

> Mark,
>
> My VB program has to load 1000s of records to 2 DB2 tables before it
> can begin processing. Inserting these records via the program is kind
> of slow. I'm guessing that a utility is going to be more efficient.
>
> Thanks in advance for any help.
>
> James
>
> "Mark" <mknuttall@nospam.com> wrote:
> >
> >James, Why must it be from a db2 utility?
> >
> >"James" <tbt102@hotmail.com> wrote:
> >>
> >>Is it possible to use VB6 to load a DB2 table from a flat file via a db2
> >>utility?
> >>
> >>Any code samples would be appreciated.
> >>
> >>My environment is Windows NT, DB2 7.1, VB6.
> >>
> >>Thanks in advance for any help.
> >>
> >>James
> >>
> >
Greg Nash at 2007-11-12 0:04:29 >
# 4 Re: using VB6 to load a DB2 table.
James,

One of the techniques we use at work is to pass the records into an array,
overlay the array into a long byte array, and then call a stored proc, passing
the byte stream (array) as a parm.

The parm is parsed by the stored proc, which then loads the table.

Since our environment is 5.0, we're using COBOL stored procs, but the rest
of the work is VB6 and ADO 2.5 across DB2Connect. It works in the flash
of an eye.

Brad Hubbell

"James" <tbt102@hotmail.com> wrote:
>
>Mark,
>
>My VB program has to load 1000s of records to 2 DB2 tables before it
>can begin processing. Inserting these records via the program is kind
>of slow. I'm guessing that a utility is going to be more efficient.
>
>Thanks in advance for any help.
>
>James
>
>
>"Mark" <mknuttall@nospam.com> wrote:
>>
>>James, Why must it be from a db2 utility?
>>
>>"James" <tbt102@hotmail.com> wrote:
>>>
>>>Is it possible to use VB6 to load a DB2 table from a flat file via a db2
>>>utility?
>>>
>>>Any code samples would be appreciated.
>>>
>>>My environment is Windows NT, DB2 7.1, VB6.
>>>
>>>Thanks in advance for any help.
>>>
>>>James
>>>
>>
>
Brad Hubbell at 2007-11-12 0:05:34 >