Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public void connectToDataBase()
  2. {
  3. String Url = "jdbc:sqlserver://localhost:1433;user=iago;password=iuri12";
  4.  
  5. StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
  6. StrictMode.setThreadPolicy(policy);
  7.  
  8. try
  9. {
  10. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  11. conn = DriverManager.getConnection(Url);
  12.  
  13. Log.d("Conexão", "conectou");
  14. } catch (Exception e)
  15. {
  16. e.printStackTrace();
  17. Log.d("Conexão", "não conectou");
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement