Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34272

Implement ODBC Connection Keywords (aka parameters) as OPTIONS for CREATE SERVER

Details

    Description

      Unfortunately, CREATE SERVER does not yet support ODBC Connection Keywords (aka parameters) in its OPTIONS clause. For example, this statement does not yet work:

      CREATE SERVER mssql_hq_server
         FOREIGN DATA WRAPPER odbc
      OPTIONS (
         DSN 'Legacy-MSSQL-Server',
         UID 'mssql_user',
         PWD 'password',
      );
      

      This currently results in a syntax error:

      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DSN 'Legacy-MSSQL-Server',
         UID 'mssql_user',
         PWD 'password',
      )' at line 4
      

      The standard only defines a handful universal keywords, and the remaining is left to each driver to decide. So instead of defining allowed keywords and validating their values, we should simply accept them and construct the odbc connection string using these key-value pairs.

      Attachments

        Issue Links

          Activity

            ycp Yuchen Pei added a comment - - edited

            Hi holyfoot, ptal thanks (in the branch 11.4-enterprise-ment-796):

            # the CS spider part of the main implementation of MENT-796
            beacfcbeac9 MDEV-34272 create server with odbc results in connection string
            # the sql layer implementation of MENT-796
            e318fc9c45d MDEV-34272 Allow arbitrary options in CREATE SERVER
            # fixes an independent SERVER bug
            f7218cafe1c MDEV-34272 Fix mysql.servers socket max length too short
            # just some independent cleanups, should be backported to the earliest possible version
            ea1249e5abe MDEV-34272 spider: some trivial cleanups and documentation

            also applied to CS (in bb-11.4-mdev-34272) as

            d2eb785f3e9 upstream/bb-11.4-mdev-34272 MDEV-34272 create server with odbc results in connection string
            cef6d3e0d12 MDEV-34272 Allow arbitrary options in CREATE SERVER
            3e87ba578bd MDEV-34272 Fix mysql.servers socket max length too short
            e6234e3eec9 MDEV-34272 spider: some trivial cleanups and documentation

            ycp Yuchen Pei added a comment - - edited Hi holyfoot , ptal thanks (in the branch 11.4-enterprise-ment-796): # the CS spider part of the main implementation of MENT-796 beacfcbeac9 MDEV-34272 create server with odbc results in connection string # the sql layer implementation of MENT-796 e318fc9c45d MDEV-34272 Allow arbitrary options in CREATE SERVER # fixes an independent SERVER bug f7218cafe1c MDEV-34272 Fix mysql.servers socket max length too short # just some independent cleanups, should be backported to the earliest possible version ea1249e5abe MDEV-34272 spider: some trivial cleanups and documentation also applied to CS (in bb-11.4-mdev-34272) as d2eb785f3e9 upstream/bb-11.4-mdev-34272 MDEV-34272 create server with odbc results in connection string cef6d3e0d12 MDEV-34272 Allow arbitrary options in CREATE SERVER 3e87ba578bd MDEV-34272 Fix mysql.servers socket max length too short e6234e3eec9 MDEV-34272 spider: some trivial cleanups and documentation
            ycp Yuchen Pei added a comment - - edited

            Looks like I'll have to withdraw the patch and work out MDEV-15696 first.

            A few tests fail, of which the test main.mysqldump-system is non-trivial, as it dumps a server created with CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(Host 'localhost'); into CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (Host 'localhost', Port 3306, Options {"Host": "localhost"});

            The problem lies in dump_all_servers() in mysqldump.cc, which reads each field as a client and print them out in OPTIONS.

            We could parse JSON in mysqldump.cc, but it will introduce complexity and it seems to me that it would be better to just implement SHOW CREATE SERVER, which is MDEV-15696.

            holyfoot, ralf.gebhardt, serg, let me know if you have any thoughts on this.

            ycp Yuchen Pei added a comment - - edited Looks like I'll have to withdraw the patch and work out MDEV-15696 first. A few tests fail, of which the test main.mysqldump-system is non-trivial, as it dumps a server created with CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(Host 'localhost'); into CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (Host 'localhost', Port 3306, Options {"Host": "localhost"}); The problem lies in dump_all_servers() in mysqldump.cc , which reads each field as a client and print them out in OPTIONS . We could parse JSON in mysqldump.cc , but it will introduce complexity and it seems to me that it would be better to just implement SHOW CREATE SERVER , which is MDEV-15696 . holyfoot , ralf.gebhardt , serg , let me know if you have any thoughts on this.

            I think this makes perfect sense

            serg Sergei Golubchik added a comment - I think this makes perfect sense

            People

              ycp Yuchen Pei
              ycp Yuchen Pei
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.