简体   繁体   English

连接到服务器中的ms sql数据库

[英]connect to ms sql database in a server

i am working on a app which should take data from a database on a server. 我正在开发一个应从服务器上数据库中获取数据的应用程序。 it is a ms sql database. 它是一个ms sql数据库。 i need some help like little code hints or some useful information. 我需要一些帮助,例如小小的代码提示或一些有用的信息。

thank you! 谢谢!

1) Create some ASP, JSP, PHP pages which recieve some parameters and will operate over the database (for example: create page authenticate which will accept username and password parameters and will return true or false, to make it more simple) 2) On your Android application, you should use for example HttpClient to make request to authenticate page you have created(if you have a public domain if you you don't, you can install web server on your machine, connect your Android to USB port and access your webpage using following IP: 10.0.2.2) 1)创建一些接受一些参数并在数据库上运行的ASP,JSP,PHP页面(例如:创建页面身份验证,该页面将接受用户名和密码参数并返回true或false,以使其更加简单)2)您的Android应用程序,您应该使用HttpClient来请求身份验证您创建的页面(如果您拥有公共域,则可以在您的计算机上安装Web服务器,将Android连接到USB端口并访问您的网页使用以下IP:10.2.0.2)

This is was just a simple example when your responce will containt only true or false. 这只是一个简单的示例,当您的响应仅包含true或false时。 I would advice you also to give a look at JSON or XML parsing libraries. 我建议您也看看JSON或XML解析库。 So on web server you should return your data encoding it with JSON or XML(sure you can also create your own protocol, everythin is up to you) and on Android you should parse it using JSON or XML parsing libs. 因此,在Web服务器上,您应该返回使用JSON或XML对其进行编码的数据(确保还可以创建自己的协议,一切由您决定),而在Android上,您应该使用JSON或XML解析库对其进行解析。

ALTERNATIVE 替代

1) Create web service and call web service from Android 1)创建Web服务并从Android调用Web服务

Give a look at some tutorials like: http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/ http://kindohm.com/post/1097012742/androidhttpclientjson.html 看看一些教程,例如: http : //lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/ http://kindohm.com/post/1097012742/androidhttpclientjson。 html

Google more if it's still will be unclear for you. 如果您仍然不清楚,Google还会提供更多信息。

Good luck ;) 祝好运 ;)

Create scripts on your server to communicate between the database and your app, php scripts may be? 在服务器上创建脚本以在数据库和应用程序之间进行通信,php脚本可能是? Or if you are comfortable with SOAP/ASP.NET? 还是对SOAP / ASP.NET感到满意?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM