Bridging the Gap: Talking to MySQL From VB.NET Through PHP and XML
(Page 1 of 4 )
This month's Developer Shed Writing Contest Winner, Nicholas Clayton, explains how he was able to use VB.NET, PHP, and XML to talk to a troublesome MySQL database.
"There may be times when what your client needs and what their web host will give you brings your project to a grinding halt. I have encountered such a problem recently when trying to access a client’s hosted MySQL Database from an app I have written in VB.NET."No matter what I did, the server would not let me in. I had tried connecting from my web site first, but that was a no go. So I decided to break out a VB.NET app to see if that would do the trick. Well, it does, but not the way I was hoping for. I have finally finished a workaround for this security nightmare that I have had for the past couple of weeks.
I had tried talking to the hosting company but kept getting very general, very basic answers that really did not have anything to do with what I was trying to accomplish. So after banging my head on the desk and scouring Google like a madman, I decided to take matters into my own hands and learn a few new tricks while I was at it.
First, I will explain the big picture and then break it down into the individual pieces.
The Big Picture
I’ve created a small front-end in VB.NET to display a DataGrid showing messages saved in the client’s MySQL database. I cannot connect through MyODBC thanks to the wonderfully secure hosting environment, so I came up with another way…XML generated by PHP. Don’t ask me how I came up with this, it was a late night enlightenment.
In order to limit who or what could access this information, I created a key value to pass along with the rest of my post data. Once this data has been posted, I get back a string of XML with the data I need for the DataGrid. This is similar to the actions that occur when communicating with a Web Service.
Simple enough, right?
First, I’ll start with the front-end.
Next: An Adventure in VB.NET >>
More Visual Basic.NET Articles
More By Nicholas Clayton