0

I am trying to connect my android app to my azure DB, to pull some data down. I have followed some posts from the internet; which gave me the below code. Now I know I have to add the jdbc driver to sql server to my project; but even when I do, I still get the above message.

Can anyone give me some advice?

CODE:

 try {

         // SET CONNECTIONSTRING
         Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
         String username = "XXXXXXXXX";
            String password = "XXXXXX";
         Connection DbConn = DriverManager.getConnection("Connection");

         Log.w("Connection","open");
        Statement stmt = DbConn.createStatement();
        ResultSet reset = stmt.executeQuery(" select Category FROM [dbo].[Feeds]");

            Toast toast = Toast.makeText(getApplicationContext(), "Yes", Toast.LENGTH_LONG);
            toast.show();
         //EditText num = (EditText) findViewById(R.id.displaymessage);
       // num.setText(reset.getString(1));

        DbConn.close();

        } catch (Exception e)
        {
            Toast toast = Toast.makeText(getApplicationContext(), "Error connection: " + e.getMessage(), Toast.LENGTH_LONG);
            toast.show();
        //Log.w("Error connection","" + e.getMessage());
        }
ham-sandwich
  • 3,975
  • 10
  • 34
  • 46
user3744373
  • 25
  • 1
  • 8

0 Answers0