This post illustrate one of the problem which I faced while developing application for Android. The issue was very weird while I first got, since the same code works fine with normal Java applications.
I got the same issue with my Android test project too. This issue you will get if you use sqljdbc-1.2.0 is this
com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: Socket closed.
I tried googling for the issue and came to know with a bug with Microsoft
sqljdbc-1.2.0.jar.
You can find more information from here
http://blogs.msdn.com/b/jdbcteam/archive/2007/04/24/welcome-to-the-sql-server-jdbc-blog.aspx?PageIndex=5
Solution
Well, the solution is, use
jtds-1.2.7 which you can download from
here
Note
Don’t use the latest version of JTDS (jtds-1.3.1), since that too has bug with Android and this will again give you a ClassNotfoundException
I know this sounds a simple post, but it took
5 hours of my time to sort out both the above issue I faced.
I hope you find this solution useful.
Thanks,
Karthik KK