I am trying to connect Android studio app to SQL server (Heidi SQL) I have the jtds jars (jtds-1.2.7.jar) file inside the lib and added the dependency. It still doesnt read the data and show the result from the database and I have this error:
E/Error: net.sourceforge.jtds.jdbc.Driver enter image description here
These are my codes.
public class ConnectionHelper {
Connection con; String uname, pass, ip, port, database; @SuppressLint("NewApi") public Connection connectionClass() { ip = "127.0.0.1"; database = "eat"; uname = "root"; pass = "pass"; StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); Connection connection = null; String ConnectionURL = null; try{ Class.forName("net.sourceforge.jtds.jdbc.Driver"); ConnectionURL = "jdbc:jtds:mysqlserver://" + ip + "/" + database + ";user=" + uname + ";password=" + pass +";"; connection = DriverManager.getConnection(ConnectionURL); } catch (Exception ex){ Log.e("Error" , ex.getMessage()); } return connection; } }