没有合适的驱动程序找到sql server Android

时间:2014-07-05 13:31:29

标签: android sql azure

我正在尝试将我的Android应用程序连接到我的天蓝色数据库,以提取一些数据。我关注了互联网上的一些帖子;这给了我下面的代码。现在我知道我必须将jdbc驱动程序添加到我的项目的sql server中;但即使我这样做,我仍然得到上述信息。

有人能给我一些建议吗?

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());
        }

0 个答案:

没有答案