![](/img/trans.png)
[英]Connect to SQL Server Database using jdbc Java, Android app
[英]Android Java SQL Connect
因此,按行业来讲,我是一名Web开发人员,但目前正在开发一个应用程序。
我的PC上有一个程序,可以将PC上的数据发送到Webhost上的数据库。
我现在要创建的应用程序可以通过一系列查询下载该数据。
周围是否有任何好的资源可以帮助我开发一些Java代码,在外出时通过平板电脑连接到服务器以及在其他wifi网络上从Web主机下载信息?
谢谢您的帮助,不胜感激。
我的处理方式是根据自己的意愿创建一个网页。 例如,如果我想验证应用程序上的登录名,则创建一个包含用户名和密码的页面。 在设备上,我只是使用HTTP发布事务发布用户名和密码值。
例:
public boolean LoginUser()
{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("your URL comes here...");
try
{
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
DataCrypt crypt = new DataCrypt();
try
{
this.Cryptemail = crypt.bytesToHex(crypt.encrypt(this.Email));;
this.Cryptpass = crypt.bytesToHex(crypt.encrypt(this.Password));
}
catch (Exception e)
{
DebugLog.log(e.getMessage());
}
nameValuePairs.add(new BasicNameValuePair("Password", this.Cryptpass));
nameValuePairs.add(new BasicNameValuePair("Mail", this.Cryptemail));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
// Execute HTTP Post Request
BasicHttpResponse response = (BasicHttpResponse) httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
String response = EntityUtils.toString(entity);
return true;
}
catch (Exception e)
{
DebugLog.log(e.getMessage());
return false;
}
return false;
}
编辑:因此,您可以只制作一个包含一些您要作为查询基础的参数的页面,并以某种方式(例如通过XML)返回结果。
希望这可以帮助你! :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.