Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all 1447 articles
Browse latest View live

Extremely slow C# dataset update preformance (2 replies)

$
0
0
Hello all. A co-worker of mine posted some of this in another forum (ODBC) but he is not here now and I don't feel we got a good response. (Maybe we should've posted in this forum first?) Before I past the text from the other, I would like to clarify my issue. We purchased some software that used 32bit MariaDB 10.0.17 on a Windows box. Because of that, we decided to try MariaDB and MySQL for our in-house projects (to replace MS Access as a back-end).

I was extremely disappointed in the write performance. At first, I assumed it might be a network or ODBC (or even MariaDB) problem, so I installed MySQL 10.x and used C# datasets for testing of selects and updates. In all cases, including even the Access ODBC, the selects are insanely fast-- pretty much instantaneous. But any type of insert or update is orders of magnitude slower. Since MySQL is so popular now, I have to believe that this is some kind of configuration issue on my part. (I defaulted pretty much everything on the install).

However, as you can see from the re-post below, I have confirmed that this is NOT a Windows or network resource issue since the insert test using mysqlimport _from the client to the server_ took only 2 seconds, while all other methods (including MySQL.exe) took much longer.

I hope reposting the piece below is not a breach of etiquette-- I apologize if so. Anyway, I would appreciate any ideas I can get as I really want to make MySQL work for us. Here's the original text:

I am having serious insert and update problems with MariaDB version 10.0.17. Here is our environment:
“Server”:
* Dell Optiplex 3010, 4GB, 250GB, Windows 7 SP1 (64 bit), gigabit ethenet
* MariaDB 10.0.17 (32 bit)
* .Net Framework 4.5.2
Client:
* Dell Optiplex 3010, 4GB, 250GB, Windows 7 SP1 (64 bit), gigabit ethernet
* MS Access 2010 (32 bit)
* MariaDB ODBC 3.0 Driver (32 bit)
* MySql Connector Net 6.9.12
* Visual Studio 2012
* .Net Framework 4.5.2
The MariaDB installation used all defaults (InnoDB, UTF8, etc. ). There is basically no load on the server and 40% of the memory is unused. I created a couple of tables for test purposes. The main table has an integer id number as PK, last name, first name, integer status, entry date. The last name column is indexed and the status field is a foreign key for a small (20 rows) lookup table. There are just under 11,000 records in the existing text file. I tried several load methods for the data: MS Access linked table (ODBC, all defaults) , MS Access VBA DAO recordset (ODBC), MS Access ADODB recordset (ODBC), C# MySql .Net 6.9.12 adapter (all defaults), MySql.exe with input SQL file, and finally, the MariaDB MySqlImport.exe.
The server has no other applications running on it and there is plenty of free disk space. There is very little other network activity and the two machines are connected to gig-e ports in a switch.
The loads for all the MS Access methods are only inserting or updating around 33 records per second. The last C# attempt was even slower: 20 records per second. Before trying the MySqlImport, I assumed a network problem. However, I tried the following query in VBA (both ADODB and DAO) and in C#:
SELECT ResidentId, LastName, FirstName, EntryDate, ResidentStatus
FROM Residents INNER JOIN ResidentStatuses
ON Residents.ResidentStatusId=ResidentStatuses.ResidentStatusId;
This query took just over a tenth of a second in all the environments.
I then tried the following statement in VBA, C# and MySql.exe:
UPDATE residents SET lastname = concat(lastname,'_1');
This took over 500 seconds in VBA and C# but only one half second in MySql.
I then truncated the table and used MySqlImport (running on the CLIENT, with the text load file also on the client) and loaded the table. All 11,000 records took only 2 seconds to load. Therefore, I know this is not a network or disk I/O problem. Honestly, I didn’t expect good performance using ODBC but I wouldn’t have expected it to be this bad. What really surprised me was the C# insert/update performance. I figured using reasonably recent .Net drivers would be pretty fast. I would appreciate any suggestions.
Also, I really would like to avoid using ODBC if possible. Unfortunately, we have to be able to access the MariaDB databases from 32 bit Access 2010 as well as C#. The environment we are in is very much locked down so upgrading the OS or MS Office is out of the question. (I wouldn’t have chosen to install 32 bit Office on a 64 bit OS.) Obviously, the performance problem is the priority here, but I would also appreciate it if anyone could point me to some non-ODBC driver I can use to connect in Access VBA with ADODB.
Thanks in advance.

Here are the methods and stats used to insert the records:
1. mysqlimport -h85.85.18.99 -P3333 -L -v -udba -p ged c:\users\lab\documents\residents.txt
Time: 00:02.25 (4862 inserts/sec) Network usage: ?? Kbps
2. mysql –h85.85.18.99 –P3333 –udba –Dged –p < c:\users\lab\documents\residents.sql
Time: 04:46 (38 inserts/sec) Network usage: 65Kbps
3. C# 2012 with MySql .Net adapter 6.9.12 using dataadapter.update(datatable)
Time: 04:56 (36 inserts/sec) Network usage: 75Kbps
4. MS Access 2012 (32 bit) VBA DAO recordset (ODBC; MariaDB 3.0 ODBC Driver)
Time: 05:01 (35 inserts/sec) Network usage: 328Kbps
5. MS Access 2012 (32 bit) VBA ADODB recordset (ODBC; MariaDB 3.0 ODBC Driver)
Time 07:57 (23 inserts/sec) Network usage: 215Kbps

Cant Use Mysql namespace (1 reply)

$
0
0
Hi,
I use mysql8.0 and vs2013,when i use MySql.data.dll(Connector 8.0.13) and write using MySql.Data.MySqlClient; in my class. Vs show "cant find namespace MySql"

Is anyone meet the problem I met?

MySQL Connector 8.0.13 PowerShell .Parameters.AddWithValue() (no replies)

$
0
0
While using the MySql.Data.MySqlClient with the .Parameters.AddWithValue() for some odd reason the first argument of the AddWithValue is returned no matter what. So if you are creating a Function in PowerShell you MUST set some variable or $null to be equal to $oMySQLCommand.Parameters.AddWithValue() otherwise if you are depending on a return from the Function your value will be corrupted by the Argument being returned.

Oddly, it also does not return $false if the value is not found in the .CommandText() either so it seems to have no purpose whatsoever.

Example:
$oMySQLCommand = New-Object MySql.Data.MySqlClient.MySqlCommand
$oMySQLCommand.Connection = $oMySQLPrivilegedConnection
$oMySQLCommand.CommandText = $strMySQL_INSERT
# Must capture the .AddwithValue() else if within a Function and relying on the Return of the function you will be surprised.
$null = $oMySQLCommand.Parameters.AddWithValue("@employeeID", $employeeID)

Connector.Net 8.0.13 install failing (no replies)

$
0
0
Install of 8.0.13 Connector.Net failing consistently. I've tried both the standalone MSI installer, and the MySql Installer application. Originally I had Connector 6.7.4 (I think) installed, and was doing an "upgrade" to 8.0.13. With this failing consistently, I uninstalled the old version (a process that itself failed and I had to use a Microsoft tool to fix/force the uninstall). So am now doing an "add" of the new connector. The MSI fails "silently" and just finishes with a "fail" message. The Installer application gives a log (below) but it's not clear what's causing the failure.

This is running on Windows 8.0, with .Net Framework 4.6.1 installed.

I'm now stuck with NO connector installed, and a deadline looming! 8-( (Had to upgrade as installing app on a shared web host with a broken version of the .Net connector, so have to compile/ship a later version to override it...)

Log follows:
Action 19:38:43: INSTALL.
1: MySQL Connector Net 8.0.13 2: {3BB51C01-9368-4DEF-BBD2-44914AD372AD}
Action 19:38:43: FindRelatedProducts. Searching for related applications
Action 19:38:43: AppSearch. Searching for installed applications
Action 19:38:43: LaunchConditions. Evaluating launch conditions
Action 19:38:43: ValidateProductID.
Action 19:38:43: CostInitialize. Computing space requirements
Action 19:38:43: FileCost. Computing space requirements
Action 19:38:43: CostFinalize. Computing space requirements
Action 19:38:43: InstallValidate. Validating install
Min: 0 Max: 621
Position: 25
Position: 50
Position: 75
Position: 100
Position: 125
Position: 150
Position: 175
Position: 200
Position: 225
Position: 250
Position: 275
Position: 300
Position: 325
Position: 350
Position: 375
Position: 400
Position: 425
Position: 450
Position: 475
Position: 475
Action 19:38:43: Setv45InstallUtil.
Action 19:38:43: InstallInitialize.
Action 19:38:44: RemoveExistingProducts. Removing applications
Action 19:38:44: ProcessComponents. Updating component registration
Position: 475
Action 19:38:44: GenerateScript. Generating script operations for action:
Position: 476
Position: 477
Updating component registration
DoStep
Position: 478
Position: 479
Position: 480
Position: 481
Position: 482
Position: 483
Position: 484
Position: 485
Position: 486
Position: 487
Position: 488
Position: 489
Position: 490
Position: 491
Action 19:38:44: MsiUnpublishAssemblies. Unpublishing assembly information
Action 19:38:44: UnpublishFeatures. Unpublishing Product Features
Action 19:38:44: UninstallPerfCounterData.
Action 19:38:44: RemoveRegistryValues. Removing system registry values
Action 19:38:44: RemoveShortcuts. Removing shortcuts
Action 19:38:44: RemoveFiles. Removing files
Action 19:38:44: RemoveFolders. Removing folders
Action 19:38:44: CreateFolders. Creating folders
Folder: Creating folders
DoStep
Position: 492
Position: 493
Action 19:38:44: InstallFiles. Copying new files
File: Copying new files, Directory: , Size:
DoStep
Position: 494
Position: 495
Position: 496
Position: 497
Position: 498
Position: 499
Position: 500
Position: 501
Position: 502
Position: 503
Position: 504
Position: 505
Position: 506
Position: 507
Position: 508
Position: 509
Position: 510
Position: 511
Position: 512
Position: 513
Position: 514
Position: 515
Position: 516
Position: 517
Position: 518
Position: 519
Position: 520
Position: 521
Position: 522
Position: 523
Position: 524
Position: 525
Position: 526
Position: 527
Position: 528
Position: 529
Position: 530
Position: 531
Position: 532
Position: 533
Action 19:38:44: ManagedDataInstallSetup.
Action 19:38:44: ManagedDataInstall. Registering data provider in machine.config
Position: 534
Position: 535
Action 19:38:44: ManagedWebInstallSetup.

DoStep
Position: 536
Position: 537
Action 19:38:44: CreateShortcuts. Creating shortcuts
Shortcut: Creating shortcuts
DoStep
Position: 538
Position: 539
Position: 540
Position: 541
Position: 542
Position: 543
Action 19:38:44: WriteRegistryValues. Writing system registry values
Key: Writing system registry values, Name: , Value:
DoStep
Position: 544
Position: 545
Position: 546
Position: 547
Position: 548
Position: 549
Position: 550
Position: 551
Position: 552
Position: 553
Position: 554
Position: 555
Position: 556
Position: 557
Position: 558
Position: 559
Position: 560
Position: 561
Position: 562
Position: 563
Position: 564
Action 19:38:44: InstallPerfCounterData.
Action 19:38:45: RollbackRegisterPerfCounterData.

DoStep
Position: 565
Position: 566
Action 19:38:45: RegisterPerfCounterData.

DoStep
Position: 567
Position: 568
Action 19:38:45: RegisterUser. Registering user
Action 19:38:45: RegisterProduct. Registering product
Registering product
DoStep
Position: 569
Position: 570
Position: 571
Position: 572
Position: 573
Action 19:38:45: MsiPublishAssemblies. Publishing assembly information
Application Context:Publishing assembly information, Assembly Name:
DoStep
Position: 574
Position: 575
Position: 576
Position: 577
Action 19:38:45: PublishFeatures. Publishing Product Features
Feature: Publishing Product Features
DoStep
Position: 578
Position: 579
Position: 580
Position: 581
Position: 582
Action 19:38:45: PublishProduct. Publishing product information

DoStep
Position: 583
Position: 584
Position: 585
Position: 586
Position: 587
Position: 588
Position: 589
Position: 590
Action 19:38:45: InstallFinalize.
Min: 0 Max: 6809647
Position: 6809647
Action 19:38:45: ProcessComponents. Updating component registration
Step: 24000
Position: 0
Position: 0
Position: 0
Position: 0
Position: 0
Position: 0
Position: 0
Position: 0
Position: 0
Position: 0
Position: 0
Position: 0
Action 19:38:45: CreateFolders. Creating folders
Folder: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MySQL\MySQL Connector Net 8.0.13\
DoStep
Action 19:38:45: InstallFiles. Copying new files
File: CHANGES, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\, Size: 12125
Position: 12125
File: Google.Protobuf.dll, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 294400
Position: 306525
File: Google.Protobuf.dll, Directory: , Size: 294400
Position: 600925
File: License, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\, Size: 99998
Position: 700923
File: MySQL.Data.EntityFrameworkCore.Design.xml, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 162
Position: 701085
File: MySQL.Data.EntityFrameworkCore.dll, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 62464
Position: 763549
File: MySQL.Data.EntityFrameworkCore.xml, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 15529
Position: 779078
File: MySQL.Data.EntityFrameworkCore.Design.dll, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 24064
Position: 803142
File: MySql.Data.EntityFramework.dll, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 393728
Position: 1196870
File: MySql.Data.EntityFramework.xml, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 21256
Position: 1218126
File: MySql.Data.dll, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 709632
Position: 1927758
File: MySql.Data.dll, Directory: , Size: 709632
Position: 2637390
File: MySql.Data.xml, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 823007
Position: 3460397
File: MySql.Web.dll, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 162304
Position: 3622701
File: MySql.Web.xml, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\Assemblies\v4.5.2\, Size: 101005
Position: 3723706
File: MySql.Web.dll, Directory: , Size: 162304
Position: 3886010
File: README, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\, Size: 672
Position: 3886682
File: Release Notes.txt, Directory: C:\Program Files (x86)\MySQL\Connector NET 8.0\, Size: 1029
Position: 3887711
Action 19:38:46: ManagedDataInstall. Registering data provider in machine.config
Action 19:38:46: ManagedWebInstallSetup.
Action 19:38:47: Rollback. Rolling back action:
Min: 0 Max: 43
ManagedWebInstallSetup
DoStep
Position: -1
Position: -2
Registering data provider in machine.config
DoStep
Position: -3
Copying new files
DoStep
Position: -4
Position: -5
Position: -6
Position: -7
Position: -8
Position: -9
Position: -10
Position: -11
Position: -12
Position: -13
Position: -14
Position: -15
Position: -16
Position: -17
Position: -18
Position: -19
Position: -20
Position: -21
Position: -22
Position: -23
Position: -24
Position: -25
Position: -26
Position: -27
Position: -28
Creating folders
DoStep
Position: -29
Position: -30
Updating component registration
DoStep
Position: -31
Position: -32
Position: -33
Position: -34
Position: -35
Position: -36
Position: -37
Position: -38
Position: -39
Position: -40
Position: -41
Position: -42
Position: -43
1: MySQL Connector Net 8.0.13 2: {3BB51C01-9368-4DEF-BBD2-44914AD372AD} 3: 3

Any assistance very gratefully received!

Exception: Authentication to host for user using method mysql_native_password failed with message: Reading from the stream has failed (1 reply)

$
0
0
Greetings,

We have a domestic .Net application running at Windows hosts and working with a Centos host with 5.7.19 MySQL DB.
The .Net Connector is 6.8.3.

Occasionally, in various hours of a day, and not every day, the application logs the
"Exception: Authentication to host <myhost> for user <myuser> using method mysql_native_password failed with message: Reading from the stream has failed" messages.

Full message stack is below.

What could be the reason and how to resolve/avoid/workaround the problem ?

Best regards and looking forward the community assistance
Avi Vainshtein

========================
FailedToSaveTibcoCallRecord(Failed to save the Tibco call record.) Connection Settings: defaultTibcoConnection Message Settings: OrderDetailesDataBatch Message: Failed to save the Tibco call record. Exception: Authentication to host &apos;<myhost>&apos; for user &apos;<myuser>&apos; using method &apos;mysql_native_password&apos; failed with message: Reading from the stream has failed. MySql.Data at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex) at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket() at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset) at MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset) at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at Cm.TibcoCore.TibcoUtils.CreateConnection(IDatabaseOperator dbOperator, Boolean open) in D:\TfsBuilds\CM\CmProd1\3\s\CM\Cm.TibcoCore\TibcoUtils.cs:line 545 at Cm.TibcoCore.Persistency.PersistencyDataRecord.Save(TibcoPersistencyManagerSettings persistencyManagerSettings, AdditionalColumn[] additionalColumns, IDatabaseOperator dbOperator, Boolean force) in D:\TfsBuilds\CM\CmProd1\3\s\CM\Cm.TibcoCore\Persistency\PersistencyDataRecord.cs:line 414 at Cm.TibcoCore.Persistency.TibcoPersistencyManager.SaveCallRecord(TibcoCallRecord record, TibcoMessageExtractedField[] additionalFields, Exception[] extractedRequestFieldsExceptions, Exception[] extractedResponseFieldsExceptions) in D:\TfsBuilds\CM\CmProd1\3\s\CM\Cm.TibcoCore\Persistency\TibcoPersistencyManager.cs:line 391 at Cm.TibcoCore.Listener.TibcoListenerHandlerBase.HandleMessage(TibcoListenerHandlerArgs args) in D:\TfsBuilds\CM\CmProd1\3\s\CM\Cm.TibcoCore\Listener\TibcoListenerHandlerBase.cs:line 437 0x80004005 Reading from the stream has failed. MySql.Data at MySql.Data.MySqlClient.MySqlStream.LoadPacket() at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket() 0x80004005 Attempted to read past the end of the stream. MySql.Data at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlStream.LoadPacket() 0x80070026 Request XML: 500000005 GMJ161 NBI 208 1 Y 828673060 1 Y Response XML: 500000005 GMJ161 NBI 208 0 3 3 No find orders

Coercion exception with Entity Framework connector (no replies)

$
0
0
Since upgrading to MySQL 8.0.13 (from 5.7.x) I've been getting the following exception when using the LINQ .Select() method on a EF DbSet:

No coercion operator is defined between types 'System.Int16' and 'System.Boolean'.
at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
at System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method)
at System.Linq.Expressions.Expression.Convert(Expression expression, Type type)
at Microsoft.EntityFrameworkCore.Storage.TypedRelationalValueBufferFactoryFactory.CreateGetValueExpression(Expression dataReaderExpression, Expression indexExpression, TypeMaterializationInfo materializationInfo, Boolean box)
at Microsoft.EntityFrameworkCore.Storage.TypedRelationalValueBufferFactoryFactory.<>c.<CreateArrayInitializer>b__12_0(TypeMaterializationInfo mi, Int32 i)
at System.Linq.Enumerable.SelectIterator[TSource,TResult](IEnumerable`1 source, Func`3 selector)+MoveNext()
at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at System.Dynamic.Utils.CollectionExtensions.ToReadOnly[T](IEnumerable`1 enumerable)
at System.Linq.Expressions.Expression.NewArrayInit(Type type, IEnumerable`1 initializers)
at Microsoft.EntityFrameworkCore.Storage.TypedRelationalValueBufferFactoryFactory.CreateArrayInitializer(CacheKey cacheKey)
at Microsoft.EntityFrameworkCore.Storage.TypedRelationalValueBufferFactoryFactory.<Create>b__10_0(CacheKey k)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.EntityFrameworkCore.Storage.TypedRelationalValueBufferFactoryFactory.Create(IReadOnlyList`1 types)
at Microsoft.EntityFrameworkCore.Query.Sql.DefaultQuerySqlGenerator.CreateValueBufferFactory(IRelationalValueBufferFactoryFactory relationalValueBufferFactoryFactory, DbDataReader dataReader)
at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.<NotifyReaderCreated>b__14_0(FactoryAndReader s)
at Microsoft.EntityFrameworkCore.Internal.NonCapturingLazyInitializer.EnsureInitialized[TParam,TValue](TValue& target, TParam param, Func`2 valueFactory)
at Microsoft.EntityFrameworkCore.Query.Internal.ShaperCommandContext.NotifyReaderCreated(DbDataReader dataReader)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at TAP.Services.TourManagementService.GetReviews(String tourId, IEnumerable`1 fields) in C:\Projects\TheAdventurePeople\TAP.Services\TAP.Services\Services\TourManagementService.cs:line 322

The database type for the boolean field being selected is TINYINT(1) and I have also tried BIT(1) but for some reason it's being mapped to an Int16.

Can anyone help me out here? Is there some configuration I need to change for MySQL Server 8?

mysql database on lan (no replies)

$
0
0
Mysql database not access in lan.I am using mysql 5.7. The error is Mysql.data.MysqlClient.MysqlException(0x80004005). Unable to connect to any of the specified mysql hosts.I am using .net for Mysql.

Packets larger than max_allowed_packet are not allowed (no replies)

$
0
0
We are having several problems with this error:

Packets larger than max_allowed_packet are not allowed

Each time we see this error in our websites we have to restart de MySql Service.

Our software is developed in .Net 3.5 with the last mysql connector.
We have increased the max_allowed_packet=1G in the my.ini [mysqld] and checked if it really has this value with the show variables like 'max_allowed_packet'; query. It's still happening.

We don't have blobs, images and anything on our database big enoguh to to reach this value. The biggest value in our database is just 210K and we don't do almost inner join queries.

What should we do? We've tried everything... even adding the the max_allowed_packet=100M to the [mysql] section.

Why is this still happening?

Many thanks

MySQL deleting all recent inserts in all tables (5 replies)

$
0
0
Hi, We have been running version 5.7.17 Community Server for over 3 years now without a single problem. Today something terrible occurred. Our applications had inserted several rows into different tables. At one point, several hours later, all records that had been inserted during the day disappeared. All gone!

Nothing happened to the records that had been inserted yesterday.
Is this documented? Is there anything that I can do?
Everybody at the office will lose faith in our databases.

Please advice if you are so kind.

SocketException : Only one usage of each socket address (protocol/network address/port) is normally permitted (no replies)

$
0
0
I am facing the following error intermittently for my web application. We are using MySql.Data.dll version 6.9.8 and MySqlConnection class.

Error Stack Trace:
MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted XXX:XXX:XX:XX:3306
at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
at MySql.Data.Common.MyNetworkStream.CreateSocketStream(MySqlConnectionStringBuilder settings, IPAddress ip, Boolean unix)
at MySql.Data.Common.MyNetworkStream.CreateStream(MySqlConnectionStringBuilder settings, Boolean unix)
at MySql.Data.Common.StreamCreator.GetStream(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool..ctor(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPoolManager.GetPool(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlConnection.Open()

Connection String Used :
<connstring encrypted="true"> Server=XXXX;Database=XXX;Uid=XXX;Pwd=XXX;Pooling=true;MinimumPoolSize=1;maximumpoolsize=50;ConnectionLifeTime=0;default command timeout=1200;Allow User Variables=True</connstring>

We have already tried changing the max/min pool size but with no results. The issue reoccurs.

Any help will be highly appreciated. I am totally stuck here. Unable to find relevant answers online for this socket exception error.

Thanks.

Fatal error on query (no replies)

$
0
0
Hi there, maybe the problem is just stupid, but still i need a help...

I have MySQL installed (don't know what version) installed on a Intel i5 with 8 GB of RAM, with XAMPP control panel 3.2.2 and I use the MySQL Connector with VB.NET to make applications and share the databases with PHP for web. My problem is, every time I create a query that is different from all others before that one, and I run in on any software created in VB.NET i got a "Fatal Error" while running! But, if I run the same query before or after any test on VB.NET in PHPMyAdmin, and the query is OK and don't have errors, and return what is expected, if I run the VB.NET program again, it runs with no error at all... is there any explanation for that? any way to solve this?

thanks in advance!

MySQL Connector/NET 8.0.14 has been released (no replies)

ADODB connection to local (no replies)

$
0
0
I currently have my vba code connecting to the "overview" DB on the network. However, I have a copy of it on my local drive and I want to connect to it instead. What do I need to change in the below code to do that?

objConnection.Open "overview"
objRecordSet.Open stStoreMaxHoursQuery, objConnection

ExecSQL (no replies)

$
0
0
Why do I get a 'can't perform operation on a closed dataset' error on the following code?????

qRptStuff2 := TFDQuery.Create( AConnection );
with qRptStuff2 do
begin
Connection := AConnection;
SQL.Add( 'Insert into RptStuff2 (DateA,IntA,FloatA,StrA) values (:D,:I,:R,:DD)' );
ParamByName('D').AsDate := dDate;
ParamByName('I').AsInteger := InvDay;
ParamByName('R').AsFloat := RevDay;
ParamByName('DD').AsString := DateToStr( dDate );
ExecSQL;

Access denied for user 'root'@'localhost' (using password: YES) (no replies)

$
0
0
All: I am trying to scaffold am entity framework core dbcontext using the Pomelo provider for mysql. I keep getting the following error:

Access denied for user 'root'@'localhost' (using password: YES)

I've confirmed the user and password is correct via the MySql command line tool and can login there no problem. I am new to MySql so I'm not sure why this issue is happening. The dotnet cli command I'm executing is this:

dotnet ef dbcontext scaffold "server=localhost;database=moxi;user=root;pwd=xxxxx;" "Pomelo.EntityFrameworkCore.MySql" -o .\Models -f

I've been fighting with this for two days...any ideas?

MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command execution. (no replies)

$
0
0
I have been having the following error message that randomly appears. Most of the time it works, but it appears that some times it give me this fatal error. It appears to be random, it will work fine for some queries then that same query fails the next time it runs.
I have done some investigating and have tried to increase the connection timeouts and command timeouts, Yet on some machines this happens randomly.

Any suggestions on how to fix these errors.


The following Excpetion was caught:

Fatal error encountered during command execution. MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered during command execution. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Fatal error encountered attempting to read the resultset. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Reading from the stream has failed. ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count) at MySql.Data.MySqlClient.MySqlStream.LoadPacket() at MySql.Data.MySqlClient.MySqlStream.LoadPacket() at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at Launcher.LodgeDocument.uploadDocument(Int32 selectedRow) in C:\source\repos\Launcher\Launcher\LodgeDocument.cs:line 209 at Launcher.LodgeDocument.dgDocumentView_CellDoubleClick(Object sender, DataGridViewCellEventArgs e) in C:\source\repos\Launcher\Launcher\LodgeDocument.cs:line 147

Related Code for above error:

public void UploadNewFile(int RecID, string FileName, string Username, DateTime timenow)
{
using (MySqlCommand cmd = new MySqlCommand())
{
cmd.CommandText = "UPDATE t_doclodgement " +
"SET LodgedBy = @newlodgedBy, " +
"LodgeDateTime = @newlodgeDateTime, " +
"DocFileName = @newDocFileName " +
"WHERE RecID = @RecID ";

cmd.Parameters.AddWithValue("@RecID", RecID);
cmd.Parameters.AddWithValue("@newlodgedBy", Username);
cmd.Parameters.AddWithValue("@newlodgeDateTime", timenow);
cmd.Parameters.AddWithValue("@newDocFileName", FileName);

try
{
ExectueCMD(cmd);
}
catch (MySqlException e)
{
throw (e);

}
}
}




protected bool ExectueCMD(MySqlCommand cmd)
{
int attempt = 0;
bool complete = false;
while (!complete)
{
try
{
using (MySqlConnection connection = OpenConnection(conn_string))
{
cmd.Connection = connection;
cmd.CommandTimeout = 60;
cmd.ExecuteNonQuery();

}
Console.WriteLine("Connection Closed\n");
complete = true;
}
catch (MySqlException e)
{
if (attempt >= 3)
throw e;
else
attempt++;
}
}
return complete;
}

syntax to use near 'xxx= @@IDENTITY' (no replies)

$
0
0
Why output param @Id is replaced by Null ?
My Code:
try
{
string connetStr = "data source=127.0.0.1;database=Test; uid=root;pwd=root;Allow User Variables=True;";
MySqlConnection conn = new MySqlConnection(connetStr);
conn.Open();
string sql =
@"INSERT T_Test_Table
(
Name
)
VALUES
(
@Name -- Name - nvarchar(50)
);
SET @Id = @@IDENTITY";
MySqlCommand cmd = new MySqlCommand(sql, conn);
MySqlParameter mpName = new MySqlParameter("Name", MySqlDbType.VarChar, 50);
mpName.Value = "Tests";
mpName.Direction = ParameterDirection.Input;
MySqlParameter mpId = new MySqlParameter("@Id", MySqlDbType.Int32);
mpId.Direction = ParameterDirection.Output;
cmd.Parameters.Add(mpName);
cmd.Parameters.Add(mpId);
int iRes = cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
throw new Exception("Mysql ExecuteNonQuery Error:\r\n" + ex.Message, ex);
}

MySQL Connector/NET 8.0.16 has been released (no replies)

mysql-connector-net-6.9.12 Performance Issue when Calling Procedure (no replies)

$
0
0
I found mysql connetor/NET using a inefficient way when running procedures.

1. Reproduce:
Here is C# snippt where calling procedure:

MySqlConnection conn = new MySqlConnection();
conn.ConnectionString = "server=localhost;user=root;database=test;port=3306;password=******";
MySqlCommand cmd = new MySqlCommand();
conn.Open();
cmd.Connection = conn;
cmd.CommandText = "test_proc";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@param_1", "test");
cmd.Parameters["@param_1"].Direction = ParameterDirection.Input;
cmd.ExecuteNonQuery();


2. Problem:
Connector/NET went with a SQL below
SELECT *
FROM mysql.proc
WHERE 1 = 1
AND db LIKE 'xxxx'
AND NAME LIKE 'xxxxx'

This SQL uses range scanning and most of rows in mysql.proc are scanned.


3. Suggestion:

Can we just use SQL below instead?
SELECT *
FROM mysql.proc
WHERE 1 = 1
AND db = 'xxxx'
AND NAME = 'xxxxx'

This SQL uses ref scanning and the only matched row is scanned. In my test, it's 10 times faster than using 'Like'.

Getting the ID of a newly added record (C#) (no replies)

$
0
0
Hello! In PHP you can simply call mysqli_insert_id() and get the ID of the last record created.

How can you do something similar with C#/.NET?
Viewing all 1447 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>