Android的访问远程SQL数据库 [英] Android access to remote SQL database

查看:503
本文介绍了Android的访问远程SQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从Android程序访问远程SQL数据库(在web服务器)直接?即只需打开了所有必需的参数的连接,然后执行一个SQL查询?

Can I access a remote SQL database (on a webserver) directly from an android program? i.e. simply open up the connection with all the required parameters and then perform an SQL query?

这是一个私人的程序(而不是向公众提供)仅适用于指定的手机,所以我并不担心第三方得到一个举行的数据库访问。

This is a private program (not available to the public) only available on specified handsets, so I am not worried about third parties getting a hold of database access.

如果这样 - ?我需要什么样的Java库

If so - what libraries do i need in Java?

感谢。

推荐答案

这个问题已经冒出了好几次。你或许可以在Android设备连接到SQL服务器直接,如果你部署了MSSQL JDBC驱动程序到您的Andr​​oid设备,然后直接暴露您的SQL服务器到互联网。如果MSSQL驱动程序不能正常工作,在Android是一个完全不同的问题。

This question has popped up several times. You PROBABLY can connect your android device to the SQL server directly if you deployed the MSSQL JDBC drivers to your android device and then exposed your SQL server directly to the internet. If the MSSQL drivers would work properly on Android is a completely different problem.

这是怎么你也许可以做到这一点。然而这是为什么这是一个坏主意。

That is how you might be able to do it. However here is why that is a bad idea.

  1. 您是直接暴露您的SQL服务器到互联网。除非你加密MSSQL服务器和Android设备之间的数据将是比较容易确定的黑客嗅探器和MSSQL之间的TDS数据流,反向工程,并窃取你的数据。加密可能会使其更难几乎是不可能的攻击者窃取你的数据。但攻击者仍可以直接发动对数据库中的DOS / DDOS攻击。 不是一个好主意!

如果您计划连接其他移动设备(iPhone,塞班,黑莓等),你将需​​要能够创建从这些设备SQL连接为好。 iPhone不支持Java本机(从我的记忆)例如,所以你需要找到一种方法将iPhone连接到SQL Server。黑莓手机可能会更容易,但Symbian的你要倒霉用。因此,你需要几乎为每个设备连接到您的数据库自定义解决方案。维修坏主意载荷

If you are planning to connect other mobile devices (iPhone, Symbian, BlackBerry and so on) you will need to be able to create a SQL connection from those devices as well. iPhone does not support Java natively(from my memory) for example so you would need to find a way to connect iPhone to the SQL server. BlackBerry might be easier but Symbian you are going to be out of luck with. Thus you will need to almost create a custom solution for each device connecting to your database. Bad Idea LOADS of maintenance

创建一个可以操纵你的数据库中的Web服务或自定义的TCP / IP服务器。连接到您的设备此WebService /服务。 Web服务是要走的路。 90%以上的设备,这些天都是本机能够做一个Web服务调用。

Create a webservice or custom TCP/IP server which can manipulate your database. Connect to this webservice/service from your device. Webservices are the way to go. More than 90% of devices these days are natively capable of doing a webservice call.

这篇关于Android的访问远程SQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆