1

I am using JDBC to connect to a db2 database and have the following sql to insert some values into the database.

sql="insert into HC_PROPF.PATIENT (given_name) values ('"+strArray[0]+"');";

However, I get a SQL STATE error as follows:

DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=@;ME) values ('Lorna');END-OF-STATEMENT, DRIVER=3.66.46

Thanks guys.

1
  • In the future, you need to describe to us what the error is; often, this will tell you what the problem is, and where to look to resolve it. In case you don't know that particular one, IBM has a list of all the codes. Also, you should be using prepared statements, as depending on where strArray[0] is coming from, you may be open to SQL Injection (which is often the cause of data breaches); this is especially worrying as you look to be subject to HIPAA regulations... Commented Jun 19, 2013 at 20:52

1 Answer 1

3

try it without the last ; in your query

sql="insert into HC_PROPF.PATIENT (given_name) values ('"+strArray[0]+"')";

According to documentation this is a syntax error

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.