简体   繁体   中英

Access SQL Server 2008 from Android?

I know there is already a question like this, but I have found this page on the Android Developemt site: http://developer.android.com/reference/java/sql/package-summary.html which seems to suggest that it is possible to interface to a SQL database. If this is possible then could someone please show me how it can be done.

If you manage to build a custom firmware with SQL Server 2008 - then maybe. :)
SQL on Android is limited to the built-in SQLite and you'll need some kind of web services (eg REST) to access an external DB.

You can use nearly every Java library that works to connect to a sql2008 server. As you would in a Java Web Development environment.

I would advise against using a direct database connection in most cases. You have to keep in mind that you are working on a system with a very very bad Internet connection that can loose the connection every time and likely is to change its address every couple of minutes.

Using a http connection to a small rest server is much less error prone then opening a database connection and maybe holding onto it for a while. Try to encapsulate your database in a small RESTfull backend that ideally uses JSON to communicate with your app.

您可以使用jtds驱动程序(1.25版)连接到外部sql服务器

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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