java - SQLSyntaxErrorException when i select a sequence from DB (ORACLE 11g) -
i have strange exception when try select sequence number database. if run query: select mysequence.nextval dual
directly in db it's work fine , give me next value. when run same query on java have sqlsyntaxerrorexception
.
statement = connection.preparestatement(my_seq); resultset = statement.executequery(); my_seq= private static final string my_seq="select mysequence.nextval dual";
i try execute query select id anytable
try if goes wrong in configuration run , return result.
any idea of exception?
grant select problem. grant select on db.mysequence my_user;
, have done grant select commit seem's doesn't go ok. , sqlsyntaxerrorexception
because have create synonym
sequence, without synonym have db.mysequence
. order create sequence , use in java is:
- create sequence
- create synonym use sequence
- make grant select sequence user have in jdbc configuration
Comments
Post a Comment