I am connecting android to SQLServer directly (I know its not recomended)
I have written following code:
public class MainActivity extends Activity {
The error occurs because, during development, Eclipse ADT shows you the superset of the Android JRE and the Java SE JRE. XAConnection comes from the latter, not from the JDBC JARs you included.
However, on-device, Android only has its own runtime environment, which does not contain all classes from Java SE. It looks like XAConnection is one the missing ones.
To solve the problem you need to find a library that includes the missing classes required by the JDBC JARs (or make it yourself), or, better yet, use the recommended solution.
I recommend the latter, because I know from experience it can be a royal pain to accomplish the former.