Connecting to Azure SQL DB via JTDS on an Android device

╄→尐↘猪︶ㄣ 提交于 2019-12-12 18:19:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!