2

I am getting the above mentioned exception while executing the SQL query in Java.

statement2.executeUpdate("INSERT INTO visit_header" 
    + "VALUES('"+visitnumber+"','"+date+"','"+cookie+"','"+ip+"')");

I want to know where it is going wrong.

2 Answers 2

5

As per initial look, you have a problem in your sql query:

statement2.executeUpdate("INSERT INTO visit_header" + "VALUES 

Should be

statement2.executeUpdate("INSERT INTO visit_header " + "VALUES  //Note space after header

There was no space between visit_header and VALUES, so your query was like this:

INSERT INTO visit_headerVALUES 

Which is wrong.

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

3 Comments

Thank you. It is working now, but now i am getting the exception below java.sql.SQLException: ORA-01950: no privileges on tablespace 'EXAMPLE'
@user2314206, can you login to example table using sql-plus? does user really have privileges to access that tablespace?
Ok. I have given the privileges. I got it. Thank you.
5

You forgot to put space between visit_header and values:

statement2.executeUpdate("INSERT INTO visit_header" + " VALUES ('"+visitnumber+"','"+date+"','"+cookie+"','"+ip+"')");

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.