Oct
17

One of the classes that I’m sharing on phpclasses and I never talk about is DBConv or Database Conversion. The idea of the package is to convert SQL from proprietary structure into standard structure which could be used on different database servers.

I use this class specially to convert from Oracle to MySQL, to have a local database that I can work on more easily and keep compatibilities with the original oracle database.

Oracle users generally have this tool called TOAD, I use it to generate a dump of the oracle database. From menu choose Database, then Schema browser. Select tables you want to convert, then right click and choose “Create script” from the menu. The window below will be displayed :

Multi Table script

Choose the options like showed in the previous screenshot, then execute. The database dump will be generated, so you can save it in a text file. Now back to DBConv, The package was nominated for the January 2005 innovation award :

Sometimes it is convenient to write applications that can work with many different SQL based databases.

Some database abstraction packages can help writing applications that can work unchanged with different databases.

However, if you start using SQL code that uses features that are specific of certain databases, it will be harder to make the applications work with other databases later.

This class can help avoiding some SQL portability problems by converting the SQL code that you use into SQL code that does not use certain database specific features known by the class.

Manuel Lemos

Download DBConv from phpclasses. The sample usage is already configured for oracle, so you just have to change the file name you have save the dump in and then run the script.


require_once “DBConv.php”;

// osd_tabs.sql contain SQL dump from oracle database.
$conv = new DBConv(”oracle”,”oracle.sql”);
$newsql = $conv->convert();

echo $newsql;

DBConv support also MySQL, Microsoft SQL Server, SQLite and ODBC.

Tags: No Tags

No Responses

Leave a Response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>