0

我正在使用 Eclipse MS SQL SERVER 2005 Android 4.2.2 设备 jtds-1.2.6。罐

我将 jar 文件添加到 Project->Properties->Java Build Path-> Add External jars 之后检查 ORDER 和 EXPORT INTERNET 并且 ACCESS_NETWORK 是 ALLOW MINIMUM SDK=4

void Connect()
{
  try 
  {
      Class.forName("net.sourceforge.jtds.jdbc.Driver");
  } 
  catch (ClassNotFoundException e) 
  {
    tv.setText("3"+e.getMessage());
  } 
  try 
  {
    Connection conn=DriverManager.getConnection(
                 "jdbc:jtds:sqlserver://192.168.1.103:1433/DB","sa","1");

    Statement query = conn.createStatement();
    ResultSet rs = query.executeQuery("select NAME  from Student");
    String yazi = "";
    while (rs.next()) 
    {
      tv.setText(rs.getString(0));
    }
     conn.close();

    } 
    catch (SQLException e) 
    {
      tv.setText("4"+e.getMessage());
    }
    catch(Exception ee)
    {
      tv.setText("7"+ee.toString());
    }
 }

当我将程序运行到设备时,它停在 DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.1.103:1433/DB","sa","1");

问题是什么?

4

0 回答 0