?
Solved

JDBC question

Posted on 2014-07-11
3
Medium Priority
?
225 Views
Last Modified: 2014-07-13
I have connected properly to my database with the following JDBC connection

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

Open in new window


So I am trying a JDBC SELECT statement as follows:

SELECT ACCTNUM FROM ACCOUNT WHERE ACCTNUM = '11111'

Open in new window


... and I get the following error:

C:\curl>curl http://localhost:8081
DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=INSTUID.ACCOUNT, DRIVER=3.
63.123 (com.ibm.db2.jcc.am.SqlSyntaxErrorException). Message payload is of type:
 String

Open in new window


How can I fix this

Thanks
0
Comment
Question by:Anthony Lucia
3 Comments
 
LVL 18

Expert Comment

by:Dave Ford
ID: 40191564
Test the "simple case" first.

SELECT ACCTNUM FROM ACCOUNT

What happens with that?
0
 
LVL 37

Assisted Solution

by:momi_sabag
momi_sabag earned 1000 total points
ID: 40191580
-204 means the table does not exists or you don't have permissions to read it
Are you sure its in the inst schema?
0
 
LVL 26

Accepted Solution

by:
Tomas Helgi Johannsson earned 1000 total points
ID: 40193031
Hi!

When you connect to a database as a particular user the default schema is the users schema.
So if the table is in the  users schema then you can issue sql query like this

SELECT ACCTNUM FROM ACCOUNT WHERE ACCTNUM = '11111'

Open in new window


otherwise you will need to query it like this

SELECT ACCTNUM FROM THESCHEMA.ACCOUNT WHERE ACCTNUM = '11111'

Open in new window


where THESCHEMA is the schema where the table/view ACCOUNT or it's alias.

Regards,
     Tomas Helgi
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month17 days, 5 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question