Need a tool to convert postgres database to mysql - mysql

I found the mysql migration toolkit which will migrate the tables.But is there something which will convert the functions as well.

Almost certainly not.
If your functions are in the SQL language only, it should probably be doable. But any of the many other languages supported by PostgreSQL (pl/pgsql, perl, python etc) are completely different, and contain much functionality that's simply not supported on MySQL.

most likely not. the stored procedure and function language differs greatly between postgresql and mysql. such an application would be costly to develop.

There are several data migration tools available on Google to convert database. I use dbload for example.

Related

PL/SQL library to emulate mysql built-in functions

I need to convert the queries of a MySql-only project to Oracle.
Is there a PL/SQL library that emulates the MySql built-in functions?
Thanks in advance.
I don't know of any library like you're asking for, there are some tools that might help you though. I found this site that tells you the equivalent functions and data types between the two DBMS, and it looks like they have a free online tool you could run your project through which might be the best option if it's not too big.

How reliable are mySQL stored procedures?

This not a go/no go question. I've used all kinds of 4GLs (PL/SQL, T-SQL, PGSQL etc.) for database back-end coding and find very useful to establish data layer "closest" to database engine.
Now MySQL stored procedures got my attention and very interested in coding in this brand new 4GL platform.
I would like to start using it in one of my proof of concept projects. What you folks think about MySQL stored procedures? Crucial question is; Is it reliable? How "Oracle Corporation" supports MySQL stored procedures (i.e. documentation, forums etc.)?
Thanks
Support started in v5.0, it's currently in v5.1 (v5.5 is in the pipe). If they weren't reliable, they'd have been removed.
I don't know what you mean by "how Oracle supports it" - the syntax is different, rarely (if ever) will you be able to port an Oracle stored procedure directly to MySQL without alteration.
A mySQL stored procedure will be as reliable as you make it. If you write it to do everything you need then it will be fine. If you don't it wont.
As #OMG states they began supporting in version 5.0.
What do you mean when you ask how Oracle supports it?

Possible to write MySQL stored procedures in ruby?

I have heard that one in PostgreSQL could write stored procedures in ruby (also python/java/c++).
Is this possible in MySQL?
Because I dont want to learn their own language for it.
Thanks
No, you can't. Just install PostgreSQL on your (virtual) system and install PL/Ruby as well:
http://moulon.inra.fr/ruby/plruby.html
Setting up a virtual machine (in VMware or Virtual Box) using Ubuntu with PostgreSQL, takes just a few minutes:
https://help.ubuntu.com/10.04/serverguide/C/postgresql.html
Simply put - nope. In MySQL you have to write a SP in their language or a UDF in C/C++. I brought up a C/C++ UDF, but I don't believe you can even really do a stored procedure in them.
They don't support different languages via a pluggable system like PostgreSQL.

mysql dump outside the command line

Do any of the modern programming languages support mysqldump as a method, Or is it still the domain of command line environments.
If you're using PHP and don't mind using a GPL license, then phpMyAdmin contains some code for MySQL dump (as well as to other formats like CSV, etc).
Check out the file:
libraries/export/sql.php
There are APIs available (database drivers) for .NET, Delphi, and generic ODBC/DAO, as well as libraries for C/C++ and other languages. It's never going to be written directly into a mainstream language itself; that would restrict the language from being as general purpose and therefore make it less useful.
Delphi, for instance, has a database framework called DBExpress; there's a DBExpress driver included out of the box for MS SQL Server, Oracle, MySQL, DB2, and others; what drivers are available depend on the version (Professional, Enterprise, or Architect) you decide to buy. MySQL is available in all versions.
Using the DBExpress framework makes Delphi usable with any database engine that someone decides to provide a DBExpress driver for, and the drivers can be written in Delphi itself. That keeps Delphi more general purpose; it's not hard-coded to work with only a single RDBMS.
EDIT: As others have said (I think Jarret), the source to mysqldump is available. Using the wrappers available for your language of choice, you should be able to implement the same functionality based on that source.
Your instinct is right... it would be pretty tough for a programming language library to provide API access to mysqldump. The source to mysqldump is written in C, with its own main() function; it's designed to operate pretty much as its own program. It gets built as an executable, and much of the error reporting and output are handled using direct print statements to stdout, and not using return values that could be wrapped into a language-specific value.
When most bindings for a specific programming language are compiled (PHP, python, Delphi, .NET, etc), they link against libmysql, and libmysql contains no reference to the mysqldump program. I can't say for sure that no one has written a wrapper, but it would be a very bizarre wrapper indeed.
In other words, your best bet is to use a sub-process from your programming language of choice to call the mysqldump tool, and absorb the results either from stdin or from a temp file.
Your question is rather vague. Please describe what you want to accomplish, and what you have tried already.
That being said, if you want to produce a DB dump of a MySQL database in the way that mysqldump does, I know of no API that makes it possible directly. But there are numerous other ways of dumping / backing up a DB, and the mysqldump format has its share of problems (not well defined for one thing, hence not easy to parse). So you might consider an alternative approach.

PL/Ruby equivalent in MySQL

PL/Ruby is a loadable procedural language for Postgres that lets you use Ruby to write user defined functions for the database.
Anyone know of an equivalent way of writing user defined functions for MySQL in Ruby?
Starting from version 5 (I think) Mysql supports stored procedures, but the syntax is restricted to SQL:2003 which is somewhat similar to PL/SQL.
Other languages aren't supported and I'm not aware of any projects offering ruby support. Last time I checked the PL/Ruby extensions to postgres were still a bit wonky as well, though.
Mysql as far as I am aware only supports MySQLs own stored procedure language.
I'm a postgresql fan too, and this is something that has always frustrated me about MySQL when I have had no choice but to use it. :(