Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
- NetworkInfo netInfo = cm.getActiveNetworkInfo();
- if (netInfo != null && netInfo.isConnectedOrConnecting()) {
- Toast.makeText(getApplicationContext(), "Conectado a Internet", Toast.LENGTH_SHORT).show();
- } else {
- Toast.makeText(getApplicationContext(), "No Conectado", Toast.LENGTH_SHORT).show();
- }
- Connection connection = null;
- String ConnectionURL, servidor, db, usuario, password;
- servidor = "192.168.0.10";
- db="ComercializacionYMarketing";
- usuario="sa";
- password="314159265";
- try {
- StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
- StrictMode.setThreadPolicy(policy);
- Class.forName("net.sourceforge.jtds.jdbc.Driver");
- ConnectionURL = "jdbc:jtds:sqlserver://"+servidor+";databaseName="+db+";user="+usuario+";password="+password+";";
- connection = DriverManager.getConnection(ConnectionURL);
- } catch (SQLException se) {
- Log.e("bug", se.getMessage());
- } catch (ClassNotFoundException e) {
- Log.e("bug", e.getMessage());
- } catch (Exception e) {
- Log.e("bug", e.getMessage());
- }
- }
Add Comment
Please, Sign In to add comment