1

Lately I asked this question regarding connecting my window app to a remote database (MySQL) hosted by some free hosting site. And I got "No way" answers.

How about using a webservice? Is it possible now?

Community
  • 1
  • 1
yonan2236
  • 13,371
  • 33
  • 95
  • 141

2 Answers2

1

Ok (and probably assuming .NET 4.0 on you hosting provider) this should be fairly straightforward:

  1. Yes you can access data via a webservice.
  2. If you want to with a minimum of effort you can use WCF Data Services
  3. Not tried this but...
    1. Create a web application
    2. "Build" an entity framework model for your data (see Using MySQL with Entity Framework for linking EF to MySQL)
    3. Create the data service (which seems mostly to be a matter of doing an add new item in visual studio)
    4. Enable access to data service resources - i.e. change some code to make sure you can see what you need.
    5. At this point you should end up with CRUD access to your database via a fairly comprehensive web service...

Biggest challenge there will be building the EF model - you really want a local instance of the MySQL database - schema at least - to develop against.

Community
  • 1
  • 1
Murph
  • 9,985
  • 2
  • 26
  • 41
  • I just have a simple table with 2 columns. I just want to insert records into it using my window app. – yonan2236 Sep 28 '10 at 07:04
  • thanks sir... I'm new to webservice and I have just made research on it.. Can you please recommend a website or anything where I can get some ideas on how to make it?(for beginners). My free hosting site is running these features : Operating system: Linux. Apache version:2.2.15 (Unix). PHP version:5.2.13. MySQL version:5.1.45 – yonan2236 Sep 28 '10 at 07:05
  • @yonan2236 - then you probably don't need to jump through all those hoops (and you're not going to be able to on your hosting provider anyway (if its free you get what you pay for...)). Go ask a different question: "How, in php, do I write a webservice to insert two values into a (MySQL) database" – Murph Sep 28 '10 at 08:05
0

Yes if your webservice is hosted on same server which contains mysql database. You can locally connect to mysql using webservice (which hosting providers allow for sure) and can server data using the service.

TheVillageIdiot
  • 40,053
  • 20
  • 133
  • 188
  • Ish - It doesn't matter where your service is hosted relative to your database *providing the service can access the database service*. My hosting provider (for one) has dedicated db servers separate from the hosting servers. The answer is the same though - yes you can use a web service. – Murph Sep 28 '10 at 06:50
  • thanks sir... I'm new to webservice and I have just made research on it.. Can you please recommend a website or anything where I can get some ideas on how to make it?(for beginners). My free hosting site is running these features : Operating system: Linux. Apache version:2.2.15 (Unix). PHP version:5.2.13. MySQL version:5.1.45 – yonan2236 Sep 28 '10 at 06:51
  • @Murph from his this and other question it seems his host does not allow remote connections – TheVillageIdiot Sep 28 '10 at 08:33
  • Yes, but I never said anything about "remote" connections - all that matters is that the web server is allowed to talk to the database server not that remote clients are allowed to talk to database server. One way to do this is to run db and web servers on the same box but its not the only way, allowing the web server to talk to the db server over the ISPs internal network is another so the key is NOT that the service is on the same server at all merely that the service is allowed to talk to the database (which it would have to be or why bother in the first place?) – Murph Sep 28 '10 at 18:06