• Resolved Joesurf

    (@joesurf)


    We are struggling with the use of WP Data Access / Data Explorer.

    Remote database connection refused ERROR 2002

    Our Connection detail are as follows:

    Database name: cms_client_cfg
    MySQL host: cmwebvideo.compumove.com
    MySQL username: cmwebvideo
    MySQL password: ???????????
    MySQL port: 1433
    MySQL schema: db_datareader

    We also attempted a WordPress test of wpdb by adding this string to our function.php file…

    `$wpdb2 = new wpdb( ‘cmwebvideo’, ‘db password’, ‘cms_client_cfg’,
    ‘cmwebvideo.compumove.com’);
    $rows = $mydb->get_results( ‘SELECT field_name FROM table_name’ );

    foreach ( $rows as $row ) :
    echo $row->field_name;
    endforeach;

    The result was a login error of https://www.compumove.com/wp-admin/

    Your help would be greatly appreciated. Thank you

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @joesurf,

    You are trying to connect to port 1433. Is this a SQL Server? Class wpdp can only connect to MySQL. Can you connect from the MySQL CLI with these settings? Can you try?

    Also, this will not work:

    $wpdb2 = new wpdb( 'cmwebvideo', 'db password', 'cms_client_cfg',
    'cmwebvideo.compumove.com');

    You cannot use class wpdb to connect to a remote database defined in WP Data Access. You could use class WPDADB, but you’ll need to make sure the WP Data Access classes are loaded first.

    Please let me know…

    Best regards,
    Peter

    Thread Starter Joesurf

    (@joesurf)

    This is a SQL Server on port 1433. We are able to it with these settings. I guess the error is that this is not a MySQL database.

    My only experience in accessing a MySQL database is over our C-Panel using phpMyAdmin.

    I am willing to try to use class WPDADB. Where do we obtain the WP Data Access classes and where do we load them?

    Thank you for your help. Much appreciated.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @joesurf,

    Here is a minimal code fragment that shows how to use WPDADB:
    https://code-manager.com/code/?wpda_search_code_name=Execute%20query%20from%20PHP%20shortcode
    Make sure you execute the code after loading WP Data Access. If you execute it to early, the class will not be found.

    Please note that you cannot directly connect to SQL Server. WPDADB only connects to MySQL and MariaDB. You need the link I previously send to create a proxy to SQL Server. This works with MariaDB only. MySQL does not support this feature.

    Hope this helps,
    Peter

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Remote database connection refused ERROR 2002’ is closed to new replies.