Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SuppressLint("NewApi")
- private Connection CONN(String _user, String _pass, String _DB,
- String _server) {
- StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
- .permitAll().build();
- StrictMode.setThreadPolicy(policy);
- Connection conn = null;
- String ConnURL = null;
- try {
- Class.forName("net.sourceforge.jtds.jdbc.Driver");
- ConnURL = "jdbc:jtds:sqlserver://" + _server + ";"
- + "databaseName=" + _DB + ";user=" + _user + ";password="
- + _pass + ";";
- conn = DriverManager.getConnection(ConnURL);
- } catch (SQLException se) {
- Log.e("ERRO", se.getMessage());
- } catch (ClassNotFoundException e) {
- Log.e("ERRO", e.getMessage());
- } catch (Exception e) {
- Log.e("ERRO", e.getMessage());
- }
- return conn;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement