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. Managed C++/CLI
  4. connecting to mysql in a remote location..

connecting to mysql in a remote location..

Scheduled Pinned Locked Moved Managed C++/CLI
helpdatabasemysqlgraphicsdocker
8 Posts 3 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.
  • T Offline
    T Offline
    Thilek
    wrote on last edited by
    #1

    hi guys, i been writing a program that connect to a remote database in speedhosting.co.cc .But i been having problem to connect its showing error when i run it... Error message : An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll Additional information: Unable to connect to any of the specified MySQL hosts. below is my coding :-

    #pragma once

    namespace trialcpp {

    using namespace System;
    using namespace System::ComponentModel;
    
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace MySql::Data::MySqlClient;
    
    
    /// <summary>
    /// Summary for Form1
    ///
    /// WARNING: If you change the name of this class, you will need to change the
    ///          'Resource File Name' property for the managed resource compiler tool
    ///          associated with all .resx files this class depends on.  Otherwise,
    ///          the designers will not be able to interact properly with localized
    ///          resources associated with this form.
    /// </summary>
    
    
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
    	Form1(void)
    	{
    		InitializeComponent();
    		//
    		//TODO: Add the constructor code here
    		//
    	}
    	
    
    protected:
    	/// <summary>
    	/// Clean up any resources being used.
    	/// </summary>
    	~Form1()
    	{
    		if (components)
    		{
    			delete components;
    		}
    	}
    
    
    private: System::Windows::Forms::Button^  cmdLogin;
    private: System::Windows::Forms::Button^  cmdExit;
    
    protected: 
    
    private:
    	/// <summary>
    	/// Required designer variable.
    	/// </summary>
    	System::ComponentModel::Container ^components;
    

    #pragma region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    void InitializeComponent(void)
    {
    this->cmdLogin = (gcnew System::Windows::Forms::Button());
    this->cmdExit = (gcnew System::Windows::Forms::Button());
    this->SuspendLayout();
    //
    // cmdLogin
    //
    this->cmdLogin->Location = System::Drawing::Point(52, 190);
    this->cmdLogin->Name = L"cmdLogin";
    this->cmdLogin->Size = System::Drawing::Size(75, 23);
    this->cmdLogin->TabIndex = 0;
    this->cmdLogin->Text = L"Login";
    this->cmdLogin-&

    L N 2 Replies Last reply
    0
    • T Thilek

      hi guys, i been writing a program that connect to a remote database in speedhosting.co.cc .But i been having problem to connect its showing error when i run it... Error message : An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll Additional information: Unable to connect to any of the specified MySQL hosts. below is my coding :-

      #pragma once

      namespace trialcpp {

      using namespace System;
      using namespace System::ComponentModel;
      
      using namespace System::Collections;
      using namespace System::Windows::Forms;
      using namespace System::Data;
      using namespace System::Drawing;
      using namespace MySql::Data::MySqlClient;
      
      
      /// <summary>
      /// Summary for Form1
      ///
      /// WARNING: If you change the name of this class, you will need to change the
      ///          'Resource File Name' property for the managed resource compiler tool
      ///          associated with all .resx files this class depends on.  Otherwise,
      ///          the designers will not be able to interact properly with localized
      ///          resources associated with this form.
      /// </summary>
      
      
      public ref class Form1 : public System::Windows::Forms::Form
      {
      public:
      	Form1(void)
      	{
      		InitializeComponent();
      		//
      		//TODO: Add the constructor code here
      		//
      	}
      	
      
      protected:
      	/// <summary>
      	/// Clean up any resources being used.
      	/// </summary>
      	~Form1()
      	{
      		if (components)
      		{
      			delete components;
      		}
      	}
      
      
      private: System::Windows::Forms::Button^  cmdLogin;
      private: System::Windows::Forms::Button^  cmdExit;
      
      protected: 
      
      private:
      	/// <summary>
      	/// Required designer variable.
      	/// </summary>
      	System::ComponentModel::Container ^components;
      

      #pragma region Windows Form Designer generated code
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      void InitializeComponent(void)
      {
      this->cmdLogin = (gcnew System::Windows::Forms::Button());
      this->cmdExit = (gcnew System::Windows::Forms::Button());
      this->SuspendLayout();
      //
      // cmdLogin
      //
      this->cmdLogin->Location = System::Drawing::Point(52, 190);
      this->cmdLogin->Name = L"cmdLogin";
      this->cmdLogin->Size = System::Drawing::Size(75, 23);
      this->cmdLogin->TabIndex = 0;
      this->cmdLogin->Text = L"Login";
      this->cmdLogin-&

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Thilek wrote:

      Kindly help me guys plz

      I will try however I tend to be more successful helping experienced developers. Advise: Add a try/catch and examine the exception information for the error.

      1 Reply Last reply
      0
      • T Thilek

        hi guys, i been writing a program that connect to a remote database in speedhosting.co.cc .But i been having problem to connect its showing error when i run it... Error message : An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll Additional information: Unable to connect to any of the specified MySQL hosts. below is my coding :-

        #pragma once

        namespace trialcpp {

        using namespace System;
        using namespace System::ComponentModel;
        
        using namespace System::Collections;
        using namespace System::Windows::Forms;
        using namespace System::Data;
        using namespace System::Drawing;
        using namespace MySql::Data::MySqlClient;
        
        
        /// <summary>
        /// Summary for Form1
        ///
        /// WARNING: If you change the name of this class, you will need to change the
        ///          'Resource File Name' property for the managed resource compiler tool
        ///          associated with all .resx files this class depends on.  Otherwise,
        ///          the designers will not be able to interact properly with localized
        ///          resources associated with this form.
        /// </summary>
        
        
        public ref class Form1 : public System::Windows::Forms::Form
        {
        public:
        	Form1(void)
        	{
        		InitializeComponent();
        		//
        		//TODO: Add the constructor code here
        		//
        	}
        	
        
        protected:
        	/// <summary>
        	/// Clean up any resources being used.
        	/// </summary>
        	~Form1()
        	{
        		if (components)
        		{
        			delete components;
        		}
        	}
        
        
        private: System::Windows::Forms::Button^  cmdLogin;
        private: System::Windows::Forms::Button^  cmdExit;
        
        protected: 
        
        private:
        	/// <summary>
        	/// Required designer variable.
        	/// </summary>
        	System::ComponentModel::Container ^components;
        

        #pragma region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        void InitializeComponent(void)
        {
        this->cmdLogin = (gcnew System::Windows::Forms::Button());
        this->cmdExit = (gcnew System::Windows::Forms::Button());
        this->SuspendLayout();
        //
        // cmdLogin
        //
        this->cmdLogin->Location = System::Drawing::Point(52, 190);
        this->cmdLogin->Name = L"cmdLogin";
        this->cmdLogin->Size = System::Drawing::Size(75, 23);
        this->cmdLogin->TabIndex = 0;
        this->cmdLogin->Text = L"Login";
        this->cmdLogin-&

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        Thilek wrote:

        Additional information: Unable to connect to any of the specified MySQL hosts.

        What does the InnerException says? Since you haven't provided enough information about the error, consider checking the following points. 1 - Make sure no firewal is not blocking the port. 2 - Make sure port in which MySQL listenes is open and allows remote connections. I believe, it listens on port 3306 on default settings. :)

        Navaneeth How to use google | Ask smart questions

        T 1 Reply Last reply
        0
        • N N a v a n e e t h

          Thilek wrote:

          Additional information: Unable to connect to any of the specified MySQL hosts.

          What does the InnerException says? Since you haven't provided enough information about the error, consider checking the following points. 1 - Make sure no firewal is not blocking the port. 2 - Make sure port in which MySQL listenes is open and allows remote connections. I believe, it listens on port 3306 on default settings. :)

          Navaneeth How to use google | Ask smart questions

          T Offline
          T Offline
          Thilek
          wrote on last edited by
          #4

          its using port 3306 i off my firewall. yet its showing the same error.. is there any others way i can connect to mysql using different classes or connecters..?

          N 1 Reply Last reply
          0
          • T Thilek

            its using port 3306 i off my firewall. yet its showing the same error.. is there any others way i can connect to mysql using different classes or connecters..?

            N Offline
            N Offline
            N a v a n e e t h
            wrote on last edited by
            #5

            Thilek wrote:

            is there any others way i can connect to mysql using different classes or connecters

            The one from MySQL, which you have used is the correct. Here[^] you get connection strings. Make sure you are using a valid format and the server address you have provided is accessible from where you are connecting. :)

            Navaneeth How to use google | Ask smart questions

            T 1 Reply Last reply
            0
            • N N a v a n e e t h

              Thilek wrote:

              is there any others way i can connect to mysql using different classes or connecters

              The one from MySQL, which you have used is the correct. Here[^] you get connection strings. Make sure you are using a valid format and the server address you have provided is accessible from where you are connecting. :)

              Navaneeth How to use google | Ask smart questions

              T Offline
              T Offline
              Thilek
              wrote on last edited by
              #6

              after i change the string value to :

              MySqlConnection ^conDatabase = gcnew MySqlConnection("Server=sql304.byetcluster.com;Database='speed_2972829_worm'; Uid='username' ;Pwd='password'; Protocol=pipe; Port=3306; CharSet=UTF8");

              i get this error : An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll Additional information: Reading from the stream has failed. i am confused...hmm.. can help me ya ?

              N 1 Reply Last reply
              0
              • T Thilek

                after i change the string value to :

                MySqlConnection ^conDatabase = gcnew MySqlConnection("Server=sql304.byetcluster.com;Database='speed_2972829_worm'; Uid='username' ;Pwd='password'; Protocol=pipe; Port=3306; CharSet=UTF8");

                i get this error : An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll Additional information: Reading from the stream has failed. i am confused...hmm.. can help me ya ?

                N Offline
                N Offline
                N a v a n e e t h
                wrote on last edited by
                #7

                Thilek wrote:

                Reading from the stream has failed.

                Looks like it is a bug in connector. See here[^]. Not sure it got fixed :(

                Navaneeth How to use google | Ask smart questions

                T 1 Reply Last reply
                0
                • N N a v a n e e t h

                  Thilek wrote:

                  Reading from the stream has failed.

                  Looks like it is a bug in connector. See here[^]. Not sure it got fixed :(

                  Navaneeth How to use google | Ask smart questions

                  T Offline
                  T Offline
                  Thilek
                  wrote on last edited by
                  #8

                  well i think the server dont support remote login from .net.. with php no problem..

                  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