[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

java ,oracle database to sql server database

Posted on 2008-06-12
2
Medium Priority
?
178 Views
Last Modified: 2010-03-30
Hello experts,

I used oracle database for my application before and would like to change my database to sql server 2005 database.I used lot of  sequences in oracle( example :create sequence CLIENT_ID_SEQ;) and have statements like below in my JDBC code.

StringBuffer query = new StringBuffer();
query.append("INSERT INTO ");
query.append("CLIENT_DTLS"); // the table to insert.
query.append(" values(");
query.append("CLIENT_ID_SEQ.NEXTVAL,?,?,?,sysdate)");  // the sequence CLIENT_ID_SEQ.NEXTVAL

above query i used it for preparedstatement.

As i came to know sql server doesn't have sequences and has identity for auto increment.How do you suggest me to get around this problem with out disturbing the code(jdbc code) much and have the same thing done in sql server database.Please Help.

Thank you.

0
Comment
Question by:dex11
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 21772490
The best way for portability is to let sequencing occur invisibly if possible
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21989837
:-)
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month20 days, 6 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question