Reputation: 11
Can you help me, please? I'm trying to create an Android app, which will connect to SQL Server Database. I'm using JDBC driver and:
The code of connecting to DB is as follows:
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url = "jdbc:sqlserver://xxx.x.x.x:yyyy;integratedSecurity=true;"
con = DriverManager.getConnection(url);
if (con != null) {
tv.setText("Connected");
} else {
tv.setText("Not connected");
} catch (Exception ex) {
tv.setText("" + ex);
}
Eventually, I receive an Exception, that Driver com.microsoft.jdbc.SQLServerDriver
not found
If I run the same Console app on Java app, it works.
Upvotes: 0
Views: 794
Reputation: 171
The proper way is add rest api at home server and use on phone to connect and exchange data. Its not enterprise java and it wouldn't work properly.
Upvotes: 1