skip to Main Content

Have a problem,

I have a code written in vb.net that works perfectly, at least so far. I have several windows and linux servers and it has worked on all of them. Today I have installed a new server with CentOS 8 and MariaDB. If I execute the query from workbench it works perfectly, if I execute it by command line through ssh it also works. But if I run it in my code, it doesn’t return any result, that is, it returns an empty datatable, it doesn’t throw any error, but I don’t get the necessary records.

The query only lists the available databases beginning with "app_"

   Dim dt As New System.Data.DataTable

   Try

     Dim cmm As String = "SELECT information_schema.schemata.schema_name FROM information_schema.schemata WHERE information_schema.schemata.schema_name LIKE 'app_%'"

     Me.MiAdap = New MySqlDataAdapter(cmm, MiObjCon)
     Me.MiAdap.Fill(dt)

     Return dt

   Catch mySqlException1 As MySqlException
      Throw New ICB.DataBase.DBException(mySqlException1, CLng(mySqlException1.Number))
   End Try

Any idea?

If I execute the query from workbench it works perfectly, if I execute it by command line through ssh it also works. But if I run it in my code, it doesn’t return any result, that is, it returns an empty datatable

2

Answers


  1. Chosen as BEST ANSWER

    Yes, install a new server, but all connections are remote, only ssh is local, but workbench connect is remote. I load a backup and have 6 databases that is listed if run query on workbench but return empty datatable is run in my code.

    No error codes because no throw any error, connect is ok, query is ok, only return a empty datatable... it's strange

    Regards!


  2. Since you’re not sharing any error messages, we kind of have to just guess at this. But the key phrase that jumps out at me is this:

    installed a new server

    This leads to three possible sources for the error:

    1. MySQL/MariaDB has it’s own internal firewall that by default only allows connections from localhost. If you’re running Workbench on the local machine, or have already connected via ssh, those connections are coming from localhost and will pass through the firewall.
    2. The connection string in the VB.Net code is not correct.
    3. The new server hasn’t had any data loaded yet, or there’s a mistake with the schema or table name

    However, for 1 & 2 I’d expect more of an error than just an empty result, and for 3 I’d expect Workbench or SSH to behave differently.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search