Is there any abstraction layer which makes a database look like Oracle? - mysql

We use Oracle in production, but in our company it's difficult to install in development environments.
Is there a way to let Perl (or any other language) send raw SQL statements via the DBI module (or the equivalent module for any other language to send SQL commands to a database) which are translated from Oracle SQL into MySQL or SQLite or something else?
So the application would think it was talking to Oracle but actually be talking to a different, easier to install, open source/free database.

It is impossible. Other database engines can't process Oracle queries. Simplest query in Oracle, for example, if you want to get name of a current user:
select user from dual
This query uses DUAL table, which is not present in any other DBMS. There is also a lot of Oracle-specific constructions (CONNECT BY, MINUS, etc.) which couldn't be processed in other engines.
The best way in your situation would be to create one Oracle installation in a virtual machine, and then copy it's image to another virtual machines for work.

The ANSI SQL is the abstraction layer you are referring to.
Assuming that all the tables exist in the target database and the RDBMS supports ANSI SQL then your query will transport to that other database flawlessly.
If you are looking to use something that is not defined in the standard, then it is unlikely to work correctly.
This is a link to the Oracle 11.2G position on the standard.
While talking about Oracle, their solution to the problem is to offer Oracle Database Gateways.

Related

how shall I define sequences in my project (which uses hibernate) in a way that the project works with both Oracle and Mysql.

We have a java project that uses Hibernate as the OR Mapper. We need the project to work with both Oracle and Mysql. because some customers don't want to install Oracle. we have added #sequenceGenerator annotation on entities to have sequence. but the project can not connect to Mysql DBMS with these annotations. Is there any way that we can have sequences in both mysql and Oracle mode, without any changes?
Most portable way is to use TableGenerator. It is portable because no database provider specific constructs are used. Last generated value is stored to the database table, and value is retrieved and incremented via SQL queries.
Usage is also covered in Hibernate documentation.
in accordance to my knowledge it is not possible because
MySQL support AUTO_INCREMENT and Oracle support SEQUENCE
and there are many other factors to consider like data types and indexes
As Oracle is an ORDBMS where as mysql is DBMS it is lack of many features present in MySQL
SOLUTION
i think we can do this with separate databases for each of them
[ As we have many free tools to convert the data from Oracle to MySQL we can use them. Even some of them are not free but we can covert the structure usnig them link1 link2]
database migration needs a full understanding of the data types,indexes,column and table options,etc of both source and destination databases
or
you can use PostgreSQl which also supports SEQUENCES and it is also a GPL

Conversion from Microsoft SQL Server to MySQL

How do I convert a Microsoft SQL Server database backup file such that to import in MySQL database? Is there any way or free tool available for this?
Not sure about how complex a database you have, but if its just some tables and data, there is a free script here that will automagically convert Microsoft SQL Server tables and data over to MySQL.
If you need something more sophisticated, then MySQL has a migration toolkit which allows you to migrate from Microsoft SQL Server to MySQL. In addition here is a tutorial on how to use it. Note that this has now been discontinued, in favor of MySQL Workbench, which has data migration built in.
In addition, this converter will convert everything except stored procedures from MSSQL to MySQL, for a price of only $50 which isn't bad.
Also you may want to check out this whitepaper from MySql's website on how to plan a migration from SQL Server to MySQL, as well as some resources.
ms2my (Pre-Alpha, free)
http://sourceforge.net/projects/ms2my/
"A tool that helps with MSSQL to MySQL converting/replicating (both csv&dump) under *nix.Possible to use it with crontab for regular data fetching.Keeping mySQL-based data warehouse refreshed could also be one of the possibilities of using this script."
MSSQL to MySQL Converter (free trial download, for purchase $49)
http://www.convert-in.com/mss2sql.htm
I've looked for quite awhile, and if you don't want to try ms2my, the above is about the only other option. And it isn't free.
Best of luck finding a free one, hopefully there is one that is hidden away out there on the internet that I can't find.
If you are using a living MS SQL Server and a living MySQL server, then I think your best AND MORE ACCURACY option is to use an ETL/data transformation tool like Pentaho Data Integration (Kettle).
With Kettle you can visually design (using easy-to-learn data flow steps) almost any data transformation from single/multiple data source(s) to single/multiple data destination(s). One of the features you may be interested is the database/tables migration wizard.
If the community distribution of Kettle is not enough for you, then you can use the Enterprise Edition with more features, support, etc.
Take a look at Omega Sync it supports export import and synchronisation between different DBMS's including Schema and table data.

Can I copy my MySQL database structure to MS Access pre 2007?

I want to create a desktop version of my mysql installation without having to setup a server on my machine.
I want to make use of MS Access' query designer so I can produce complicated queries.
I know I can produce an SQL file but I've no idea how to create an MS Access database from it ?
I'm not going to jump on the "Access sucks" bandwagon, though it can be very frustrating at times.
Worst case, You can start with a blank Access database (mdb file, since you specified pre-2007). Open the query designer & go to SQL view. Paste in one complete SQL statement (CREATE TABLE...), and run it. Fix any incompatibility errors, paste in the next (replacing the first), rinse, repeat. Be sure to do this in such order that any dependency "sources" get created before the dependents.
There may be a batch process available, but I don't know what it is offhand.
Moving from MySQL to something like Access is heading in the wrong direction.
If you need a server-less SQL installation or package as part of your distribution (which is a pretty common requirement these days since admins don't like users to install database servers on their machines), consider SQL Server Compact Edition (CE) or SQL Lite. They're both fully SQL compliant (unlike Access) and will cause you far fewer headaches than Access (which sucks). (Did I mention that Access sucks? Big time?)
SQL CE is a .NET assembly that runs in-process with your app, and is very easy to work with. Also, db objects you create will be upwards-compatibile with the full-blown SQL Server. It also works very, very well with Entity Framework if you're into ORMs.
I've heard praise for SQLite, but haven't worked with it. If you're not on .NET, this should be a good way to go.
Links:
SQL CE
SQLite
I don't know if this is a viable option, but if you can set up a DSN to point to your MySQL server, you can then use FILE | GET EXTERNAL DATA | IMPORT to import your MySQL tables into a blank MDB/ACCDB. It's a one-time operation, but I don't know that there's any other option here. You should get the option to import the table schema only and not schema+data. You may have to tweak data types in the resulting tables, since the MySQL data types won't necessarily map directly to Jet/ACE data types.
Then you can carry the MDB/ACCDB file anywhere you want.

Interacting with a Database from Scheme

i try to learn scheme and as a test project i wanted to create a very simple website with 1-2 database queries (MySQL preferred, but PostgreSQL would be ok, too).
I know it's not really schemes domain but i still want to see how far i can come.
Sadly, it seems i'm already stuck at using a database and googling for "scheme database" or any other combination including this words was (as expected considering the double meaning of scheme in this case) not very helpful.
Can you give me any hints on how to access a database from a scheme program?
I read something about scheme code interfacing a mysql client program to do that but i'd prefer something more direct.
Thanks.
GNU Guile already has a database interface that supports Postgres, MySQL and SQLite. It is
called Guile DBI. Other Scheme implementations you may try are: SISC (Can connect
to any JDBC compliant database, including MySQL) and Spark-Scheme (Can connect to any
ODBC compliant database, including MySQL and comes bundled with SQLite). Also note that most
Scheme implementations has some form of Foreign Function Interface that will help you
to write your own MySQL->Scheme Connector.

Recommendations on a sql comparison (schema & data) tool that supports both Oracle and SQL Server?

I'm trying to find a good tool (open source or commercial) for doing comparisons of database instances, for example:
Compare 2 database schemas; generate platform specific change script (either direction) to bring one into synch with the other
Compare data (table contents), generate platform specific change script (either direction) to bring one into synch with the other
Migrate an entire database schema + data from one platform to another, ie: port an Oracle database to SQL Server (hopefully including support for sequences and identity columns)
For 1 & 2 above, by platform specific I mean the script native to the specific database platform, not, for example, an ODBC equivalent script.
Personally, I am mainly concerned with SQL Server and Oracle support, but MySQL support would be very nice to have as well.
Quest Toad or Red Gate SQL Compare would be the most likely options.
I'd give a try to "SQL Server Migration Assistant for Oracle (SSMA for Oracle)"
http://www.microsoft.com/sqlserver/2005/en/us/Migration-oracle.aspx
It will be really useful to you for points 1 and 3.
I used it with some data migration work, and although it didn't solved everything by itself, it really saved me a lot of time.
I'd like to clarify Red Gate's position. Schema Compare for Oracle is now available. For those who have used SQL Compare (for SQL Server), this tool will be very familiar. MySQL Compare also exists.
http://www.red-gate.com/Products/schema_compare_for_oracle/index.htm
ER/Studio , see http://www.embarcadero.com, will do most of what you're looking for, except for the data comparison. It is pricey however.