473,378 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

A database-abstraction package?

Hi,

I need to make my project work with SQLite, MySQL and Postgresql, but I
don't want to create and maintain a set of table-schemas for all of them.
I'd rather specify this information in a common format and then let some
piece of code generate and run the sql-statements to create the tables in
the database. When I insert, update or delete records I also want a common
interface. In my project I use alot of auto-increment primary keys so this
would have to be handled as well.

Does anybody know if there are any such module or package available already?
If not I've got to start working on one and it would be nice to have some
pointers or guidelines if somebody has any ideas or opionions. A system
capable of handling any database would be best, but as a minimum I need to
support SQLite and MySQL, on Linux and Windows.

Thomas
Jul 18 '05 #1
3 1123
Thomas Weholt wrote:
I need to make my project work with SQLite, MySQL and Postgresql, but I
don't want to create and maintain a set of table-schemas for all of them.
I'd rather specify this information in a common format and then let some
piece of code generate and run the sql-statements to create the tables in
the database. When I insert, update or delete records I also want a common
interface. In my project I use alot of auto-increment primary keys so this
would have to be handled as well.


That common format that you are looking for is called SQL. Make sure that
what you are trying to do is part of the SQL standard and that it is
supported in your engine. Usually you only need to worry about fancy
constructs such as nested selects or constraint checks.

It is not that hard to make a portable schema that can be loaded in all three,
but with MySQL in the picture the least common denominator is a very
simplistic one. Here are some hints:

http://home.fnal.gov/~dbox/SQL_API_Portability.html

There is a DB abstraction library called ADOdb:

http://php.weblogs.com/adodb_python

But I think your biggest worry should be that trying to support three
databases, you have no way of leveraging the strengths of the
more simplistic engines (MySQL and SQLlite), yet you have to account
for all of their weaknesses. This will lead to a hodge-podge,
high-maintenance yet low performing data model that will be the weakest link.

i.

Jul 18 '05 #2
Thomas Weholt wrote:
Hi,

I need to make my project work with SQLite, MySQL and Postgresql, but I
don't want to create and maintain a set of table-schemas for all of them.
I'd rather specify this information in a common format and then let some
piece of code generate and run the sql-statements to create the tables in
the database. When I insert, update or delete records I also want a common
interface. In my project I use alot of auto-increment primary keys so this
would have to be handled as well.

You might consider sqlobject

http://sqlobject.org/

I think it will handle what you want, I have used it with some success.

Brian

Jul 18 '05 #3
On Sun, 29 Feb 2004 21:30:34 +0100,
Thomas Weholt <20**@weholt.org> wrote:
I need to make my project work with SQLite, MySQL and Postgresql, but I
don't want to create and maintain a set of table-schemas for all of them.


Those are precisely the systems that SQLobject (www.sqlobject.org) supports.

--amk
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I...
0
by: Cherrish Vaidiyan | last post by:
sir, The following are the steps that i followed in setting up standby database on Red hat Linux 9. i am using Oracle 9i. i have followed the steps in this site : ...
8
by: Kamlesh | last post by:
Hi, How do I know the physical database path of a database. When I goto the DB2INSTANCE users's directory (/home/db2inst1), I see following folders: /db2inst1/NODE0000/SQL00001...
1
by: pintur | last post by:
The message is: SQL1036C Errore di I/O durante l' accesso al database. SQLSTATE=58030 what is the proble? what for restore tables? thanks
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
8
by: morleyc | last post by:
Hi, until recently i was quite happy to add data sources from mssql database in visual studio and drag the datasets directly onto the form this creating a directly editable form which worked well....
0
by: Jack | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location worldwide. Courseware licensing also available....
0
by: Winder | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location worldwide. Courseware licensing also available....
0
by: Laurynn | last post by:
# (ebook - pdf) - programming - mysql - php database applicati # (Ebook - Pdf)Learnkey How To Design A Database - Sql And Crystal Report # (ebook-pdf) E F Codd - Extending the Database Relational...
9
by: Peter Duniho | last post by:
Is there a straightfoward API in .NET that allows for inspection of a database? That is, to look at the structure of the database, without knowing anything in advance about it? For example,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.