I need to make a generic app which can be used by anyone. App will connect directly to MS SQL server, which will be within intranet/wifi I donot need to worry about security risk, I donot want to use web service or anything which we need to do something on server. I am new and I have tried every option but still can't connect to sql from android studio.
我需要制作一个可供任何人使用的通用应用程序。应用程序将直接连接到MS SQL服务器,这将在Intranet / wifi内我不需要担心安全风险,我不想使用Web服务或任何我们需要在服务器上做某事。我是新的,我已经尝试了所有选项,但仍然无法连接到Android工作室的SQL。
Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance(); String url = "jdbc:jtds:sqlserver://192.168.0.7/MYDB;user=android;password=abcd;"; Connection DbConn = DriverManager.getConnection(url);
的Class.forName( “net.sourceforge.jtds.jdbc.Driver”)的newInstance(); String url =“jdbc:jtds:sqlserver://192.168.0.7/MYDB; user = android; password = abcd;”;连接DbConn = DriverManager.getConnection(url);
Please suggest the easiest way to connect, as I said it will be used by different people on different server I need to connect directly with Dynamics NAV database without any middle tier
请建议最简单的连接方式,因为我说它将被不同服务器上的不同人使用我需要直接连接Dynamics NAV数据库而不需要任何中间层
Can we connect directly to SQL Server from Android Studio?
我们可以从Android Studio直接连接到SQL Server吗?
1 个解决方案
#1
0
Thanks for your comments
感谢您的意见
I found this and worked
我找到了这个并且工作了
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
#1
0
Thanks for your comments
感谢您的意见
I found this and worked
我找到了这个并且工作了
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);