Database migration: from MySQL to DB2

Notice: This thread is very old.
madalina
Member | 7
+
0
-

Hello,
I have an application written in Nette Framework with MySQL database.
Now I have to move it to DB2. So, besides changing the parameters in config.neon, are there any steps to follow? Is there any documentation about that?
Can anyone help me?
Thank you!

Majkl578
Moderator | 1364
+
0
-

That really depends on the database layer you use and what features you use.
Basically, you'd need to rewrite any platform-specific queries, which are not compliant with SQL standard.

madalina
Member | 7
+
0
-

Thank you, but I have troubles from the beginning. Do you know where could I find a DB2 driver?

Milo
Nette Core | 1153
+
0
-

You are using Nette\Database, right?

Nette\Database (NDB) uses PHP PDO drivers. There is no native PDO driver for IBM DB2, you must use ODBC. I suppose, you have a working ODBC driver and you are able connect to DB2.

If so, NDB require own SupplementalDriver like these. For ODBC-DB2 this driver does not exist. You must write own one and pass it into Nette\Database\Connection.

Last edited by Milo (2013-04-29 10:17)

madalina
Member | 7
+
0
-

No, the application is using DibiConnection, with mysqli driver. But since there is no DB2 driver, I was suggested not to use Dibi anymore. What are the options in this case?

Milo
Nette Core | 1153
+
0
-

Well, dibi hasn't native DB2 driver, but has a ODBC driver. So, if you can configure ODBC, use it with dibi. It is the easiest way.

Next option is to write own DibiDB2Driver driver. It is more or less easy. I would like to help you, but I'm not a owner of IBM DB2 running server.

But if you want leave dibi and use another database layer, you must rewrite all parts of the application with database code. Config change only does not help you.

madalina
Member | 7
+
0
-

Thank you, Milo!
The plan is to leave Dibi and rewrite the sql queries in the application.
But I can't figure out how to modify config.neon to connect to the new database. I tried something but I keep getting errors.
Do you know what should be the parameters for a DB2 database?

Milo
Nette Core | 1153
+
0
-

Which version of Nette do you use? Past there config.neon content and the error message.