问题
I'm using JTDS 1.2.7 to connect my Android app to a Windows Azure SQL Server.
Source code:
String connectionString =
"jdbc:jtds:sqlserver://SERVER.database.windows.net:1433;database=demo;" +
"user=test@SERVER;password=PASSWORD;ssl=require";
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection con = DriverManager.getConnection(connectionString);
Statement st = con.createStatement();
res=st.executeQuery(sql);
When I try to connect to the database I get the java.lang.NoClassDefError: com.sun.net.ssl.SSLContext exception. I tried to add jsse.jar to my build path, but the app just shuts down instead of making connection. What am I doing wrong?
来源:https://stackoverflow.com/questions/13846978/connecting-to-azure-sql-db-via-jtds-on-an-android-device