EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Cannot open the Connection use LocalPortforwarding

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#5559
Posted: 03/21/2008 13:52:45
by Sittichai Promma (Basic support level)
Joined: 03/21/2008
Posts: 1

I downloaded and installed a new Version of SecureBlackbox and use LocalPortForwarding Sample Project.

I added a new button and the following code to the project and try to connect to my database.

Code
private void LoadData()
{
   string connString = "Server=localhost;Port=3307;Database=database;Uid=user;Pwd=password;pooling=false";

   MySqlConnection mySqlConnection = new MySqlConnection();
   mySqlConnection.ConnectionString = connString;

   try
   {
      mySqlConnection.Open();

      if (mySqlConnection.State == ConnectionState.Open)
      {
         // Todo:
      }
   }
   catch (OdbcException ex)
   {
      Console.WriteLine(ex.Message + Environment.NewLine);
   }
   finally
   {
      if (mySqlConnection != null && mySqlConnection.State == ConnectionState.Open)
      {
         mySqlConnection.Close();
      }
   }
}

private void btnTestSQL_Click(object sender, EventArgs e)
{
   Thread mySqlThread = new Thread(new ThreadStart(LoadData));
   mySqlThread.Start();
}


Problem:
The Application hangs up (not responding) at the line mySqlConnection.Open()

Do you have any idea?

NOTE:
- I can connect to database with the same code only when i use Putty to forward port.
#5581
Posted: 03/24/2008 03:20:02
by Ken Ivanov (EldoS Corp.)

Thank you for contacting us.

It is a common problem of all client MySQL components. To remove the hangup, move the code that sends MySQL requests to a separate thread. Please consider using the attached sample as a guide.


[ Download ]

Reply

Statistics

Topic viewed 1434 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!