Meaningless Drivel is fun!
The moose likes JDBC and Relational Databases and the fly likes to use sequence in JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "to use sequence in JDBC" Watch "to use sequence in JDBC" New topic

to use sequence in JDBC

Megha Singhal
Ranch Hand

Joined: Feb 28, 2012
Posts: 225

i don't have permission to access oracle database so i have to work on predesigned tables, in one of my field i have to auto increament that field and i can't create sequence in oracle database so is there is any way to do that through servlet . i mean using queries.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

This has absolutely nothing to do with servlets, so it's been moved to the JDBC forum with an appropriate change of title.

[Asking smart questions] [About Bear] [Books by Bear]
Srinivasan Duraisamy

Joined: Apr 17, 2012
Posts: 2
I am not sure what kind of access you have with Oracle , So could not give any solution from DB level.

But if your application going to run in only one server then you can use plain text file for your sequence source.

Using synchronized block you can generate sequence from the text file.

For better performance use Cache .

Srinivasan. D
Wendy Gibbons

Joined: Oct 21, 2008
Posts: 1107

I would go an talk to your DBA (or whoever designed the tables) they MUST have created a sequence for this index field, or had a plan how you were going to use it.
If they didn't explain to them why they need to create one for it.

Just because you don't have permissin to do something, doesn't mean you can't get it done.
I agree. Here's the link:
subject: to use sequence in JDBC
jQuery in Action, 3rd edition