Bug #14257 Exception thrown when opening a connection
Submitted: 24 Oct 2005 14:29 Modified: 26 Oct 2005 13:23
Reporter: Norm Schaeffer Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S1 (Critical)
Version:1.0.6 OS:Windows (Windows XP)
Assigned to: Reggie Burnett CPU Architecture:Any

[24 Oct 2005 14:29] Norm Schaeffer
Description:
Using Connector/Net, WinXP, Visual Studio 2003, developing in VB.NET, .Net Framework 1.1, MySQL 4.1.14

When I attempt to connect I a "Specified cast is not valid" exception is thrown.

I am using the MySQL Connector/Net sample

(I found a couple of references to the same problem in the forums)

Using the same code I didn't have the problem with Connector 1.0.4 and MySql 4.1.12

How to repeat:
Note: actual server, user id removed.

Imports MySql.Data.Client

'General Declarations'
Dim connection as MySqlConnection

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim connString As String

        Try

            connString = "Persist Security Info=False; host=mysqlhostServer; database=facilities;user id=userid"

            connection = New MySqlConnection(connString)
            connection.Open()

            MessageBox.Show("Connected to MySql server", "Connected", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Close()

        Catch ex As Exception

            MessageBox.Show("Error connecting " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            Close()
        End Try

    End Sub
[25 Oct 2005 11:59] Vasily Kishkin
Sorry...I was not able to reproduce the bug on 4.1.15. Your test case works fine. Could you please re-test it on 4.1.15 ?
[26 Oct 2005 13:23] Norm Schaeffer
My sysadmin upgraded to MySQL 5.

Problem resolved.

Thanks,
Norm
[26 Oct 2005 14:02] Reggie Burnett
Thanks for letting us know.