Link to home
Start Free TrialLog in
Avatar of Anthony Lucia
Anthony Lucia

asked on

JDBC: SQLCODE 103 and SQLCODE 551

In all examples below, the instance name was replaced with 'xxx'.

From the CLP I can perform the following:

db2 => connect to TEST

   Database Connection Information

 Database server        = DB2/NT64 10.1.0
 SQL authorization ID   = xxx...
 Local database alias   = TEST

db2 =>
db2 => SELECT ACCTNUM FROM xxx.ACCOUNT

ACCTNUM
----------
11111
22222

  2 record(s) selected.

Open in new window


SO I go to the JDBC connection, with the following credentials:

jdbc:db2://localhost:50000/TEST:user=instuid;password=instpw;

Open in new window


and execute the following prepared statement:

SELECT ACCTNUM FROM xxx.ACCOUNT;

Open in new window


... and I get the following error (SQLCODE 104 apparently means that there is a problem with a character acting as a symbol):

DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=;;xxx.ACCOUNT;END
-OF-STATEMENT, DRIVER=3.63.123 (com.ibm.db2.jcc.am.SqlSyntaxErrorException). Mes
sage payload is of type: String

Open in new window


... so, just in case the trailing semi-colon is an illegal symbol, I tried the following (without trailing semi-colon):

SELECT ACCTNUM FROM xxx.ACCOUNT

Open in new window


... but now I get the following error.

DB2 SQL Error: SQLCODE=-551, SQLSTATE=42501, SQLERRMC=INSTUID;SELECT;xxx
.ACCOUNT, DRIVER=3.63.123 (com.ibm.db2.jcc.am.SqlSyntaxErrorException). Message
 payload is of type: String

Open in new window


Note I am using th efollowing jar:    db2jcc.jar

SQLCODE 551 apparently says that I need to grant some sort of privilege so that the comamnd can be processed statically (Prepared statement)

My questions:

1> Can I assume that in the first statement, the semei-colon end of statement was actually causing the problem, and that the SQLCODE of 551 is the real problem

2> How do I grant privileges so the JDBC (using the

Thanks
ASKER CERTIFIED SOLUTION
Avatar of momi_sabag
momi_sabag
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial