views:

188

answers:

5

We have a system written in C and running under Solaris & Linux that uses the Sybase CT-library to access a Sybase database. We generate the table-definitions, indexes, stored procedures and C-code from an in-house developed DDL to reduce the amount of work and errors.

We would like to achieve database independence, so we can add (as a first start) Oracle support.

We're thinking about ODBC or ESQL/C, but having no experience with them.

What solution would you suggest (preferably a cheap and easy one, of course). Is it possible to have a single source solution?

A: 

ODBC is going to give you far more portability options over ESQL/C.

hometoast
A: 

I've been using iODBC to access SQL Server and mysql and have had pretty good results so far. I think it would work for Oracle as well, but that would depend on the ODBC driver and haven't had to try it so far.

Vinko Vrsalovic
A: 

ODBC will help you write a more portable system, but you will have to be careful to develop your SQL properly if you wish to leverage the underlying database, as the SQL itself may well not be 100% portable across databases, even with the different ODBC drivers.

Will Hartung
A: 

iodbc http://www.firstsql.com/iodbc/

or unix odbc http://www.unixodbc.org/

Are probably among the "most portable" choices.

Regards Friedrich

Friedrich
+1  A: 

I would highly recommend SQLAPI++ (with the downside, perhaps, that it is a C++ library). There is also unixODBC, though I have never used it in code -- only touched upon it while researching for portable database APIs. POCO also provides a uniform, portable API (though, again, in C++) for database operations, but last I checked it, that part of POCO was only in the initial stages of development.

ayaz