title: Android: Cant connect with database on Remote Server
body: <p>Good day, I am creating an Android program that connects to MS SQL 2012 database on a remote server.. Im currently using Eclipse Juno.. my code works on Eclipse Helius but when I transfer my code to Juno, I encounter problems with connecting to database... I already added drivers such as "mysql-connector-java-5.1.33" and "jtds-1.2.5" </p>
  
  <p>Here is my code:</p>
  
  <pre><code>Connection conn = null;
      int a = 0;
      try
      {
  
          Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
          String connString = "jdbc:jtds:sqlserver://xxx.xxx.xxx.xxx:1433/SAMPLEDB;encrypt=false;user=XX;password=XXXXXXX;instance=SQLEXPRESS;";
          String username = "XX";
          String password = "XXXXXXX";
          String sql = "";
  
          conn = DriverManager.getConnection(connString, username, password);
          a++;
          Statement stmt = conn.createStatement();
          a++;
  
          sql = "Select * from NUMBERFILE";
          ResultSet reset = stmt.executeQuery(sql);
  
          a++;
          while(reset.next())
          {
              tDisplayS.setText(reset.getString("NUMBER").toString());
          }
  
      }
      catch(Exception e)
      {
          Toast.makeText(getApplicationContext(), e.getMessage() + " " + a, Toast.LENGTH_LONG).show();
      }
  </code></pre>
  
  <p>I used "a" to indicate where it would stop then it only has a value of 1 so meaning it cant establish connection.. I already searched for similar problems with mine but still no luck..</p>
  
  <p>Please help.. appreciate all your reply.. </p>
  
  <p>Thanks!</p>