Error after installation of your extension

HI,
After installation of your extension Data Migrtion Pro on my magento 2.2.1 fresh install, when I tried to configure the source database, I received error :
CDbException
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

/home/pioupiou/public_html/pub/ub-tool/protected/models/Mage1ActiveRecord.php(13)

01 <?php
02 
03 class Mage1ActiveRecord extends CActiveRecord
04 {
05     public static $db = null;
06 
07     public function getDbConnection()
08     {
09         if (self::$db !== null)
10             return self::$db;
11         else
12         {
13             self::$db = Yii::app()->db1;
14             if (self::$db instanceof CDbConnection)
15             {
16                 self::$db->setActive(true);
17                 return self::$db;
18             }
19             else
20                 throw new CDbException(Yii::t('yii','Active Record requires a "db" CDbConnection application component.'));
21         }
22     }
23 }


Do you have an explanation to this error ?

30 answers

Profile photo of Mall Staff 184060.00 $tone November 30, 2017
Public

Hi there,

CDbException
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

Seem your M1’s database is not located in same MySQL server with M2’s database? If yes, you must enable remote connection on M1’s database from M2’s server.
Regards,
Mall.

#1
Profile photo of Mall Staff 184060.00 $tone November 30, 2017
Public

Hi there,

No, M1 database is on the same Mysql than M2 … other suggestion ?

So, kindly re-correct your M1’s database credentials once more or please contact to your Hosting provider to get more help about MySQL connection issues.
Regards,
Mall.

#3
Profile photo of BIGAND JEROME 630.00 $tone November 30, 2017
Public

I already re-check all the mysql credential and always same error.
My hosting provider can’t do antything about this because :
1/ This is a dedicated server install by myself
2/ I just install a Magento 2.2.1 fresh install with same mysql credential and it work well … so not I don’t know why it doesn’t work with the YII Framewrok that you used to create your extension
seems to have other people who have similar problem with this framework : http://www.yiiframework.com/forum/index.php/topic/6554-database-connection-issue/

#4
Profile photo of Mall Staff 184060.00 $tone December 1, 2017
Public

Hi there,

so I renew my question, please can you help me to solve this bug

So, please provide me the admin credentials, ssh credentials and web root path of your M2 instance.
I will check further and get back you later.
Regards,
Mall.

#6
Profile photo of BIGAND JEROME 630.00 $tone December 1, 2017
Public

please can you give me a private secure email where I can send you all the ssh credential or add me to skype with my skype pseudo : skype_angelflo
I don’t want to publish this info thru this support forum for security risk
thanks again

#7
Profile photo of ubdev Staff 98390.00 $tone December 1, 2017
Public

Hi there, 
You can send us your site credentials to our email info (at) ubertheme.com. We maintain technical support via this forum helpdesk only. 
Actually, you can also provide us your site credentials here under a private reply, or you mark this as a private ticket. Only you and our technical team can access.
Regards,
Ubertheme team

#8
Profile photo of Mall Staff 184060.00 $tone December 1, 2017
Public

Hi there,

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘magasin_principal_migrated’ for key ‘STORE_GROUP_CODE’. The SQL statement executed was: INSERT INTO `store_group` (`website_id`, `root_category_id`, `default_store_id`, `name`, `code`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4) 

I have checked your instance and see the root issue as per this screenshot: https://prnt.sc/hhm9a4
The ‘code’ is a new field which has been added since Magento2.2.x in the table ‘store_group’ and our migration tool automatically generated the value for this field from Store Name when migrating.
And the value of the ‘code’ field is unique as per Magento’s default rule for the ‘store_group’ table. 
But most of your M1’s Stores have the same Store Name (Magasin Principal).
To handle this specific case, you could apply the following workaround: 
+ Open the php file at the path: pub/ub-tool/protected/controllers/Step2Controller.php, find the line:

$code .= '_migrated';

and replace it with:

$code .= "_".uniqid();
//because max length of code field is 32 chars
if (strlen($code) > 32) {
$code = substr($code, (strlen($code)-32), 32);
}

Once done, you can continue migrating as normal following our guide in the Readme.html
Regards,
Mall.
 
 

#10
Profile photo of Mall Staff 184060.00 $tone December 2, 2017
Public

Hi there,
Please do with steps as followings:
+ Download the php file at HERE
+ Upload replace downloaded file to the file at path: pub/ub-tool/protected/controllers/Step7Controller.php
+ Once done, please reset step #7 and restart data migration in this step by run CLI commands:
php -f bin/ubdatamigration reset --step=7
Resetting in step #7 and do data migration in this step:
php -f bin/ubdatamigration run --step=7
And tell me know how it goes.
Regards,
Mall.
 

#14
Profile photo of Mall Staff 184060.00 $tone December 5, 2017
Public

Hi there,

This is the log i received after re-setting the step 7 and restart it in CLI mode (but I didn’t see the order ID in your debug info):

Let’s pause activities at your end. I will help to check further and get back to you later.
Regards,
Mall.

#18
Profile photo of BIGAND JEROME 630.00 $tone December 5, 2017
Public

Hi again, please wait before more investigation.
I just fund some fews lines (5 in total) who have problem of encoding with utf8 in the column additional_info.
I just tried to reformat it correctly and I’ll restart the step 7 to check if it solve the problem.

#19
Profile photo of Mall Staff 184060.00 $tone December 5, 2017
Public

Hi there,

I just fund some fews lines (5 in total) who have problem of encoding with utf8 in the column additional_info.
I just tried to reformat it correctly and I’ll restart the step 7 to check if it solve the problem

Yeah, let’s do it at your end and contact me if you need further assistance.
Regards,
Mall.

#20
Profile photo of Mall Staff 184060.00 $tone December 6, 2017
Public

Hi there,

I restarted Step 7 and have still an error :
ORDER ID 80246 — a:6:{s:5:”alias”;s:0:””;s:8:”CC_BRAND”;s:10:”MasterCard”;s:9:”paymentId”;s:10:”3310191053″;s:6:”status”;s:1:”9″;s:10:”acceptence”;s:6:”483862″;s:21:”additionalScoringData”;a:3:{s:6:”CARDNO”;s:16:”XXXXXXXXXXXX0484″;s:2:”ED”;s:4:”0217″;s:2:”CN”;s:13:”J Parzyjag?a”;}}\n\nPHP Error[8]: unserialize(): Error at offset 262 of 265 bytes

That was because your database has at least one record in the table ‘sales_flat_order_payment’ that has bad value of the ‘additional_information’ field. As you see, it relates to an incorrect serialize string which our tool couldn’t unserialize.
You should consider to re-correct that serialize string or replace it with null value or could you delete the associated record in the ‘table sales_flat_order_payment’?
Also, if you run across any issue, you should pause the process, and let me know the details of issue. It’s easier for me to debug and provide you faster resolution this way. You did reset data migration in that step though, hence it’s harder for me to debug the root of issue that you mentioned.
I have try to run data migration in the step #7 to debug further but I got this:
http://i.prntscr.com/zq_eZq13TGOZefnURzTQRw.png
Please check again.
Regards,
Mall.

#22
Profile photo of Mall Staff 184060.00 $tone December 6, 2017
Public

 Hi there,

I didn’t find what is unserializable in this field (perhaps the “?” … but not sure … I tried to remove this char in database).
You can restart the step7 in your side, I have re-setting this Step in backend and I pause activities in my side.

I’m checking further in your instance to find workaround to help you out on bad data. And i will get back you later.
Please pause your activities in your instance at your end.
Regards,
Mall.

#25
Profile photo of Mall Staff 184060.00 $tone December 6, 2017
Public

Hi there,

or perhaps add this function to your step7 to avoid problem during the migration :

I have added that workaround in step #7 of our tool to handle for your cases with special data in the custom field (additional_information): http://i.prntscr.com/ipgcUwbmSzGZWvBFv6nRDA.png
Now you could continue data migration in the step #7 by run cli command:
php -f bin/ubdatamigration run --step=7;
Note: Let’s run continue and you don’t need to reset the step #7 as you did in first time 😉
Regards,
Mall.
 
 
 

#26
Profile photo of BIGAND JEROME 630.00 $tone December 7, 2017
Public

Hi Mall,
Thanks a lot, everything seems to work now. Please don’t forget to maintain these 2 modifications in your next updates.
Also, for information can you tell me :
1/ if your extension permit to migrate CMS Page and Block ? I can’t find this function …
2/ if now I install other extensions on my magento 2 development website (who will create new columns in the database) to prepare my migration,  can I still apply delta migration from your extension after installation of these extensions (because of course I’ll need to re-import customers and orders at the very last time… just before moving in production Magento 2) ?
Best regards

#27
Profile photo of Mall Staff 184060.00 $tone December 8, 2017
Public

Hi there,

Please don’t forget to maintain these 2 modifications in your next updates.

Yes, we’ve added these tweaks to include in our next release. 

1/ if your extension permit to migrate CMS Page and Block ? I can’t find this function …

Our tool has not supported this feature yet. Data migration remains to be our focal point at present.

2/ if now I install other extensions on my magento 2 development website (who will create new columns in the database) to prepare my migration,  can I still apply delta migration from your extension after installation of these extensions (because of course I’ll need to re-import customers and orders at the very last time… just before moving in production Magento 2) ?

This depends whether your third-party extensions force to input values or not. If it requires their own values, it will need extra tweaks for our migration tool to handle such specific cases. Otherwise, our migration tool works normally when you run delta migration.
Best,
Mall

#28
Profile photo of Mall Staff 184060.00 $tone December 12, 2017
Public

Hi there,

can I just remove these attributes in your extension ? For exemple is it possible to remove directly in your table ub_migrate_map_step_3_attribute (if this is the table who manage this) ? or do you have a better solution without needed to reset and reimport everything ?
thanks a lot

Yes, you could do that by run SQL statement as followings:

DELETE FROM ub_migrate_map_step_3_attribute WHERE entity_name = 'eav_attribute' AND m2_id NOT IN (SELECT attribute_id FROM eav_attribute);

Once done, you must to clean the cache of our tool: rm -rf pub/ub-tool/protected/runtime/cache/
And then, you could continue with data migration.
Regards,
Mall.

#30

Please login or Register to Submit Answer

Written By

Comments