Friday, October 30, 2015

Android and Microsoft SQL (MS SQL SERVER 2008) marriage

All you have to do is use the appropriate driver, being a opensource fan , i'd recommend using JTDS.

Instructions below assumes you are using

  • Android Developer Tools Build id: v22.0.1-685705,
  • Eclipse Version: 4.2.1.v20130118 Build id: M20130204-1200
  • JTDS 1.2.5 

 though things will work out other versions higher than this and possibly lower as well , its just to ensure a known state where things worked out.

So, once the JTDS is jar is download, first step is to include jar to your build path

Next, though it seems like a bug, go to order and Export tab and enable jtds

Now, for the database connection , all network operations should be in different thread, ie away from the main UI thread,  so use  AsyncTask.

Working code is can be downloaded from here , read the code, it is well documented.

git clone

Or you can download my AndroidByExample [ZIP] git repo.