I have sucessfully connected to my database through JDBC (no sid or service specified): com.test.sql.url=jdbc:oracle:thin://@111.222.333.444:1521, but when my java program tries to insert a row that uses a sequence I created, I get the error java.sql.SQLSyntaxErrorException: ORA-02289: sequence does not exist. I have verified in SQL developer that my sequences exist for my database user, so I'm thinking it is some kind of permissions issue? I initally created the user with sys as sysdba and then created a script that connected as the new user and created all the necessary tables and sequences. What am I missing here? Thanks.
1 Answer
I figured out the problem. It was actually a problem with my database creation script. I had created the sequence with CREATE SEQUENCE "ticket_seq" START WITH 10; so the double quotes enforced case sensitivity. I now know that Oracle tables/sequences, etc. are default case insensitive so the command select ticket_seq.nextval from dual was interpreted as SELECT TICKET_SEQ.NEXTVAL FROM DUAL and therefore my lowercase sequence could not be found. I removed the double quotes from my script and now I can find the sequence as expected.
myschema.ticket_seq.next_valselect userSchema.ticket_seq.nextval from dualwith sys as sysdba.