Uploaded image for project: 'CUBRID APIs'
  1. CUBRID APIs
  2. APIS-546

Can't connect to a Shard Broker via PDO

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: PDO-Aprium, PHP-Aprium, PHP 8.4.3
    • Fix Version/s: PDO 9.1.0.0002
    • Component/s: PHP Driver
    • Labels:
      None
    • Environment:

      CUBRID SHARD 9.1.0 x64
      MYSQL 5.1
      CentOS 6.3 x64
      CUBRID PDO 9.1.0.0001 (Mac OS X)

      Description

      A user has reported to http://www.cubrid.org/660884 that he can't connect to a Shard Broker via CUBRID PDO driver.

      I have also followed this tutorial https://github.com/kadishmal/cubrid-shard-demo, configured CUBRID SHARD with MySQL backend database, and tried to work with the PDO driver, but failed. The demo works correctly with JDBC and Node.js drivers, though.

      Since PDO driver is based on CCI, it should be possible to work with a Shard Broker since CCI supports it.

        Issue Links

          Activity

          Hide
          kadishmal Esen Sagynov added a comment -

          Please see also http://jira.cubrid.org/browse/APIS-547 for details on the same issue with PDO driver. That issue includes the exact problem as well as the code to reproduce it.

          Show
          kadishmal Esen Sagynov added a comment - Please see also http://jira.cubrid.org/browse/APIS-547 for details on the same issue with PDO driver. That issue includes the exact problem as well as the code to reproduce it.
          Hide
          kadishmal Esen Sagynov added a comment -

          One more user has reported this problem at http://www.cubrid.org/questions/663251. He also wants to use CUBRID SHARD via PHP driver.

          Show
          kadishmal Esen Sagynov added a comment - One more user has reported this problem at http://www.cubrid.org/questions/663251 . He also wants to use CUBRID SHARD via PHP driver.
          Hide
          jinhu 李金虎 added a comment -

          Please investigate this issue. Thank you!

          Show
          jinhu 李金虎 added a comment - Please investigate this issue. Thank you!
          Hide
          cn15163 杨伟为[Astro] added a comment -

          When working with sharding, the cci function cci_get_db_parameter always fail.
          the call stack is as follows:
          1. in function pdo_cubrid_handle_factory

          	if ((cubrid_retval = get_db_param(H, &error)) < 0) {
          		pdo_cubrid_error(dbh, cubrid_retval, &error, NULL);
          		cci_disconnect(cubrid_conn, &error);
          		goto cleanup;
          	}
          
          

          2. in function get_db_param, the cubrid_retval value is -10100

          	if ((cubrid_retval = cci_get_db_parameter(H->conn_handle, 
          					CCI_PARAM_ISOLATION_LEVEL, &isolation_level, error)) < 0) {
          		return cubrid_retval;
                  }
          

          To test cci_get_db_parameter function, i write the following code fragment

          void testCCI()
          {
          	int con = 0;
          	T_CCI_ERROR cci_error;
          
          	con = cci_connect ("10.34.135.186", 45011, "shard1", "shard", "shard123");
              if (con < 0)
              {
                  printf ("cannot connect to database\n");
                  return;
              }
          
          	int isolation_level;
          	int cubrid_retval = 0;
          	cubrid_retval = cci_get_db_parameter(con, CCI_PARAM_ISOLATION_LEVEL, &isolation_level, NULL);
          	printf("%d return value of CCI_PARAM_ISOLATION_LEVEL",cubrid_retval);
          
          	cci_disconnect (con, &cci_error);
          }
          
          Show
          cn15163 杨伟为[Astro] added a comment - When working with sharding, the cci function cci_get_db_parameter always fail. the call stack is as follows: 1. in function pdo_cubrid_handle_factory if ((cubrid_retval = get_db_param(H, &error)) < 0) { pdo_cubrid_error(dbh, cubrid_retval, &error, NULL); cci_disconnect(cubrid_conn, &error); goto cleanup; } 2. in function get_db_param, the cubrid_retval value is -10100 if ((cubrid_retval = cci_get_db_parameter(H->conn_handle, CCI_PARAM_ISOLATION_LEVEL, &isolation_level, error)) < 0) { return cubrid_retval; } To test cci_get_db_parameter function, i write the following code fragment void testCCI() { int con = 0; T_CCI_ERROR cci_error; con = cci_connect ("10.34.135.186", 45011, "shard1", "shard", "shard123"); if (con < 0) { printf ("cannot connect to database\n"); return; } int isolation_level; int cubrid_retval = 0; cubrid_retval = cci_get_db_parameter(con, CCI_PARAM_ISOLATION_LEVEL, &isolation_level, NULL); printf("%d return value of CCI_PARAM_ISOLATION_LEVEL",cubrid_retval); cci_disconnect (con, &cci_error); }
          Hide
          kadishmal Esen Sagynov added a comment -

          Thank you! I will take a look at it!

          Show
          kadishmal Esen Sagynov added a comment - Thank you! I will take a look at it!
          Hide
          kadishmal Esen Sagynov added a comment - - edited

          杨伟为[Astro], in SHARD environment, SHARD Broker cannot execute what cci_get_db_parameter() function asks to because there are potentially more than one server operated by SHARD Broker. So, in SHARD environment, cci_get_db_parameter() and maybe other similar functions should not be called. So, please modify the code but make sure it doesn't break in normal Broker case. Make sure all tests pass.

          Show
          kadishmal Esen Sagynov added a comment - - edited 杨伟为[Astro] , in SHARD environment, SHARD Broker cannot execute what cci_get_db_parameter() function asks to because there are potentially more than one server operated by SHARD Broker. So, in SHARD environment, cci_get_db_parameter() and maybe other similar functions should not be called. So, please modify the code but make sure it doesn't break in normal Broker case. Make sure all tests pass.
          Hide
          cn15163 杨伟为[Astro] added a comment -

          The get_db_param function cant not work with sharding.So When get_db_param function fails with CAS_ER_NOT_IMPLEMENTED, just ignore it.

          Show
          cn15163 杨伟为[Astro] added a comment - The get_db_param function cant not work with sharding.So When get_db_param function fails with CAS_ER_NOT_IMPLEMENTED, just ignore it.
          Hide
          ryin005 Ray Yin added a comment - - edited

          The connection problem has been soloved in PDO 9.1.0001 (20130530)

          Please refers to the test case apis_546.zip

          Show
          ryin005 Ray Yin added a comment - - edited The connection problem has been soloved in PDO 9.1.0001 (20130530) Please refers to the test case apis_546.zip

            People

            • Assignee:
              cn15163 杨伟为[Astro]
              Reporter:
              kadishmal Esen Sagynov
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: