MySQL remote connection with LingConnect for Metro
-
- Posts: 11
- Joined: Wed 12 Jun 2013 20:19
MySQL remote connection with LingConnect for Metro
hi,
I am trying to make a remote connection to a MySQL server in our local network with "Devart LinqConnect for Metro (MySQL)" and it always say "access denied". I am using the following code :
Devart.Data.MySql.MySqlConnection lMySqlConnection = new Devart.Data.MySql.MySqlConnection();
lMySqlConnection.Host = "192.168.0.237";
lMySqlConnection.Port = 3306;
lMySqlConnection.Database = "databasename";
lMySqlConnection.UserId = "user";
lMySqlConnection.Password = "password";
lMySqlConnection.Open();
Is it possible to do this type of connection in a Metro app? If not what is the good way to connect to a remote MySQL server with the Library?
Thank you in advance
I am trying to make a remote connection to a MySQL server in our local network with "Devart LinqConnect for Metro (MySQL)" and it always say "access denied". I am using the following code :
Devart.Data.MySql.MySqlConnection lMySqlConnection = new Devart.Data.MySql.MySqlConnection();
lMySqlConnection.Host = "192.168.0.237";
lMySqlConnection.Port = 3306;
lMySqlConnection.Database = "databasename";
lMySqlConnection.UserId = "user";
lMySqlConnection.Password = "password";
lMySqlConnection.Open();
Is it possible to do this type of connection in a Metro app? If not what is the good way to connect to a remote MySQL server with the Library?
Thank you in advance
Re: MySQL remote connection with LingConnect for Metro
Yes, it is possible to do.Braveheart wrote: Is it possible to do this type of connection in a Metro app?
Please open the Package.appxmanifest file of your application, open the Capabilities tab and select the "Internet (Client & Server)" and "Private Networks (Client & Server)" check boxes.
Save changes and try executing your code to open the MySQL connection.
-
- Posts: 11
- Joined: Wed 12 Jun 2013 20:19
Re: MySQL remote connection with LingConnect for Metro
ok thanks it's working!
-
- Posts: 11
- Joined: Wed 12 Jun 2013 20:19
Re: MySQL remote connection with LingConnect for Metro
The tutorial here http://blogs.devart.com/dotconnect/linq ... guide.html explain how to display data from a new generated database. Does it have a tutorial if we use the "Database First" model type do display data from a model of a remote SQL MySQL server. I created the model from my remote SQL database, but how I can use it to display the data in a grid view like in the tutorial?
Does it have also a quick way to fill a gridview with a datareader?
Thank you in advance!
Does it have also a quick way to fill a gridview with a datareader?
Thank you in advance!
-
- Posts: 11
- Joined: Wed 12 Jun 2013 20:19
Re: MySQL remote connection with LingConnect for Metro
From what I see in the documentation, after my model is created from my database, I need to do this :
TtvDevV1Context.TtvDevV1DataContext context = new TtvDevV1Context.TtvDevV1DataContext();
But when I run the application, after it get into the constructor, the application crash on the call of the base constructor:
base(@"User Id=user;Password=password;Host=192.168.0.156;Database=ttv_dev_v1;Persist Security Info=True", mappingSource)
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
--> if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break(); };
#endif
And I get the following message box :
"A debugger is attached to app1.exe but not configured to debug this unhandled exception. To Debug this exceptions, detach the current debugger"
TtvDevV1Context.TtvDevV1DataContext context = new TtvDevV1Context.TtvDevV1DataContext();
But when I run the application, after it get into the constructor, the application crash on the call of the base constructor:
base(@"User Id=user;Password=password;Host=192.168.0.156;Database=ttv_dev_v1;Persist Security Info=True", mappingSource)
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
--> if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break(); };
#endif
And I get the following message box :
"A debugger is attached to app1.exe but not configured to debug this unhandled exception. To Debug this exceptions, detach the current debugger"
Re: MySQL remote connection with LingConnect for Metro
There is no tutorial for using LinqConnect for Metro with MySQL at the moment.
The steps in the section "Binding and Displaying Data" in our blog are the same for MySQL.
Except for the lines of creating a DataContext instance:instead of
As for the exception you are getting when creating a new instance of DataContext, we couldn't reproduce it.
We are sending you a test project to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter. Please make changes to it so that the issue could be reproduced and send it back to us or send us your project.
The steps in the section "Binding and Displaying Data" in our blog are the same for MySQL.
Except for the lines of creating a DataContext instance:
Code: Select all
TtvDevV1Context.TtvDevV1DataContext context = new TtvDevV1Context.TtvDevV1DataContext();
Code: Select all
TtvDevV1Context.TtvDevV1DataContext context = new TtvDevV1Context.TtvDevV1DataContext.Create();
We are sending you a test project to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter. Please make changes to it so that the issue could be reproduced and send it back to us or send us your project.
Re: MySQL remote connection with LingConnect for Metro
Thank you for the additional information. We still couldn't reproduce this issue on our environment.
Your database is not necessary for reproducing the issue. It's enough to have a sample project with your LinqConnect model (*.lqml file), with which this error is reproduced when creating a new DataContext instance.
Thus, please provide us with a test project, so that we are able to find a solution for you.
Please try using try-catch block in the Page_Loaded_1 method to get the stack trace of the error and send it us.
We have also sent you a sample project (14.06.2013 11:23) - please tell us whether the issue is reproduced with it or not?
Your database is not necessary for reproducing the issue. It's enough to have a sample project with your LinqConnect model (*.lqml file), with which this error is reproduced when creating a new DataContext instance.
Thus, please provide us with a test project, so that we are able to find a solution for you.
Please try using try-catch block in the Page_Loaded_1 method to get the stack trace of the error and send it us.
We have also sent you a sample project (14.06.2013 11:23) - please tell us whether the issue is reproduced with it or not?
-
- Posts: 11
- Joined: Wed 12 Jun 2013 20:19
Re: MySQL remote connection with LingConnect for Metro
Sorry for late answer, I was in vacations for 3 weeks. I used a try catch to get the error that cause this line :
TtvDevV1Context.TtvDevV1DataContext context = new TtvDevV1Context.TtvDevV1DataContext();
and the error is "License not found. Please view "Licensing" topic in LinqConnect documentation for details or contact Devart technical support.
From what I see in the help, I need the file licenses.licx and App_Licenses.dll but I can't find them. Where I can find these file for the trial version ?
I found this post doing some search in the forum :
I selected Visual Studio Integration during installation, but DEVART.DATA.MySQL.LINQ.dll.licenses is not generated in my project folder after compilation.
Thank you in advance!
TtvDevV1Context.TtvDevV1DataContext context = new TtvDevV1Context.TtvDevV1DataContext();
and the error is "License not found. Please view "Licensing" topic in LinqConnect documentation for details or contact Devart technical support.
From what I see in the help, I need the file licenses.licx and App_Licenses.dll but I can't find them. Where I can find these file for the trial version ?
I found this post doing some search in the forum :
Sorry for the delay. When using LinqConnect for Metro there is no need to add the licenses.licx file to the projects manually. The License file is created automatically in case LinqConnect for Metro is integrated into Visual Studio.
Thus, please make sure that:
- LinqConnect for Metro was integrated into Visual Studio during the installation (the option "Visual Studio integration" should have been selected); if not - please re-install LinqConnect with the option "Visual Studio integration" selected;
- after compilation of the application the file named "DEVART.DATA.SQLITE.LINQ.dll.licenses" should be created in the Properties folder of the project.
I selected Visual Studio Integration during installation, but DEVART.DATA.MySQL.LINQ.dll.licenses is not generated in my project folder after compilation.
Thank you in advance!
Re: MySQL remote connection with LingConnect for Metro
There is a known issue with the license resource files when working with LinqConnect for Metro trial edition. We have fixed it and the fix will be included in the next build of LinqConnect for Metro.
JIC: When working with not trial version of LinqConnect for Metro, there is no need in generating license resource file.
As a workaround please do the following:
1. Remove references Devart LinqConnect for Metro (SQLite/Oracle/MySQL/PostgreSQL) from your application.
2. Add references to the Devart assemblies from the directory where LinqConnect for Metro is installed; for example, for MySql add Devart.Data.dll, Devart.Data.MySql.dll, Devart.Data.Linq.dll and Devart.Data.MySql.Linq.dll from C:\Program Files (x86)\Devart
\dotConnect\Linq\WinRT and C:\Program Files (x86)\Devart\dotConnect\MySQL\WinRT folders.
JIC: When working with not trial version of LinqConnect for Metro, there is no need in generating license resource file.
As a workaround please do the following:
1. Remove references Devart LinqConnect for Metro (SQLite/Oracle/MySQL/PostgreSQL) from your application.
2. Add references to the Devart assemblies from the directory where LinqConnect for Metro is installed; for example, for MySql add Devart.Data.dll, Devart.Data.MySql.dll, Devart.Data.Linq.dll and Devart.Data.MySql.Linq.dll from C:\Program Files (x86)\Devart
\dotConnect\Linq\WinRT and C:\Program Files (x86)\Devart\dotConnect\MySQL\WinRT folders.
-
- Posts: 11
- Joined: Wed 12 Jun 2013 20:19
Re: MySQL remote connection with LingConnect for Metro
Thanks, all is working fine now when adding the references manually.