I would like to use a MYSQL (phpMyAdmin) connection with a .NET Gadgeeter (4.2) project.
I already ran a project (Windows apply) and it work. I think some usings are missing but i don’t know what they are.
I installed “mysql-connector-net-6.6.5”
No its not part of the OSHW line up. SQLite is part of the premium hardware lineup of swhich the spider is one.
I guess there is no reason why you couldnt write your own SQL Library for the OSHW boards? release it to the community and get loads of Kudos
If I understand you correctly you want to access a MySQL Database on some server from your NETMF device.
To do so you would need a MySQL driver for NETMF.
I think “mysql-connector-net-6.6.5” is the .NET driver for windows.
If you can find a similar thing for NETMF, then it’s easy (doubt that it exists)
If not, you would have to write one, which will not be so easy I think.
If you can use some kind of windows based gateway, then I would go this way:
Create a Windows app/service using “mysql-connector-net-6.6.5” to access the DB
Open an TCP/IP Port (Server) in your gateway app/service.
In NETMF Device connect to this TCP/IP Server.
Comunicate with any protocol you like betwenn NETMF Device and gateway app/Service and route it through to MySQL DB.
@ MugiwaraOz - You wont be able to talk “directly” to the MYSQL database because there are no drivers for this on netmf.
How will the gadgeteer app communicate with you dektop app? How these 2 will be connected?
I want to pick up my datas into a circular buffer, then send it to my database using ENC28 module (ethernet module). My database is located in a computer on my network.
I’m a begginer in NETmf, so i don’t understand everything ! But thank you to all trying to help me
You can not use any precompiled assembly which was made for the Windows .net Framework, and copy it to your NETMF Device.
You need specially compiled assemblies which targets the .net Microiframwork (which is a subset of the big .net in some parts, but also a bit different in others).
To comunicate over the ENC28 you can use raw TCP or UDP sockets, or you use any ‘higher level’ servers/clients which already exists, like FTP, http, …
I assume that the MySQL server is a TCP server that requires a ‘special’ protocoll which should be described on the MySQL web page.
What you need to do now is to implement this protocol using raw TCP sockets and build an API around it.
This API should be similar to an already existing API which exists for MySQL (Like the mysql-connector-net you mentioned)
I am doing the exact same thing. I am calling a web page (php) and inserting data to MySQL.
HttpRequest result = new HttpRequest();
_request = (HttpWebRequest)HttpWebRequest.Create(url);
_request.Method = "POST";
_request.ContentType = ContentType;
_request.Timeout = 30 * 1000;
_buffer = data;
if (_buffer != null)
{
_request.ContentLength = _buffer.Length;
Stream s = _request.GetRequestStream();
s.Write(_buffer, 0, (int)_buffer.Length);
s.Close();
}
response = _request.GetResponse();
Stream sr = response.GetResponseStream();
StreamReader readStream = new StreamReader(sr);
string str = readStream.ReadToEnd();
RaiseSucceed((HttpWebResponse)response, str);
Calling the function (up function)
JsonObject o = new JsonObject();
JsonObject data = new JsonObject();
o.Add("Measuring", "Temperatures");
o.Add("Data", data);
data.Add("Location", "LivingRoom-Computer");
data.Add("Data", _PostDataTemperature);
_PostedData.Add(o);
o = new JsonObject();
data = new JsonObject();
o.Add("Measuring", "Humidities");
o.Add("Data", data);
data.Add("Location", "LivingRoom-Computer");
data.Add("Data", _PostDataHumidity);
_PostedData.Add(o);
_PostDataTemperature = new JsonArray();
_PostDataHumidity = new JsonArray();
r = HttpRequest.CreatePostRequest(@ "http://" + Program._SERVERROOT + "/Process/Microcontroler/PostMeasurements.php", _PostedData.ToString().ToBytes(), "application/json");
It is not complete code, but you will get the idea.
I don’t undertand everthing in you code. I can’t see your attributes types and method like RaiseSucceed or Json …
Could you send me your project files at: m.chauzal@ gmail.com
Or codeshare project in the forum.