我需要在我的Android应用程序和SQL Server之间建立连接,但是遇到了问题。 我的代码是:
public class DataBaseConnection {
String connectionUrl;
Connection conn;
String user = "sa";
String password = "xxx";
public boolean openConnection()
{
connectionUrl = "jdbc:jtds:sqlserver://192.168.1.30:1433/FleuryV6;";
try {
Class.forName("net.sourceforge.jtds.jdbc.Driver");
conn = DriverManager.getConnection(connectionUrl, user, password);
} catch (SQLException ex) {
return false;
} catch (Exception e) {
return false;
}
return true;
}
}
调试应用程序时,我意识到它返回了DriverManager类的异常:
// If we get here, none of the drivers are able to resolve the URL
throw new SQLException("No suitable driver", sqlState);
研究得足够多,不再知道什么是解决方案,有人可以帮助我吗?