This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP with Oracle / SQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP with Oracle / SQL" Watch "JSP with Oracle / SQL" New topic

JSP with Oracle / SQL

Siva Sivaraman

Joined: Sep 26, 2002
Posts: 17
Current project : JSP / Oracle database.
New requirement : JSP / SQL server
Problem : Oracle queries not compatible to SQL Server.
Question: What is the best way to solve this in the java bean?
Solution 1 : Maintain two packages 1.Oracle 2.SQL Server
Solution 2 : Maintain single pacakge with if / else statement for Oracle and SQL Server queries.
We need to maitain the code in both Oracle and SQL Server for all later versions of this project.
Any help in deciding the best approach is appreciated.
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
I'd treat this the same as any internationalization/localization issue: Load your SQL from a resource bundle at runtime, depending on which database you are connecting to.
Or alternatively, consider EJB-CMP which should take care of all that stuff for you.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Siva Sivaraman

Joined: Sep 26, 2002
Posts: 17
I was considering this solution but didn't know how to implement this in the javabean.I have implemented Internationalization in the jsp pages using the resource bundles.
If we have 2 set of resource bundle, one for Oracle and other for SQL, how to implement this in the calling java bean?
I agree. Here's the link:
subject: JSP with Oracle / SQL
Similar Threads
Career Opportunities
Convert a project into JSP-Servlet
Does JSP with SQL Server on Windows Make Sense?
Author question: JDBC in Java Code.
What time we will use oracle as a back-end?