dcsimg
Results 1 to 11 of 11

Thread: MySQL, VB6 and classis ASP

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2018
    Posts
    17

    MySQL, VB6 and classis ASP

    I have a computer with W10 and VB6 (and IIS vers. 10) where I installed MySQL in the developer version. With MySQL Workbench I am able to see the "sakila" sample database and work on it.
    I then created a user dns and gave it by name "sakila". The test indicates that the user dns is correct.

    Now I would like to open a connection to this database in a "classic" ASP page and also in a normal VB6 project.
    Here is the code for the ASP page:

    Code:
    <%
      dim cnn
      Set Cnn = Server.CreateObject ("ADODB.Connection")
      cnn.connectionString = "Driver = {MySQL ODBC 8.0 ANSI Driver}; Server = localhost; Database = sakila; User = root; Password = **********; Option = 3;"
      Cnn.Open
    The code of VB6 project is very similar.
    The problem is certainly due to the connection string. Despite having consulted the site www.connectionstring.com I was not able - in both cases - to access the database MySQL
    The error in IIS is as follows:
    An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error.
    Obviously the ASP page resides in a local space of a site (always local) that works correctly with other classic ASP pages (which, however, connect to an MDB archive, as is customary with classic ASP pages). But I would also like to work with MySQL.
    In the same way I would like to create a VB6 project (with ADO) that works with a MySQL database.
    I am perfectly able to do both (VB6 and classic ASP) with MSAccess files but not with MySQL.
    How to fix it?
    Thanks for the attention
    Last edited by AlpVir2; Jul 14th, 2019 at 03:24 AM.

  2. #2
    PowerPoster
    Join Date
    Jun 2013
    Posts
    4,743

    Re: MySQL, VB6 and classis ASP

    Code:
     
      cnn.connectionString = "Driver = {MySQL ODBC 8.0 ANSI Driver}; Server = localhost; Database = sakila; User = root; Password = **********; Option = 3;"
    When ADO is used in conjunction with ODBC-drivers,
    one is good advised, to put an appropriate Prefix in front of the ODBC-related stuff of the Conn-String:
    Provider=MSDASQL;

    HTH

    Olaf

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2018
    Posts
    17

    Re: MySQL, VB6 and classis ASP

    What I suggested had already been accomplished by me in numerous attempts with numerous variants.

    Code:
    Private Sub Form_Load()
       Dim cnn As ADODB.Connection
       Dim strCnn     As String
       Set cnn = New ADODB.Connection
       ' strCnn = "Driver = {MySQL ODBC 8.0 ANSI Driver}; Server = localhost; Database = sakila; User = root; Password = xxxx; Option = 3;"
       ' strCnn = "Driver = {MySQL ODBC 8.0 Unicode Driver}; Server = localhost; Database = sakila; User = root; Password = xxxx; Option = 3;"
      ' strCnn = "Driver = {MySQL ODBC 8.0 ANSI Driver}; Server = localhost; Database = sakila; User = root; Password = xxxx ; Option = 3;"
      ' strCnn = "Driver = {MySQL ODBC 8.0 ANSI Driver}; Server = localhost; Database = sakila; User = root; Password = xxxx ; Option = 3;"
      ' strCnn = "Provider = MSDASQL;Driver = {MySQL ODBC 5.3 ANSI Driver}; Server = localhost; Database = sakila; User = root; Password = xxxx; Option = 3;"
      ' strCnn = "Provider = MSDASQL;Driver = {MySQL ODBC 5.3 Unicode Driver}; Server = localhost; Database = sakila; User = root; Password = xxxx; Option = 3;"
      strCnn = "Driver = {MySQL ODBC 5.3 ANSI Driver}; Server = localhost; Database = sakila; User = root; Password = xxxx; Option = 3;"
       strCnn = "Provider = MSDASQL; Driver = {MySQL ODBC 5.3 ANSI Driver}; Server = localhost; Database = sakila; User = root; Password = xxx; Option = 3;"
       cnn.Open strCnn
     End Sub

    In VB6 the error is
    print err.Number
    -2147467259
    print err.Description
    [Microsoft] [ODBC Driver Manager] Data source name not found and default driver not specified.
    However in the control panel, Administrative Tools, Driver there is
    "MySQL ODBC 5.3 ANSI Driver" - 5.03.13 - Oracle Corporation
    and
    "MySQL ODBC 5.3 Unicode Driver" - 5.03.13 - Oracle Corporation

    Could it be that the driver is from Oracle and not from Microsoft?

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Candon City, Ilocos Sur, Phils.
    Posts
    11,038

    Re: MySQL, VB6 and classis ASP

    Did you install the 64 bit or the 32 bit version? Perhaps you've installed the wrong version?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2018
    Posts
    17

    Re: MySQL, VB6 and classis ASP

    The computer is 64-bit
    I installed mysql-installer-community-8.0.16.0.msi (382340 KB).
    During the installation I chose the old version of drivers 5.3 instead of the more recent 8.0.
    This is because, having to interface with the old VB6, I was afraid that the new driver versions might not work.
    In the Control Panel - Administrative tools - I have 2 entries (in Italian language)
    1) "ODBC Data Sources (32 bit)" which refers to% windir% syswow64 odbcad32.exe
    2) "Origine dati ODBC (64 bit)" which refers to % windir% system32 odbcad32.exe

    It seems to me to be a bit confusing (32 bit and syswow64, 64 bit and system32) !!!

  6. #6
    Fanatic Member
    Join Date
    Feb 2019
    Posts
    680

    Re: MySQL, VB6 and classis ASP

    Not sure if this is the reason, but try to remove the extra spaces around =.

  7. #7
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Candon City, Ilocos Sur, Phils.
    Posts
    11,038

    Re: MySQL, VB6 and classis ASP

    Try installing the 32 bit mysql odbc connector and remove the 64 bit. If that doesn't work then remove the 32 bit and just install the 64 bit.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  8. #8

    Thread Starter
    Junior Member
    Join Date
    May 2018
    Posts
    17

    Re: MySQL, VB6 and classis ASP

    Thank you all.
    Now everything works with the following connection string (I removed the spaces)
    Code:
    strCnn = "Driver={MySQL ODBC 5.3 ANSI Driver};Server=localhost;Database=sakila;User=root;Password=***** ;Option=3;"
    It works both on the VB side and on the Classic ASP side !!!

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Posts
    20,922

    Re: MySQL, VB6 and classis ASP

    I see "dns" above which was probably supposed to be a deprecated DSN (data source name). In any case none of the connection strings seem to be using it anyway.

    64-bit ODBC drivers can't be used via 32-bit ADO.

  10. #10

    Thread Starter
    Junior Member
    Join Date
    May 2018
    Posts
    17

    Re: MySQL, VB6 and classis ASP

    Quote Originally Posted by dilettante View Post
    64-bit ODBC drivers can't be used via 32-bit ADO.
    So, if I understand correctly, even though the computer is a 64 bit and being VB6 32 bit, the 64 bit drivers will not be used.

  11. #11
    Lively Member
    Join Date
    Mar 2019
    Posts
    122

    Re: MySQL, VB6 and classis ASP

    Quote Originally Posted by AlpVir2 View Post
    So, if I understand correctly, even though the computer is a 64 bit and being VB6 32 bit, the 64 bit drivers will not be used.
    That's correct. Also if you really want to set up DSN's you need to use ODBCAd32.exe in syswow64. Otherwise I believe your 32 bit app wont see the DSN. At least thats how I remember it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width