public class DbHelper {
String ip = "";
String classs = "net.sourceforge.jtds.jdbc.Driver";
String db = "";
String un = "";
String password = "";
@SuppressLint("NewApi")publicConnectionCONN(){StrictMode.ThreadPolicypolicy=newStrictMode.ThreadPolicy.Builder().permitAll().build();StrictMode.setThreadPolicy(policy);Connectionconn=null;StringConnURL=null;try{Class.forName(classs).newInstance();ConnURL="jdbc:jtds:sqlserver://" + ip + "/" + db + ";user="+un+";password="+password+";";conn=DriverManager.getConnection(ConnURL);}catch(SQLExceptionse){Log.e("ERROR1",se.getMessage());}catch(ClassNotFoundExceptione){Log.e("ERROR2",e.getMessage());}catch(Exceptione){Log.e("ERROR3",e.getMessage());}returnconn;}
}
after i build in my phone this is my problem : "E/ERROR: net.sourceforge.jtds.jdbc.Driver".. can anyone help me for solve this problem please?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you tell us which of the 3 ERRORx cases your error is? You should also use e.toString() instead of getMessage() to make the logs more helpful. I have no experiemce with Android so I dont know if it can work, but it does look like the driver JAR is not found or loaded.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I try some tutorial for connect Android Studio 2.2.3 and MS SQL server 2012:
this is my source code:
import android.annotation.SuppressLint;
import android.os.StrictMode;
import android.util.Log;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/*
* Created by loren10 on 27/12/2016.
/
public class DbHelper {
String ip = "";
String classs = "net.sourceforge.jtds.jdbc.Driver";
String db = "";
String un = "";
String password = "";
}
after i build in my phone this is my problem : "E/ERROR: net.sourceforge.jtds.jdbc.Driver".. can anyone help me for solve this problem please?
Can you tell us which of the 3 ERRORx cases your error is? You should also use e.toString() instead of getMessage() to make the logs more helpful. I have no experiemce with Android so I dont know if it can work, but it does look like the driver JAR is not found or loaded.