dongzengzai4567
dongzengzai4567
2015-11-02 13:14

将Android Studio连接到Web服务到SQL Server

已采纳

i heard that the best way to connect android to sql server database is by creating web service around it. Is there any specific tutorial to create the web service?

  1. Do we need install server like xampp for mysql or it will be just fine with sql server management studio?
  2. What is exactly a web service? Connecting via post method to php is a web service?
  3. What software i must use to make it work?

    -android studio

    -sql server management studio

    -php written in notepad (?)

    -apache tomcat?

    anything else?

Sorry for bad english, Thanks

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • dqly83915 dqly83915 6年前

    You gave us a very broad question.

    I'll try to get you going.

    First, a webservice can be a lot, but most often it is a server (php in your case) that uses SOAP.

    Look up SOAP yourself to get the details, but it boils down to sending XML files to the server. The server then responds with something appropriate.

    Here is a very short introduction with code, just to get the idea what it is about:

    http://www.codeproject.com/Tips/671437/Creating-Web-Service-Using-PHP-Within-Minutes

    The reason you want a wrapper around your database is this: You don't want to allow everybody to access your database directly. So you write a wrapper around it, that ONLY performs tasks you allow it to.

    For example: Get all users in group x. Or: Update the birthday of userid 455. etc. That way you control what goes in and out, and you only have to send some XML to get the job done. Your PHP script will take care of the actual database interaction.

    Where you write your PHP in isn't very important. I would advice you to use at least an editor with syntax highlighting and UTF8 support.

    Don't use Notepad.

    Look up notepad++ if you want something better: Notepad++ can do that. If you take bigger projects you probably want to use a real IDE. (There are many for PHP)

    Apache? Linux? Windows? As long as you can run PHP, it is OK. If you are planning to use MSSQL Server from Microsoft, you will have an easier time if you run on windows. If you use mySQL, it doesn't matter too much.

    I want to warn you: You seem to be pretty new to PHP (since you asked if Notepad is OK to develop in). This project might be a little over your head. :-)

    点赞 评论 复制链接分享