If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Applications & Tools > database independency

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-17-07, 01:24
shashi_s shashi_s is offline
Registered User
 
Join Date: Apr 2007
Posts: 21
database independency

Hi,
I need to make an application to be as much independent of the DB as possiible, So that less work is required when it has to be deployed elsewhere, (elsewhere = diff database , different schema, diff name.....bla bla bla)

Any suggestions on the approach?
Reply With Quote
  #2 (permalink)  
Old 04-17-07, 03:13
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
either

Stick to ISO/ANSI SQL only in your application

OR

develop the application using subclasses to handle SQL interface

OR

if you dont want to get involved in classes and sub classes then design your application in such a way that you can use a simple if then elseif construct to select which db implementations to use.

option 2 in my books is preferred, option 1 is tricky, option 3 can be made to work but is very very messy and prone to errors unless you are very tightly disciplined in your development process.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 04-17-07, 04:51
shashi_s shashi_s is offline
Registered User
 
Join Date: Apr 2007
Posts: 21
hmm....
guess i'll stick with ODBC, and connect all other DB's with ODBC!!!!!

except, im a bit unsure about calling stored procedures,
currently i use '{Call my_stored_procedure1(?,?)}' as my command text.

Will that change for other db's using odbc??/
or will odbc handle it?
Reply With Quote
  #4 (permalink)  
Old 04-17-07, 05:17
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
thats precisely your issue....
theretically ODBC should provide a transparent mechanism effectively a class that sheilds you form having to get involved with db specific issues

....however not all db support the same functions, not all dbs stick to ANSI SQL (well if truth be told none of 'em are 100% ISO/ANSI SQL compliant)

...a ferinstance until recently MySQL didnt support stroed procedures, not all MySQL db's neccesarily support transactions and RI.

...each and every db manufacturer has legacy issues of ways they used to do things that still exist but are not ANSI compliant. sometimes they support the ISO/ANSI standard as well as their own variant. some of these enhancements are marketing hype (so they can show they do things better), some are just well we thought it better to do it that way, or even we think this is a important feature that we couldnt get adopted at the last standards review)

if you are using ODBC then that should be fine.. it it after all a mechanism to connect you to the data, However if your are trying to develop a db independent application I reckon these days you would be strongly encouraged to go down an object/class route so that when you need to support another db (conceivably an older / newer version of the same db) you create a class that handles the db interaction for that db/version. depending on your design you could inherit the parent classes methods and properties, and merely provide the db specific code in each inherited class.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On