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

SQLCommand Text Question (no replies)

$
0
0
Is there a limit as to the length a SQLsommandtext can be ?

I keep getting the error: Fatal error encountered during command execution.
I'm connecting to a Mysql 5.6 db from powershell 2.0 on win 7.
I'm trying to load MS DHCP audit logs in a database.

If I shorten the SQL statement it works.
Here is the statement that causes the error:


$sql = "load data infile $sqlfullpath into table audit_rec FIELDS TERMINATED BY ',' IGNORE 33 LINES " + `
"(rec_code, @daterec, rec_time, Rec_description, rec_ip_addr, rec_hostname, rec_mac, rec_user, " + `
"rec_trans_id, rec_Qresult, rec_probationtime, rec_correlation_id, rec_dhcid) " + `
"SET rec_date = str_to_date(@daterec, '%m/%d/%y')"

$command.ExecuteNonQuery()

##### $sqlfullpath is the full path to the dhcp audit log file with '\\' bwetween folder names.


Now I have tried this command in workbench and it works like a charm. Loads all the records correctly. Just trying to do this in powershell to read multiple files and import them. Processing one file at a time.

Thanks

[SOLVED] MySqlException in C# project (2 replies)

$
0
0
Hello all,

I'm encountering a problem using the version 6.1.6 of the SqlConnector/NET.

When I try to catch an Exception for example when trying to establish the connection with the Database, the "MySqlException" objet I create in the catch condition isn't available.

try
{
    Connection.Open();
    return true;
}
catch (MySqlException ex)
{

The message that I get is that the MySqlException class isn't "derived" from the System.Exception class.
When I take a look in the object browser in VS 2010, I see the class is derived from " System.Data.Common.DbException".

Can someone tell me how to go trough it ? When I try to access the "System.Data..." with my using, nothing is listed.

Any ideas ?

Thanks for all the advises you can provide.

Raph

Multiple Simultaenous Connections (1 reply)

MySQL Connector/Net 6.7.2 Beta has been released (no replies)

$
0
0
MySQL Connector/Net 6.7.2, a new version of the all-managed .NET driver for MySQL has been released. This is the first beta release intended to introduce users to the new features in the release. This release is feature complete, it should be stable enough for users to understand the new features and how we expect them to work. As is the case with all non-GA releases, it should not be used in any production environment. It is appropriate for use with MySQL server versions 5.0-5.7.

It is now available in source and binary form from http://dev.mysql.com/downloads/connector/net/#downloads and mirror sites (note that not all mirror sites may be up to date at this point-if you can't find this version on some mirror, please try again later or choose another download site.)

The 6.7 version of MySQL Connector/Net brings the following new features:
- WinRT Connector.
- Load Balancing support.
- Entity Framework 5.0 support.
- Memcached support for Innodb Memcached plugin.
- This version also splits the product in two: from now on, starting version 6.7, Connector/NET will include only the former Connector/NET ADO.NET driver, Entity Framework and ASP.NET providers (Core libraries of MySql.Data, MySql.Data.Entity & MySql.Web). While all the former product Visual Studio integration (Design support, Intellisense, Debugger) will be released in a separated plugin for Visual Studio product.


WinRT Connector
-------------------------------------------
The major feature introduced in this Beta. Now you can write MySql data access apps in Windows Runtime (aka Store Apps) using the familiar API of Connector/NET for .NET.
The following features are supported:
- Open a connection using most of the connection string attributes: (database, pooling, user variables, etc)
- Execute queries using MySqlDataReader: it can execute queries and show commands
- Execute non queries: it can execute DML statements: Insert, delete, update
- Change database
- Password expiration
- Basic connection attributes (connector name and operating system only)
- Authentication plugins (mysql native password only)
- Connections pool
- Connection clone
- Connection timeout
- Abort connection
- Ping

Features not supported in this release:
- Authentication with other protocols than native mysql (specifically sha256 & windows integrated security).
- SSL encryption for connections.

Known issues:
- Due to indeterministic RT Garbage Collection, is better to explicitely call Close/Dispose on a connection than setting reference to null.

Other features not planned to be supported:
- MySqlCommandBuilder
- Entity Framework
- ASP.NET Providers.


Load Balancing Support
-------------------------------------------
Now you can setup a Replication or Cluster configuration in the backend, and Connector/NET will balance the load of queries among all servers making up the backend topology.

Entity Framework 5.0
-------------------------------------------
Connector/NET is now compatible with EF 5, including special features of EF 5 like spatial types.

Memcached
-------------------------------------------
Just setup Innodb memcached plugin and use Connector/NET new APIs to establish a client to MySql 5.6 server's memcached daemon.


Enjoy and thanks for the support!

How to use UTF16 with .net (4 replies)

$
0
0
when I change a table and fields to utf16,I cann't get data by MySqlDataAdapter.
I test in default sample: Connector NET 6.6.5\Samples\Table Editor\cs,it's same question.

this is samples code:

data = new DataTable();
da = new MySqlDataAdapter("SELECT * FROM " + tables.SelectedItem.ToString(), conn);
cb = new MySqlCommandBuilder(da);
da.Fill(data); //error:long time no response

test database:sakila
Mysql version:5.6.11

anyone help me!

MySQL and C#.Net Stored Procedure and multiple parameter (1 reply)

$
0
0
I am developing (converting application db from MS SQL to MySQL) an application using C#.Net and MySQL. My C# code and stored procedure is working perfect in MS SQL but when trying to ingrate with MySQL getting parameter error. My C# Code is as below and MySQL Stored Procedure is running perfectly (tested in editor using CALL key work and parameter)

public DataTable AlapValidateUser(string email, string password,string Type)
{
DataTable dt = new DataTable();
cmd = new MySqlCommand("UserIdValidation");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = cnn;
string pass = reEncryptpassword(password);

MySqlParameter pramEmail = new MySqlParameter("@v_emailId", email);
pramEmail.Direction = ParameterDirection.Input;
cmd.Parameters.Add(pramEmail);

MySqlParameter pramPassword = new MySqlParameter("@v_password", pass);
pramPassword.Direction = ParameterDirection.Input;
cmd.Parameters.Add(pramPassword);

MySqlDataAdapter adap = new MySqlDataAdapter(cmd);
if (cnn.State != ConnectionState.Open ||
cnn.State == ConnectionState.Broken ||
cnn.State != ConnectionState.Connecting ||
cnn.State != ConnectionState.Executing ||
cnn.State != ConnectionState.Fetching)
cnn.Open();

adap.Fill(dt);
cnn.Close();
return dt;
}
MySQL Stored Procedure is here:

CREATE DEFINER=`root`@`localhost` PROCEDURE `UserIdValidation`(v_emailId NATIONAL VARCHAR(100),v_password
NATIONAL VARCHAR(50))
BEGIN
SELECT UserId ,eMail,BloodGroup
,BloodGroupID,Country AS CountrySlNo ,CountryName ,State ,District
,Location,fName,lName ,DonorType ,LastLogIn ,Validated ,ProfileImage
,MaritalStatus ,Sex ,Height ,Weight ,HealthStatus
,MyFileLocation FROM vwUser WHERE eMail = v_emailId AND
PASSWORD = v_password AND Validated = 'Y';
END$$
During execution exception as below:

"Incorrect number of arguments for PROCEDURE alap.UserIdValidation; expected 2, got 1"

Already I have tried by changing parameter entry by below code:

cmd.Parameters.Add(new MySqlParameter("@v_emailId", email)); cmd.Parameters.Add(new MySqlParameter("@v_password", pass));

and @ with ? and without @ or ? but nothing works.


Can you please help me to find out the error. Is it a bug of mysql connector?

UPDATE: My MySQL connector is v.6.6.5. I have checked in debug mode in C# parameter is correct and can see both paramter in command object. Next it is trying to filling Adapter hence this command object is passing to MySQL from Connector and there paramter is missing. I have tried to add same 1st parameter by creating 3rd line then gettinng error that same paramter already exist.
From this test I am sure it is purely MySQL or mysql connector bug.
I dont know how this bug can exists in such DB where so many people is using mysql.

Thanks Suman

como puedo crear el instalador de mi base de datos. (1 reply)

$
0
0
Hola he desarrollado mi primera aplicacion en .net con conexion a base de datos mysql en localhost.

Y necesito crear el instalador del aplicativo para que funcione en cualquier equipo para ser distribuido.

Lo empece a crear pero no se como hacer para que el aplicativo instale la base de datos en el equipo donde se ejecute el instalador para asi poderme conectar a ella y que funcione mi aplicativo que se conecta a la base de datos en localhost

alguien sabe como puedo crear el instalador para la base de datos y que asi funcione el aplicativo

Muchas Gracias

Getting the error “A socket operation was attempted to an unreachable network” inconsistently in ASP.NET 4.0 Web App (1 reply)

$
0
0
I am getting the error "A socket operation was attempted to an unreachable network" inconsistently in ASP.NET 4.0 Web App only when Web App is hosted on "Windows Server 2008 R2 SP1 - 64-bit" machine. My Web App uses:

1. ASP.NET 4.0
2. Entity Framework
3. MySql Server 5.0
4. MySql Connector 6.6.5

The same App works well on "Windows Server 2003 R2 - 64-bit" machine. Please suggest some solution to this. Be noted that, it is able to connect to MySql but It's connection behavior is flaky i.e. it breaks with the said error randomly but not always.

Thanks,

Zaheer

Can't install Connector 6.6.5 (1 reply)

$
0
0
My system is Win7 64bit, and already installed Microsoft Visual Studio 2012 professional.

The first time I install 6.6.5, it failed, and I gooled a little , removed .net framework4.5 and reinstall it , the setup process seems move a little forward.

Here is the log:
Action 9:56:05: VS11_UpdatePackageFile.
SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSI4083.tmp-\
SFXCA: Binding to CLR version v2.0.50727
Calling custom action MySql.ConnectorInstaller!MySql.ConnectorInstaller.CustomActions.UpdateFlagPackagesFileForVS2012
Error: could not load custom action class MySql.ConnectorInstaller.CustomActions from assembly: MySql.ConnectorInstaller
System.BadImageFormatException: Could not load file or assembly 'MySql.ConnectorInstaller' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'MySql.ConnectorInstaller'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.AppDomain.Load(String assemblyString)
at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod(Session session, String assemblyName, String className, String methodName)

WRN: Assembly binding logging is turned OFF.

I only paste the exception part , can anybody give me any suggestion? Thanks a lot .

MySQL .NET Connector Not Showing On Visual Studio 2012 Database Explorer (1 reply)

$
0
0
I'm running Windows 8 x64 with Microsoft Visual Studio 2012 Express. I'm wanting to use the MySQL .NET Connector 6.6.5 to connect to a MySQL Server running 5.6.11.

Currently I can access and connect to the MySQL Server fine via code. But, when I try to browse the database via the Database Explorer; I'm not show the option to Choose MySQL as a datasource.

Any ideas why ?

Can not uninstall .NET Connector 6.7.2 (RemoveProfileProvider fault?) (1 reply)

$
0
0
Suddenly my EF/MVC/MySQL Visual Studio 2012 project stopped working (Windows 7), EDMX designer is crashing with message "The specified store provider cannot be found in the configuration, or is not valid."

I decided to uninstall Connector, but I can not. NET Connector 6.7.2. MSI starts, then before finishing it rolls back the action.

MSI log says (full log here: http://pastebin.com/Tpyc5LeU):

MSI (s) (B0:24) [00:29:08:265]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI3F51.tmp, Entrypoint: CAQuietExec
CAQuietExec: Entering CAQuietExec in C:\Windows\Installer\MSI3F51.tmp, version 3.7.1224.0
CAQuietExec: "C:\Windows\Microsoft.NET\Framework\v4.0.30319\installUtil.exe" /LogToConsole=false /LogFile= /u "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.7.2\Assemblies\v2.0\MySql.Web.dll"
CAQuietExec: Copyright (c) Microsoft Corporation. All rights reserved.
CAQuietExec:
CAQuietExec: (Exception message in Polish)
CAQuietExec: Error 0xffffffff: Command line returned an error.
CAQuietExec: Error 0xffffffff: CAQuietExec Failed
CustomAction ManagedWebUnInstall returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 00:29:08: InstallFinalize. Return value 3.
MSI (s) (B0:74) [00:29:08:553]: User policy value 'DisableRollback' is 0
MSI (s) (B0:74) [00:29:08:553]: Machine policy value 'DisableRollback' is 0
MSI (s) (B0:74) [00:29:08:555]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1119617956,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
MSI (s) (B0:74) [00:29:08:555]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (B0:74) [00:29:08:555]: Executing op: DialogInfo(Type=1,Argument=MySQL Connector Net 6.7.2)
MSI (s) (B0:74) [00:29:08:556]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (B0:74) [00:29:08:556]: Executing op: RegisterBackupFile(File=C:\Config.Msi\49b90a.rbf)
MSI (s) (B0:74) [00:29:08:556]: Executing op: RegisterBackupFile(File=C:\Config.Msi\49b90b.rbf)
MSI (s) (B0:74) [00:29:08:556]: Executing op: RegisterBackupFile(File=C:\Config.Msi\49b90c.rbf)
Action 00:29:08: Rollback. Rolling back action:
Rollback: Unregistering web providers from machine.config
MSI (s) (B0:74) [00:29:08:557]: Executing op: ActionStart(Name=ManagedWebUnInstall,Description=Unregistering web providers from machine.config,)
MSI (s) (B0:74) [00:29:08:558]: Executing op: ProductInfo(ProductKey={9E445D51-ABC8-4013-9019-ED2F7E8170E5},ProductName=MySQL Connector Net 6.7.2,PackageName=mysql-connector-net-6.7.2.msi,Language=1033,Version=101122050,Assignment=1,ObsoleteArg=0,,,PackageCode={BBFF6854-46EA-4FC3-9B65-F4654087FA13},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=2)
Rollback: Unregistering data provider from machine.config

So I ran "C:\Windows\Microsoft.NET\Framework\v4.0.30319\installUtil.exe" /LogToConsole=false /LogFile=c:\log_a.txt /u "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.7.2\Assemblies\v2.0\MySql.Web.dll"

Got:

Odinstalowywanie zestawu 'C:\Program Files (x86)\MySQL\MySQL Connector Net 6.7.2\Assemblies\v2.0\MySql.Web.dll'.
Uwzględnione parametry to:
logtoconsole = false
logfile = c:\log_a.txt
assemblypath = C:\Program Files (x86)\MySQL\MySQL Connector Net 6.7.2\Assemblies\v2.0\MySql.Web.dll
Podczas dezinstalacji instalatora MySql.Web.Security.CustomInstaller wystąpił wyjątek.
System.NullReferenceException: Odwołanie do obiektu nie zostało ustawione na wystąpienie obiektu.

Basically it got System.NullReferenceException.

So I've debugged it using VS2012 and intercepted the exception:

Exception: System.NullReferenceException
Source: MySql.Web
StackTrace: in MySql.Web.Security.CustomInstaller.RemoveProfileProvider(XmlDocument doc)

I did remove all MySQL related entries from all of my machine.configs, but still no luck and I'm stuck.

Any idea where to go now?

Can uninstall or repair mysql connector - HELP (4 replies)

$
0
0
Hi guys
I installed MySQL connector on a windows server and was advised to reinstall an earlier version.

So I tried to uninstall it, but could not, it remove all the components. It keeps saying MySQL has encountered a fatal error and rollsback. However the program still remains and I can reinstall or use it.

I haven't used MySQL much as I have used Microsoft applications.

In the bid to remove it, I noticed I have 3 services under the services app, and only one is running the others cant be started

We are trying to install joomla on windows, hence reason for MySQL on the server.
Please advise

see attachment

many thanks
Ehi

Create mysql database using mysql command (1 reply)

$
0
0
I am having a problem when trying to create a database using mysql command. The code i am using is;

using (MySqlConnection con = connect_db())
{
con.Open();

MySqlCommand cmd = new MySqlCommand("CREATE DATABASE @name;", con);

cmd.Parameters.AddWithValue("@name", "fancydb");

try
{
cmd.ExecuteNonQuery();
}
catch (Exception exc)
{
return;
}
cmd.Dispose();
con.Close();
con.Dispose();
}

When i try to run this code i always get an error saying that i have an error in mysql syntax near "fancydb"...but when I put the name in the command like: "CREATE DATABASE facnydb;" it works. Can anyone explain to me why is the error only happening when i try and use parameters?

MySql Connector/NET 6.7.3 Beta 2 has been released (no replies)

$
0
0
MySQL Connector/Net 6.7.3, a new version of the all-managed .NET driver for MySQL has been released. This is the second beta release intended to introduce users to the new features in the release. This release is feature complete, it should be stable enough for users to understand the new features and how we expect them to work. As is the case with all non-GA releases, it should not be used in any production environment. It is appropriate for use with MySQL server versions 5.0-5.7.

It is now available in source and binary form from http://dev.mysql.com/downloads/connector/net/#downloads and mirror sites (note that not all mirror sites may be up to date at this point-if you can't find this version on some mirror, please try again later or choose another download site.)

The 6.7 version of MySQL Connector/Net brings the following new features:
WinRT Connector.
Load Balancing support.
Entity Framework 5.0 support.
Memcached support for Innodb Memcached plugin.
This version also splits the product in two: from now on, starting version 6.7, Connector/NET will include only the former Connector/NET ADO.NET driver, Entity Framework and ASP.NET providers (Core libraries of MySql.Data, MySql.Data.Entity & MySql.Web). While all the former product Visual Studio integration (Design support, Intellisense, Debugger) will be released in a separated plugin for Visual Studio product.

WinRT Connector
-------------------------------------------
The major feature introduced in this Beta. Now you can write MySql data access apps in Windows Runtime (aka Store Apps) using the familiar API of Connector/NET for .NET.
The supported classes MySqlConnection, MySqlCommand, MySqlDataReader, MySqlScript, MySqlTransaction, MySqlParameter, MySqlConnectionStringBuilder and support classes.
Features added in this release are Transactions, Blob types, All parameter types, script execution, & access control for stored routines.

Features not supported in this release:
- Authentication with other protocols than native mysql (specifically sha256 & windows integrated security).
- SSL encryption for connections.

Known issues:
- Due to indeterministic RT Garbage Collection, is better to explicitly call Close/Dispose on a connection than setting reference to null.

Other features not planned to be supported:
- MySqlCommandBuilder
- Entity Framework
- ASP.NET Providers.


Load Balancing Support
-------------------------------------------
Now you can setup a Replication or Cluster configuration in the backend, and Connector/NET will balance the load of queries among all servers making up the backend topology.

Entity Framework 5.0
-------------------------------------------
Connector/NET is now compatible with EF 5, including special features of EF 5 like spatial types.

Memcached
-------------------------------------------
Just setup Innodb memcached plugin and use Connector/NET new APIs to establish a client to MySql 5.6 server's memcached daemon.

Bug fixes included in this release:
- Fix for bug in Replication & load balancing (Oracle bug #16762427)
- Added support for Entity Framework 5.0 when using .net 4.0, including Code First Migrations (WorkItem #228).
- Fix for bug Readme and licence files are not updated with "2013" text (Oracle bug # 16630533).
- Fix for bug Dbupdateexception saving changes (Oracle bug # 16494585).



Enjoy and thanks for the support!

How do I create a new database and then restrict access to a particular user. (Programmatically, of course.) (no replies)

$
0
0
I am using C#/.NET connectors to MySQL. I am trying to create a new database programmatically. It appears that I need 'admin' privileges to create a new database. How do I then restrict access to that new DB to a particular UserID/Password pair? [Programmatically, of course.]

Thank-you for your help.

Regards,

- Roy

Connection string error: Length Cannot be less than zero (no replies)

$
0
0
This connection string:

Data Source=localhost;UID=MYUID;Password=MYPWD;port=3306;connection timeout=10;Allow User Variables=true;ConvertZeroDateTime=true;

is giving me this error:

System.ArgumentOutOfRangeException: Length cannot be less than zero.
at String System.String.InternalSubStringWithChecks(System.Int32 startIndex, System.Int32 length, System.Boolean fAlwaysCopy)
at String System.String.Substring(System.Int32 startIndex, System.Int32 length)
at String MySql.Data.MySqlClient.MySqlConnectAttrs.get_ProgramName()
at Object System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(System.Object obj, System.Object[] parameters, System.Object[] arguments)
at Object System.Reflection.RuntimeMethodInfo.Invoke(System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
at Object System.Reflection.RuntimePropertyInfo.GetValue(System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture)
at Object System.Reflection.RuntimePropertyInfo.GetValue(System.Object obj, System.Object[] index)
at System.Void MySql.Data.MySqlClient.NativeDriver.SetConnectAttrs()
at System.Void MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(System.Boolean reset)
at System.Void MySql.Data.MySqlClient.NativeDriver.Authenticate(System.String authMethod, System.Boolean reset)
at System.Void MySql.Data.MySqlClient.NativeDriver.Open()
at System.Void MySql.Data.MySqlClient.Driver.Open()
at static Driver MySql.Data.MySqlClient.Driver.Create(MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings)
at Driver MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at Driver MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at Driver MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at Driver MySql.Data.MySqlClient.MySqlPool.GetConnection()
at System.Void MySql.Data.MySqlClient.MySqlConnection.Open()


Any idea what I am doing wrong or how to fix?


EDIT: I was using MySQL Connection Net 6.7.2. If I revert to 6.6.4 I don't get this error

Unable to add new data connection in VS 2012 Professional (1 reply)

$
0
0
Hi,

I'm unable to add new data connection in VS 2012 Professional because the add connection window closes as soon as I start typing in the information. I'm using MySQL Connector Net 6.6.5. I'm currently using trial version VS2012. Is this a known issue?

Thanks

Fastest connectionstring for .NET connector (4 replies)

$
0
0
Hello,

I'm using the latest version of .NET connector and mysql server 5.5 to connect to a local database

the code is the following:

Public Sub OpenConn()
Public conn As MySqlConnection

If Not conn Is Nothing Then conn.Close()

Try
conn = New MySqlConnection("server=localhost;user id=root; password=mypassword; database=test; pooling=false")
conn.Open()
Catch ex As MySqlException
MessageBox.Show("Error connecting to server: " + ex.Message)
End Try
end sub

This code take about 1.5 sec (1500 ms) to connect to the server and database

In my project, I don't want to let the connection open.

So I open the connection, retrieve informations and close the connection. This adds in security and lower the risk of database corruption in case of power failures for instance.

Now with this approach, I will have to connect many times to the the server and it will cost time and ultimately slows my application.

I used the same approach with ODBC connector 3.51, and it worked like a dream. the connection is so fast (instantaneously)

So please can you tell if it is possible to have faster connection to the server using .NET connector ?

Is there other options in the connectionstring which can make the connection faster ?

Regards

MySqlConnection Open - Poor Performance (on Mono/Raspberry Pi) (6 replies)

$
0
0
Hi there,
i encountered very poor performance executing MySqlConnection.Open() on a Raspberry Pi:
I have written a small C# console test app, in which i connect to remote MySQL DB (5.1.49) and get some rows of a table.

The binary executed on Win7 .Net shows:
---
initializing connection: 2013-06-09T17:32:01.6484375+02:00
connected in 271ms
getting data: 2013-06-09T17:32:01.9306641+02:00
get data completed in 2ms
---

The binary executed on Mac OSX 10.8 Mono (2.10.11) shows:
---
initializing connection: 2013-06-09T17:32:56.2330310+02:00
connected in 373ms
getting data: 2013-06-09T17:32:56.6546790+02:00
get data completed in 2ms
---

The binary executed on Raspberry Pi (raspberrian wheezy) Mono (user compiled 2.11.4 hardfp-abi) shows:
---
initializing connection: 2013-06-09T17:33:20.8388670+02:00
connected in 7425ms
getting data: 2013-06-09T17:33:29.3873690+02:00
get data completed in 17ms
---

(I've also tested this on Raspberry Pi with Debian wheezy softfloat distro and the latest stable Mono 2.10.8, but it's about the same, like 5-8 seconds for opening the connection..)

When i turn on mysql logging in the connection string, i get the following for the connection part:
---
initializing connection: 2013-06-09T17:34:07.9817500+02:00
mysql Information: 1 : 1: Connection Opened: connection string = 'server=fred;User Id=######;password=######;Persist Security Info=True;database=PiBaammm;logging=True'
DateTime=2013-06-09T17:34:15.8155840+02:00
mysql Information: 3 : 1: Query Opened: SHOW VARIABLES
DateTime=2013-06-09T17:34:16.1681030+02:00
mysql Information: 4 : 1: Resultset Opened: field(s) = 2, affected rows = -1, inserted id = -1
DateTime=2013-06-09T17:34:16.2329330+02:00
mysql Information: 5 : 1: Resultset Closed. Total rows=274, skipped rows=0, size (bytes)=6514
DateTime=2013-06-09T17:34:16.4871690+02:00
mysql Information: 6 : 1: Query Closed
DateTime=2013-06-09T17:34:16.5165170+02:00
mysql Information: 3 : 1: Query Opened: select timediff( curtime(), utc_time() )
DateTime=2013-06-09T17:34:16.5843970+02:00
mysql Information: 4 : 1: Resultset Opened: field(s) = 1, affected rows = -1, inserted id = -1
DateTime=2013-06-09T17:34:16.5991850+02:00
mysql Information: 5 : 1: Resultset Closed. Total rows=1, skipped rows=0, size (bytes)=9
DateTime=2013-06-09T17:34:16.6443650+02:00
mysql Information: 6 : 1: Query Closed
DateTime=2013-06-09T17:34:16.6583540+02:00
mysql Information: 3 : 1: Query Opened: SHOW COLLATION
DateTime=2013-06-09T17:34:16.6951830+02:00
mysql Information: 4 : 1: Resultset Opened: field(s) = 6, affected rows = -1, inserted id = -1
DateTime=2013-06-09T17:34:16.7094290+02:00
mysql Information: 5 : 1: Resultset Closed. Total rows=127, skipped rows=0, size (bytes)=3958
DateTime=2013-06-09T17:34:16.8281750+02:00
mysql Information: 6 : 1: Query Closed
DateTime=2013-06-09T17:34:16.8408500+02:00
mysql Information: 3 : 1: Query Opened: SET character_set_results=NULL
DateTime=2013-06-09T17:34:16.8827450+02:00
mysql Information: 4 : 1: Resultset Opened: field(s) = 0, affected rows = 0, inserted id = 0
DateTime=2013-06-09T17:34:16.8964320+02:00
mysql Information: 5 : 1: Resultset Closed. Total rows=0, skipped rows=0, size (bytes)=0
DateTime=2013-06-09T17:34:16.9110580+02:00
mysql Information: 6 : 1: Query Closed
DateTime=2013-06-09T17:34:16.9222500+02:00
mysql Information: 10 : 1: Set Database: PiBaammm
DateTime=2013-06-09T17:34:17.0391950+02:00
connected in 7978ms
---

So one can see that there are some extra queries done during initializing, but these doesn't take that much time. The most time is spent during the connect itself..
Sure, the Raspberry Pi is not the fastest hardware, but once connected, the queries are executed in about 20-100ms.. (and MySql queries in Python with mysql-python-connector connect in less than a second..)
So what's going on there - what does take about 7 (!) seconds in the connection progress? Can you confirm this? And how can it be fixed/optimized?

Thanks in advance,
Hannes.

unable to uninstall c# mysql connector (11 replies)

$
0
0
Hi,

I can't Install or De-install the mysql connector on Windows XP.
"mysql-connector-net-6.6.5.msi"

Error says something like "error in uninstalling, backing out"

In trying to remedy this, I deleted this directory.
c:\Program Files\MySQL\*connector*

Also, I can't uninstall or repair the connector in
AddRemovePrograms

FYI: I successfully have mysql-server working on the same box aok.

Just the connector is giving me fits....


Thanks for any leads!
You all are the best.
Limbo Jim
Viewing all 1447 articles
Browse latest View live


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