Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Where to find connect declaration of this mysql instace

Where to find connect declaration of this mysql instace

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasemysqlhelptutorial
19 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    I think you will need to search the documentation, or use the MySQL forum.

    C Offline
    C Offline
    coco243
    wrote on last edited by
    #6

    When I installed Connector C++, there were unziped the headers that contains declarations of classes and functions. I suposed that is logical to find the declaration of these functions, clases constructors etc on those .h files. I found connect declaration in driver.h file:

    class CPPCONN_PUBLIC_FUNC Driver
    {
    protected:
    virtual ~Driver() {}
    public:
    // Attempts to make a database connection to the given URL.

    virtual Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password) = 0;

    virtual Connection * connect(ConnectOptionsMap & options) = 0;

    virtual int getMajorVersion() = 0;

    virtual int getMinorVersion() = 0;

    virtual int getPatchVersion() = 0;

    virtual const sql::SQLString & getName() = 0;

    virtual void setCallBack(sql::Fido_Callback &cb) = 0;

    virtual void setCallBack(sql::Fido_Callback &&cb) = 0;

    virtual void threadInit() = 0;

    virtual void threadEnd() = 0;
    };

    And I found that the connection type(or class) of the connect defined in the connection.h file:

    class CPPCONN_PUBLIC_FUNC Connection
    {
    /* Prevent use of these */
    Connection(const Connection &);
    void operator=(Connection &);
    public:

    Connection() {};

    virtual ~Connection() {};

    virtual void clearWarnings() = 0;

    virtual Statement *createStatement() = 0;

    virtual void close() = 0;

    virtual void commit() = 0;

    virtual bool getAutoCommit() = 0;

    virtual sql::SQLString getCatalog() = 0;

    virtual Driver *getDriver() = 0;

    virtual sql::SQLString getSchema() = 0;

    virtual sql::SQLString getClientInfo() = 0;

    virtual void getClientOption(const sql::SQLString & optionName, void * optionValue) = 0;

    virtual sql::SQLString getClientOption(const sql::SQLString & optionName) = 0;

    virtual DatabaseMetaData * getMetaData() = 0;

    virtual enum_transaction_isolation getTransactionIsolation() = 0;

    virtual const SQLWarning * getWarnings() = 0;

    virtual bool isClosed() = 0;

    virtual bool isReadOnly() = 0;

    virtual bool isValid() = 0;

    virtual bool reconnect() = 0;

    virtual sql::SQLString nativeSQL(const sql::SQLString& sql) = 0;

    virtual PreparedStatement * prepareStatement(const sql::SQLString& sql) = 0;

    virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys) = 0;

    virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int* columnIndexes) = 0;

    virtu

    L 1 Reply Last reply
    0
    • C coco243

      When I installed Connector C++, there were unziped the headers that contains declarations of classes and functions. I suposed that is logical to find the declaration of these functions, clases constructors etc on those .h files. I found connect declaration in driver.h file:

      class CPPCONN_PUBLIC_FUNC Driver
      {
      protected:
      virtual ~Driver() {}
      public:
      // Attempts to make a database connection to the given URL.

      virtual Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password) = 0;

      virtual Connection * connect(ConnectOptionsMap & options) = 0;

      virtual int getMajorVersion() = 0;

      virtual int getMinorVersion() = 0;

      virtual int getPatchVersion() = 0;

      virtual const sql::SQLString & getName() = 0;

      virtual void setCallBack(sql::Fido_Callback &cb) = 0;

      virtual void setCallBack(sql::Fido_Callback &&cb) = 0;

      virtual void threadInit() = 0;

      virtual void threadEnd() = 0;
      };

      And I found that the connection type(or class) of the connect defined in the connection.h file:

      class CPPCONN_PUBLIC_FUNC Connection
      {
      /* Prevent use of these */
      Connection(const Connection &);
      void operator=(Connection &);
      public:

      Connection() {};

      virtual ~Connection() {};

      virtual void clearWarnings() = 0;

      virtual Statement *createStatement() = 0;

      virtual void close() = 0;

      virtual void commit() = 0;

      virtual bool getAutoCommit() = 0;

      virtual sql::SQLString getCatalog() = 0;

      virtual Driver *getDriver() = 0;

      virtual sql::SQLString getSchema() = 0;

      virtual sql::SQLString getClientInfo() = 0;

      virtual void getClientOption(const sql::SQLString & optionName, void * optionValue) = 0;

      virtual sql::SQLString getClientOption(const sql::SQLString & optionName) = 0;

      virtual DatabaseMetaData * getMetaData() = 0;

      virtual enum_transaction_isolation getTransactionIsolation() = 0;

      virtual const SQLWarning * getWarnings() = 0;

      virtual bool isClosed() = 0;

      virtual bool isReadOnly() = 0;

      virtual bool isValid() = 0;

      virtual bool reconnect() = 0;

      virtual sql::SQLString nativeSQL(const sql::SQLString& sql) = 0;

      virtual PreparedStatement * prepareStatement(const sql::SQLString& sql) = 0;

      virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int autoGeneratedKeys) = 0;

      virtual PreparedStatement * prepareStatement(const sql::SQLString& sql, int* columnIndexes) = 0;

      virtu

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #7

      coco243 wrote:

      Maybe this operator:

      It is a simple overload of the assignment operator in C++. But is has very little to do with your question. The method you need to use is at the beginning:

      virtual Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password) = 0;

      C 1 Reply Last reply
      0
      • L Lost User

        coco243 wrote:

        Maybe this operator:

        It is a simple overload of the assignment operator in C++. But is has very little to do with your question. The method you need to use is at the beginning:

        virtual Connection * connect(const sql::SQLString& hostName, const sql::SQLString& userName, const sql::SQLString& password) = 0;

        C Offline
        C Offline
        coco243
        wrote on last edited by
        #8

        Yes, but I don't know where to find the definition of this method. I don't find the code behind it.

        L 1 Reply Last reply
        0
        • C coco243

          Hi, I want to work with a MYSQL database with jdbc using C++. I have started with connection and I saw in an example the following statement:

          con = driver->connect("host", "usert", "password");

          I found the connect declaration in the driver.h header as a connection type, but I don't know where to find the definition of the connect. Can anybody help me please with finding its definiton? Thank you,

          R Offline
          R Offline
          RedDk
          wrote on last edited by
          #9

          coco243 wrote:

          I saw in an example

          If you look here: https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-jdbc-url-format.html[^] you can see why Richard thinks just a link to another user forum doesn't help anybody. Especially when, in the phrasing of the question, there is some symmantic disconnect on parade. For all Christendom to see. You might type in using your keyboard what your eyes are referencing now.

          1 Reply Last reply
          0
          • C coco243

            Yes, but I don't know where to find the definition of this method. I don't find the code behind it.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #10

            That is the definition of the method. You just need to code it with all the parameters filled in as necessary.

            C 1 Reply Last reply
            0
            • L Lost User

              That is the definition of the method. You just need to code it with all the parameters filled in as necessary.

              C Offline
              C Offline
              coco243
              wrote on last edited by
              #11

              I don't see where I am misunderstand the things but it appears to me as a declaration of a method. For example if we have a class defined like that:

              class point{
              public:
              int x,y;
              void set (int val_x, int val_y); // here the method declaration
              };

              void point::set( int val_x, int val_y) // here the method definition

              x = val\_x;
              y = val\_y;
              

              }

              void main()
              {
              point p1;

              p1.set(10,2);    // here te call of the method
              

              }

              In the set method I have the parameters val_x and val_y, and I see in the definition of the set method the processes that implies val_x, and val_y, I see that val_x is attributed to x and so over, but in the connect method I don't see where hostName, userName and password are used. That it what I want to understand. Thank you,

              L 1 Reply Last reply
              0
              • C coco243

                I don't see where I am misunderstand the things but it appears to me as a declaration of a method. For example if we have a class defined like that:

                class point{
                public:
                int x,y;
                void set (int val_x, int val_y); // here the method declaration
                };

                void point::set( int val_x, int val_y) // here the method definition

                x = val\_x;
                y = val\_y;
                

                }

                void main()
                {
                point p1;

                p1.set(10,2);    // here te call of the method
                

                }

                In the set method I have the parameters val_x and val_y, and I see in the definition of the set method the processes that implies val_x, and val_y, I see that val_x is attributed to x and so over, but in the connect method I don't see where hostName, userName and password are used. That it what I want to understand. Thank you,

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #12

                coco243 wrote:

                in the connect method I don't see where hostName, userName and password are used.

                Why do you need to? All you really need to understand is that the C++ library will use those details to create an actual connection to the MySQL driver, and from there to the actual database server.

                C 1 Reply Last reply
                0
                • C coco243

                  Yes, I have installed Connector C++ 8.0, in the link below it is explained that Conector C++ 8.0 supports "legacy C++ API based on the JDBC4", and there is an exemplified code where appear the "connect" statement, and I am not able to understand where is defined to see it's functions or more details. https://dev.mysql.com/doc/dev/connector-cpp/8.0/jdbc\_ref.html Thank you.

                  M Offline
                  M Offline
                  markkuk
                  wrote on last edited by
                  #13

                  The legacy API documentation is in Connector/C++ 1.1 Developer Guide[^] even if you use version 8 of the connector. Options for MySQLDriver::Connect() are explained here: https://dev.mysql.com/doc/connector-cpp/1.1/en/connector-cpp-connect-options.html[^]

                  C 1 Reply Last reply
                  0
                  • L Lost User

                    coco243 wrote:

                    in the connect method I don't see where hostName, userName and password are used.

                    Why do you need to? All you really need to understand is that the C++ library will use those details to create an actual connection to the MySQL driver, and from there to the actual database server.

                    C Offline
                    C Offline
                    coco243
                    wrote on last edited by
                    #14

                    I had figured that if I know how this function is defined, I can extract more information about the conection, status of conection and other things that I am not aware, in addition I wanted to have a better overview on the subject.

                    L 1 Reply Last reply
                    0
                    • M markkuk

                      The legacy API documentation is in Connector/C++ 1.1 Developer Guide[^] even if you use version 8 of the connector. Options for MySQLDriver::Connect() are explained here: https://dev.mysql.com/doc/connector-cpp/1.1/en/connector-cpp-connect-options.html[^]

                      C Offline
                      C Offline
                      coco243
                      wrote on last edited by
                      #15

                      Thank you for the link.

                      1 Reply Last reply
                      0
                      • C coco243

                        I had figured that if I know how this function is defined, I can extract more information about the conection, status of conection and other things that I am not aware, in addition I wanted to have a better overview on the subject.

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #16

                        All such information would normally be found in the documentation. And after searching the MySQL pages I think you need to look at https://dev.mysql.com/doc/c-api/8.0/en/[^]. it is titled "C APIO", but I assume it works just as well with the C++ driver.

                        C 1 Reply Last reply
                        0
                        • L Lost User

                          All such information would normally be found in the documentation. And after searching the MySQL pages I think you need to look at https://dev.mysql.com/doc/c-api/8.0/en/[^]. it is titled "C APIO", but I assume it works just as well with the C++ driver.

                          C Offline
                          C Offline
                          coco243
                          wrote on last edited by
                          #17

                          Normaly this information should be in the installation folders of the C++ connector, in the headers files, and some of it, it is, but I just don' t know where to find definition of those methods, any way I supose that I will succed finally, but it would have been intresting to know how this method were coded. Or maybe those would be an waste of time or to complicate for my knowledge level.

                          L 1 Reply Last reply
                          0
                          • C coco243

                            Normaly this information should be in the installation folders of the C++ connector, in the headers files, and some of it, it is, but I just don' t know where to find definition of those methods, any way I supose that I will succed finally, but it would have been intresting to know how this method were coded. Or maybe those would be an waste of time or to complicate for my knowledge level.

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #18

                            I gave you a link to the API in my previous message, you need to go and study it.

                            C 1 Reply Last reply
                            0
                            • L Lost User

                              I gave you a link to the API in my previous message, you need to go and study it.

                              C Offline
                              C Offline
                              coco243
                              wrote on last edited by
                              #19

                              Ok, tank you

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups