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

LOAD doesn't seem to work using JDBC

P: n/a
When I execute the following statment using the Command Center it
works:

LOAD CLIENT FROM 'Y:\\TheFixedWidthData.txt' OF ASC METHOD L ( 1 1,2
11,12 17) REPLACE INTO S00.TheTargetTable NONRECOVERABLE WITHOUT
PROMPTING

Yet when I try to execute the same statement in a PreparedStatement it
does not work, but gives me a SQLException:

DB2 SQL error: SQLCODE: -104, SQLSTATE: 42601, SQLERRMC: LOAD CLIENT
FROM 'Y:\\TheFixedWidthData.txt' OF ASC ME;BEGIN-OF-STATEMENT;<values>

My analysis so far:

(1) The Command Center says it uses a JDBC connection. So it must be
possible to do this using a JDBC connection, or more specifically, a
DB2Connection.

I have been using a type 4 connection so far, and over that connection
I executed other statements successfully (some selects with DB2
specific options).

(2) The Command Center understands and executes the Statement. So the
SQLException shown above doesn't make much sense to me, as the manual
says it basically means: "Syntax Error in Statement".

RTFM pointers anyone?

Kind regards

Claus

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


P: n/a
JDBC is all about SQL, LOAD is a db2 utility, not SQL.
That is why.

Nov 12 '05 #2

P: n/a
I see.

Given the output of the command center saying "established JDBC
connection" I was mislead into believing the LOAD statement had been
executed as a DB2 specific statement via the JDBC connection the
command center initially established to the database I connect to. I
guess I am not the only person who ran into this...

So the command center simply filters the commands entered for LOAD
statements. When it finds one it runs "the external DB2 UDB LOAD
utility"?
From the wording "DB2 UDB LOAD utility" I would have expected to find

something like db2load.exe on the client and the server alike. But
there's nothing like that to find there, neither on the client, nor on
the server. Instead, it seems to me like the "DB2 UDB LOAD utility" is
an integral part of db2.exe? [I successfully executed LOAD commands I
put in a file using 'db2.exe -tvf theCmdFile.txt'].

"The DB2 UDB LOAD utility" is described in Chapter 3 of the Data
Movement Utilities Guide And Reference. Starting on p134, the "Command
syntax" for LOAD is described. But I couldn't find any explicit
information there on what the concrete physical representation of "the
DB2 UDB LOAD utility" was, and I would like to know :-)

Kind regards & thank you

Claus

Nov 12 '05 #3

P: n/a
Claus,

'db2' is an interpreter, which can understand different languages:

1) SQL, and
2) DB2 Commands, which often are the easies way to invoke database API.
Changing db parameters has nothing to SQL: you cannot prepare it,
connection to db is not required [sometimes].

If you are new to db2 world browse DB2 Information Center Reference to
discover what is a command and what is SQL.

Fruitfull reading,
A.

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.