MySql bad handshake

Posts   
 
    
OneEye
User
Posts: 5
Joined: 17-Apr-2012
# Posted on: 17-Apr-2012 12:23:36   

Hi,

I am setting up a new LLBLGen Pro 3.1 project for a MySql database. When connecting to the database I get the following errormessage when I test the connection :

Exception message:

Exception type: MySqlException Bad handshake

Stacktrace:

LLBLGen Pro version 3.1. Build September 30th, 2011 -----[Core exception]-------------------- at CoreLab.MySql.a7.n() at CoreLab.MySql.a7.c() at CoreLab.MySql.b.d(String A_0) at CoreLab.MySql.b.a(String A_0, String A_1, String A_2, String A_3, Int32 A_4, String A_5, Int32 A_6, SshOptions A_7, SslOptions A_8, ProxyOptions A_9, HttpOptions A_10) at CoreLab.MySql.MySqlInternalConnection.Connect(String userId, String password, String host, String database, Int32 port, Int32 connectionTimeout, MySqlProtocol protocol, Boolean compress) at CoreLab.MySql.MySqlInternalConnection..ctor(ag connectionOptions) at CoreLab.MySql.be.a(s A_0, Object A_1, DbConnectionBase A_2) at CoreLab.Common.DbConnectionFactory.a(DbConnectionPool A_0, s A_1) at CoreLab.Common.DbConnectionPoolGroup.c(DbConnectionPool A_0) at CoreLab.Common.DbConnectionPool.a() at CoreLab.Common.DbConnectionPool.GetObject() at CoreLab.Common.DbConnectionFactory.a(DbConnectionBase A_0) at CoreLab.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection) at CoreLab.Common.DbConnectionBase.Open() at CoreLab.MySql.MySqlConnection.Open() at SD.LLBLGen.Pro.Gui.Controls.WizardPages.MetaDataRetrievalWizard_Step_ConnectionData.TestConnectionData

I am connecting to a windows based version of MySQL, version 5.5.22

Does anyone know what is happening and how to solve this ?

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 17-Apr-2012 12:30:35   
OneEye
User
Posts: 5
Joined: 17-Apr-2012
# Posted on: 17-Apr-2012 15:58:32   

Tnx , I managed to connect to the database and generate code simple_smile

But now I run into the folowing error when I execute database code : (in this case just fetching a collection).

I am using the SelfServicing Model.

'DbProviderFactoryInvariantName is set to an invalid provider factory name.'

stacktrace:

at SD.LLBLGen.Pro.ORMSupportClasses.DbProviderFactoryInfo.get_FactoryToUse() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Persistence\DbProviderFactoryInfo.cs:line 181 at SD.LLBLGen.Pro.DQE.MySql.MySqlSpecificCreator.get_FactoryToUse() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\MySqlDQE\MySqlSpecificCreator.cs:line 262 at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.get_FactoryToUse() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\Persistence\DynamicQueryEngineBase.cs:line 2076 at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.CreateConnection(String connectionString) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\DaoBase.cs:line 1826 at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.CreateConnection() in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\DaoBase.cs:line 1817 at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.DetermineConnectionToUse(ITransaction containingTransaction) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\DaoBase.cs:line 1841 at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.PerformGetMultiAction(ITransaction containingTransaction, IEntityCollection collectionToFill, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, IPrefetchPath prefetchPathToUse, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\DaoBase.cs:line 986 at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.GetMulti(ITransaction containingTransaction, IEntityCollection collectionToFill, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IPredicate selectFilter, IRelationCollection relations, IPrefetchPath prefetchPathToUse, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\DaoBase.cs:line 805 at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase1.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, IPrefetchPath prefetchPathToUse, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\EntityCollectionBase.cs:line 777 at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase1.GetMulti(IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v3.1\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\EntityCollectionBase.cs:line 670 at QuookerIntranetService.Service.getAdresGegevens(String postcode, String huisnummer) in F:\Projects\Quooker\QuookerServiceDatabase\QuookerIntranetService\Service.asmx.cs:line 59

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Apr-2012 20:15:42   
  • What version of Devart dotConnect are you using?
  • What are the LLBLGen assembly references that have been added to your generated project?
  • Are that the exact error message you see in the exception? I didn't see it before.
David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 17-Apr-2012 20:19:28   

Also make sure your applications .config file has the proper dbproviderfactory defined, if the machine.config doesn't.

Frans Bouma | Lead developer LLBLGen Pro
OneEye
User
Posts: 5
Joined: 17-Apr-2012
# Posted on: 18-Apr-2012 08:56:17   

Hi , tnx for your responses.

I think I am missing something here..... up until now I only used llblgen to connect to SQL Server. This is the first time I use it to connect to a MySQL database.

Do I need to install any extra drivers for this to work ?

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 18-Apr-2012 09:03:19   

If you managed to connect to the database from the Designer, then you have everything installed on that machine. Just take care of this:

Otis wrote:

Also make sure your applications .config file has the proper dbproviderfactory defined, if the machine.config doesn't.

OneEye
User
Posts: 5
Joined: 17-Apr-2012
# Posted on: 18-Apr-2012 10:14:33   

The designer is not on my machine. I build the code on a remote machine and link to it in my project.

I installed MySQL Connector/Net 6.5.4 on my machine and copied the lines it created in the machine.config to the web.config:

<system.data> <DbProviderFactories> <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.5.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" /> </DbProviderFactories> </system.data>

But still something is going wrong. I get the message that I specified the same providerfactory twice. I assume this means that is already specified in the machine.config.

But if I then remove it form the web.config I get the original error:

DbProviderFactoryInvariantName is set to an invalid provider factory name.

Is the MySQL driver I used not the correct one ? or do I have to use the same driver that is present on the machine where I generate the llblgen code ?

OneEye
User
Posts: 5
Joined: 17-Apr-2012
# Posted on: 18-Apr-2012 10:40:28   

I have everything working now simple_smile

I found out that on the llblgen machine, the corelab drivers are installed. (should've checked this right away of course... )

I installed these on my dev machine and everything works fine.

Thanks for the help !

Kris Nobels avatar
Posts: 118
Joined: 02-Apr-2008
# Posted on: 06-Mar-2013 23:23:56   

Hello, i got the same exception message Bad handshake

LLBLGen Pro version 3.5. Build January 17th, 2013
-----[Core exception]--------------------
   bij CoreLab.MySql.a9.n()
   bij CoreLab.MySql.c.d(String A_0)
   bij CoreLab.MySql.c.a(String A_0, String A_1, String A_2, String A_3, Int32 A_4, String A_5, Int32 A_6, SshOptions A_7, SslOptions A_8, ProxyOptions A_9, HttpOptions A_10)
   bij CoreLab.MySql.MySqlInternalConnection.Connect(String userId, String password, String host, String database, Int32 port, Int32 connectionTimeout, MySqlProtocol protocol, Boolean compress, Boolean clientInteractive)
   bij CoreLab.MySql.MySqlInternalConnection..ctor(ak connectionOptions)
   bij CoreLab.MySql.bh.a(s A_0, Object A_1, DbConnectionBase A_2)
   bij CoreLab.Common.DbConnectionFactory.a(DbConnectionPool A_0, s A_1)
   bij CoreLab.Common.DbConnectionPool.a()
   bij CoreLab.Common.DbConnectionPool.GetObject()
   bij CoreLab.Common.DbConnectionFactory.a(DbConnectionBase A_0)
   bij CoreLab.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection)
   bij CoreLab.MySql.MySqlConnection.Open()
   bij SD.LLBLGen.Pro.Gui.Controls.WizardPages.MetaDataRetrievalWizard_Step_ConnectionData.TestConnectionData(Boolean showSuccess)

There are only 3 searchresults on bad handshake.

Now this is what i did:

*Check if the credentials are correct whit SQLYog. (No problems there)

*Get the version of mysql -> 5.1.57-community

  • Add this to my LLBLGenPro.exe.config
        <DbProviderFactories>
        <remove invariant="Devart.Data.MySql" />
        <add name="dotConnect for MySQL" invariant="Devart.Data.MySql" description="Devart dotConnect for MySQL" type="Devart.Data.MySql.MySqlProviderFactory, Devart.Data.MySql, Version=7.5.192.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />

These lines i found in my Machine.config and on the devart forum when you search for DbProviderFactories

I have the latest driver from devart.

*searched on _devart _and DbProviderFactories and i found this Link http://www.devart.com/dotconnect/mysql/docs/Deployment.html

  • paste this from my machine.config (and put the devart tag in comment.)
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

Restart llblgen I got this:

Kan de aangevraagde .Net Framework-gegevensprovider niet vinden. Mogelijk is deze niet geïnstalleerd.

LLBLGen Pro version 3.5. Build January 17th, 2013
-----[Core exception]--------------------
   bij System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   bij SD.LLBLGen.Pro.DBDriverCore.DBDriverBase.GetDbProviderFactory()
   bij SD.LLBLGen.Pro.DBDriverCore.DBDriverBase.CreateConnection()
   bij SD.LLBLGen.Pro.Gui.Controls.WizardPages.MetaDataRetrievalWizard_Step_ConnectionData.TestConnectionData(Boolean showSuccess)

And to check This is my path: C:\Program Files (x86)\MySQL\MySQL Connector Net 6.6.5\Assemblies

I do not know what to do....

Any tips are welcome

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 07-Mar-2013 06:49:46   
  • Did you actually install dotConnect for MySql drivers?
  • What does ...this... means in Englishconfused
Kan de aangevraagde .Net Framework-gegevensprovider niet vinden. Mogelijk is deze niet geïnstalleerd.

-- Can't find the requested .NET Framework provider blabla -- Otis wink

  • What exact version of dotConnect did you install?
  • What type is your OS (W7/WXP/etc, 86x/64x)? And what .NET version are you using?
  • Does the 'bad handshake' still occurs if you connect to an older MySQL DB version?

BTW, the second exception is saying: LLBLGen can't find MySql DBFactory, mainly because your change on the config. If you install Devart's dotconnect, this DBFactory should be in your machine.config already, you don't need it in you .config file. So remove it and let's back to your original problem (bad handshake).

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 07-Mar-2013 17:46:21   

I do recall this is also because you use a newer Mysql version with an old corelab driver.

Could you try the latest devart mysql connect express driver? (the free one is fine, it will provide enough features)

Frans Bouma | Lead developer LLBLGen Pro
Kris Nobels avatar
Posts: 118
Joined: 02-Apr-2008
# Posted on: 07-Mar-2013 18:31:18   
  • Did you actually install dotConnect for MySql drivers?

yes, i bought 3 days a go the devart driver. and installed that exe. (dotConnect for MySQL Professional 7.5.192 release date 28-Feb-2013)

  • What exact version of dotConnect did you install?

7.5.192 simple_smile

  • What type is your OS (W7/WXP/etc, 86x/64x)? And what .NET version are you using?

Windows 8 64 bit version I would like to use .net version 4.0 but that is not possible to select the target platform.

  • Does the 'bad handshake' still occurs if you connect to an older MySQL DB version?

I do not have an old mysql database :-(

BTW, the second exception is saying: LLBLGen can't find MySql DBFactory, mainly because your change on the config. If you install Devart's dotconnect, this DBFactory should be in your machine.config already, you don't need it in you .config file. So remove it and let's back to your original problem (bad handshake).

I do recall this is also because you use a newer Mysql version with an old corelab driver.

Mysql version: 5.1.57-community Devart version: 7.5.192

This is some content part from my machine.config (DbProviderFactories)

<add name="MyDirect .NET" invariant="CoreLab.MySql" description="CoreLab MyDirect .NET" type="CoreLab.MySql.MySqlDirectFactory, CoreLab.MySql, Version=4.85.36.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <add name="dotConnect for MySQL" invariant="Devart.Data.MySql" description="Devart dotConnect for MySQL" type="Devart.Data.MySql.MySqlProviderFactory, Devart.Data.MySql, Version=7.5.192.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />

You will notice that there is an old corelab driver and a new Devart driver.

That is why i have the new driver because, someone wrote that is works with the new driver disappointed

Todo: I check if the OS is the problem. I have a windows 7 laptop

Any tips are welcome :-)

TBC

Kris Nobels avatar
Posts: 118
Joined: 02-Apr-2008
# Posted on: 07-Mar-2013 19:07:12   

Hello,

I did everything with my windows 7 machine. **No problems there ... **simple_smile

So i found my work arround smile

TBC

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 07-Mar-2013 20:05:09   

"Bad Handshake" is an issue between MySQL and the Devart provider. This is where the handshaking occurs. I'd suggest you try the latest version of MySQL. And see ifte error still exists.

Kris Nobels avatar
Posts: 118
Joined: 02-Apr-2008
# Posted on: 07-Mar-2013 22:36:57   

Ok, I report this to Devart ;-)

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 08-Mar-2013 05:11:42   

Kris wrote:

Ok, I report this to Devart ;-)

Good. Please give us some feedback when Devart answer you, so we can help other users with a similar issue wink

David Elizondo | LLBLGen Support Team
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 17-Jun-2013 01:17:32   

I ran into this problem a while back. It occurs when upgrading to MySQL 5.1.57 or newer and with 5.5.12 or newer with devart drivers prior to 6.30.160.

It's mentioned in their revision history here: http://www.devart.com/dotconnect/mysql/revision_history.html

And discussed in the forum here: http://forums.devart.com/viewtopic.php?t=20977

I've just worked through upgrading my older version of their driver to newer express version. A bit of a pain--because I was using the very old "CoreLab" versions. But doing the upgrade resolved the issue for me.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Jun-2013 06:11:43   

Thanks for sharing that. Indeed it's a Corelab's issue, maybe they would backport that fix to older viersion. Otherwise people have to upgrade.

David Elizondo | LLBLGen Support Team
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 17-Jun-2013 08:47:43   

There was some discussion in their forums of that, but I think it's unlikely that they will go back and change old versions (always hard to get vendors to do that).

Speaking of which wink , But I'm attaching here rebuilt .NET 2.0 runtime libraries for LLBLGen Pro 1.0.2005.1 Final that link against the new Devart Express libraries (current version as of this post). These probably are only of use to me (as I have to maintain some very old code bases that still use LLBLGen Pro 1.0).

If you have an LLBLGen 1.0 project that needs to connect to current versions of MySQL and are getting the dreaded "bad handshake" error, you can upgrade to the current version of the devart drivers and then use these runtimes for LLBLGen 1.0.

Somewhere around 2009 (2.6?), I believe LLBLGen began supporting both drivers (CoreLab and Devart), but the older versions of LLBLGen's runtimes don't (as far as I can tell) support the devart drivers.

Note that when you upgrade your project to use the devart assemblies, you'll have to do some renaming as described in the devart FAQ:

How do I upgrade my projects to dotConnect for MySQL 5.00? In the 5.00 release there were some important name changes in the product. Particularly, assemblies, namespaces, invariant name, and some types were changed as follows: "CoreLab.Data" became "Devart.Data"; "CoreLab.MySql" became "Devart.Data.MySql"; "MySqlDirectFactory" became "MySqlProviderFactory"; Invariant name became "Devart.Data.MySql"; Your projects must be updated to be compatible with dotConnect for MySQL 5.0. Here is the list of files you should update: *.csproj, *.vbproj - references to assemblies *.cs, *.vb - namespaces *.licx - namespaces and assembly names Web.config - assembly names and web provider types This is done automatically when you invoke the Upgrade wizard from the Visual Studio menu: Tools | MySQL | Upgrade Wizard. - See more at: http://www.devart.com/dotconnect/mysql/faq.html

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 17-Jun-2013 09:30:41   

Thanks scotru for the into. I hope it's of use to some other people who might run into this. simple_smile

I've removed the dlls though, as we don't want 3rd parties to distribute our runtimes in binary form unless it's with their own applications. I hope you'll understand.

I don't know if you did this, but the driver also needs updating, as that too is using the corelab dll. Users should recompile the driver with the devart express dll as well.

Customers can download the sourcecode from the customer area and link to a different ado.net provider themselves, if they need to. There's indeed one problem with corelab -> devart, the types change. This isn't a big problem though, a couple of replace actions in vs.net and the dll should compile. I do recall a problem with licensing with corelab dlls and the designer (we had to add a piece of binary data to the resources to make their dll not throw up at runtime due to licensing issues disappointed ), not sure if this pops up with the devart stuff as well if you hard-link the dlls.

With v3 we moved to the DbProviderFactory system which solved this issue indeed. Before that, it was a bit of a nightmare.

Sorry again for having to remove your dlls, but I hope the information is enough to help people solve this issue themselves.

Frans Bouma | Lead developer LLBLGen Pro
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 18-Jun-2013 08:48:08   

Hey Otis,

Thanks for your quick response and I do indeed understand and apologize for posting (or trying to post) these without double checking with you first.

I did indeed have to change the MySQL DQE as well as the OrmSupportTools. When you say that types changed from corelab -> devart are you talking about the type for the devart tool itself that requires the recompile I describe or are you talking about DB type mappings for MySQL? If MySQL type mappings have changed, this has me nervous that I may encounter some unexpected problems--I've been treating the new devart driver as a drop-in replacement for the old CoreLabs driver.

I did have to include references to their controls in the .licx files for my project (and update the references to reflect the name change) but I haven't done anything else special related to licensing. Do you have any more details about the binary code you had to include? I'm a little nervous now that I might have a problem crop up at a later time.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 18-Jun-2013 10:14:57   

scotru wrote:

Hey Otis,

Thanks for your quick response and I do indeed understand and apologize for posting (or trying to post) these without double checking with you first.

I did indeed have to change the MySQL DQE as well as the OrmSupportTools. When you say that types changed from corelab -> devart are you talking about the type for the devart tool itself that requires the recompile I describe or are you talking about DB type mappings for MySQL? If MySQL type mappings have changed, this has me nervous that I may encounter some unexpected problems--I've been treating the new devart driver as a drop-in replacement for the old CoreLabs driver.

The types stayed the same (more or less, they added bool type I think, please compare the 3.5/4.x mysql driver sourcecode with the old one if you have access to it), I was talking about the namespaces and class types (if any wink )

I did have to include references to their controls in the .licx files for my project (and update the references to reflect the name change) but I haven't done anything else special related to licensing. Do you have any more details about the binary code you had to include? I'm a little nervous now that I might have a problem crop up at a later time.

I think they changed this in later versions. It was for the corelab ado.net provider, which didn't load properly if you'd load it indirectly through assembly load like we do in the designer. If you compile code against the ado.net provider directly, this isn't a problem as vs.net will do it for you. So no worries simple_smile

Frans Bouma | Lead developer LLBLGen Pro