Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SQL server 2008 R2 connection error / android
- System.out.println("MySQL Connect Example.");
- Connection conn = null;
- String url = "jdbc:jtds:sqlserver://192.168.2.101:1433/INSERTGT";
- String dbName = "podmiot";
- String driver = "net.sourceforge.jtds.jdbc.Driver";
- String userName = "msi";
- String password = "keyboa5";
- try {
- Class.forName(driver).newInstance();
- conn = DriverManager.getConnection(url+dbName,userName,password);
- System.out.println("Connected to the database");
- int duration = Toast.LENGTH_SHORT;
- Toast.makeText(getApplicationContext(), "Connected to the database", duration);
- conn.close();
- System.out.println("Disconnected from database");
- EditText edit1 = (EditText)findViewById(R.id.editText1);
- edit1.setText("Disconnected from database");
- } catch (Exception e) {
- e.printStackTrace();
- TextView edit1 = (TextView)findViewById(R.id.exception);
- edit1.setText("Problem: " + e.toString());
- }
Add Comment
Please, Sign In to add comment