PHP Web Service....

kiwis

Member
Joined
Apr 23, 2007
Messages
7
Programming Experience
Beginner
I've got a VB Application, I want to get stuff from a REMOTE MySQL DB.. I've read up on this and the best way is to use web services...

Problem time... :)

I have no idea how this works, i've tried working with tutorial etc but it seems to be all very hard :-(

My host does not have SOAP extensions...

can someone please please help.
 
MySqlConnector

Hi,
The title of your post shows that you are asking about php web service.
If not, then to get stuff from a remote mysqldatabase all you need is a proper connection string and mysql connector which can be downloaded from http://dev.mysql.com/downloads/connector/net/1.0.html. If you need a webservice then create a web service with a WebMethod which returns a datatable and consume that webservice in your application. Here the webservice i'm talking about is Asp.net web service. Hope this helps you.
 
But my MySQL host does not allow remote connections.. It has to be localhost.
Does this MySQL tool get around this?
 
Hi,
MySqlConnector is a fully-managed, ADO.Net provider for the MySQL database system just like sql provider. If your mysql server will not allow remote connections then you can't connect to the remote server. For security reasons normally mysqlserver will be configured as not allowing remote tcp connections.
if you are going to use a webservice then you have to install mysqlconnector and you may add reference to the mysql.data.dll. but, if you are using visual studio 2005 then you have to goto the installation folder (by default, C:\Program Files\MySQL\MySQL Connector Net 1.0.7\bin\.NET 2.0) of mysqlconnector and browse for MySql.Data.dll file and add reference to that dll then mysql classes like MySqlConnection, MySqlCommand, MySqlDataAdapter etc will be available for you and you may use that

for eg: webservice code

VB.NET:
Imports System.Data
Imports MySql.Data.MySqlClient
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class Service
     Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function GetStuffFromMySqlDatabase() As DataTable
        Dim conStr As String = "SERVER=yourserver;DATABASE=yourdatabase;UID=youruserid;PASSWORD=yourpassword;"
        Dim mySqlDataAdapter As New MySqlDataAdapter("SELECT * FROM YOURTABLE", conStr)
        Dim dataTable As New DataTable("YourDataTable")
        mySqlDataAdapter.Fill(dataTable)
        Return dataTable
    End Function

End Class
 
Back
Top