我的MSSQL Server托管IP地址是202.xxx.xxx.18,25000。它使用UDP端口,所以我需要输入“,”而不是“:”。但问题是当我尝试使用JDBC连接到它时,它显示错误“主机未解析”。我该怎么办?
try
{
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
String ConnectionString = "jdbc:jtds:sqlserver://202.xx.xx.18,25000";
// Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection(ConnectionString,"user", "*******");
Toast.makeText(getApplicationContext(), "connected", 1000).show();
}