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 开发者_如何学Cdatabase. 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 (e.g. 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.
You could use the jtds driver (version 1.25) to connect to an external sql server
精彩评论