Android:使用JDBC?

你可以在android上使用JDBC驱动程序吗? 我发现是假设支持android的blobdb,但我似乎无法得到它的工作我得到java.sql.SQLException:当试图从查询中获得结果的权限被拒绝:(

                  try{

                  Class.forName("org.vnetcon.blobdb.driver.jdbc.BlobDBDriver").newInstance();
                  Connection con = DriverManager.getConnection("blobdb|http://localhost:3306/test|username=root|password=password");
                  Statement stmt = con.createStatement();
                    String bSQL = "SELECT Name FROM newtable ";
                    ResultSet rs = stmt.executeQuery(bSQL); // throws exception here
                      while (rs.next()) {
                            tmp.popupMessage(getApplicationContext(),rs.getString("Name"));
                      }
              }catch(Exception ex){
                  tmp.popupMessage(getApplicationContext(),":("+ ex.toString());
              }

好,所以我修正了原来的错误,现在我在结果即将被查看的同一个地方得到一个零点异常:

try{

            Class.forName("org.vnetcon.blobdb.driver.jdbc.BlobDBDriver").newInstance();
            Connection con = DriverManager.getConnection("blobdb|http://192.168.0.100:3306/test|username=root|password=houlahan");
            String query = "SELECT Name FROM anotheTest";
            try
            {
                Statement st = con.createStatement();
                ResultSet rs = st.executeQuery(query);
                while (rs.next())
                {
                  String s = rs.getString("Name");
                  tmp.popupMessage(getApplicationContext(),s);
                }
            }catch(Exception e){
                tmp.popupMessage(getApplicationContext(), e.toString());
            }                  
        }catch(Exception ex){
            tmp.popupMessage(getApplicationContext(),":("+ ex.toString());
        }

我已经尝试了与原始版本,如果桌面应用程序的jdbc驱动程序,它收到结果我希望任何人都得到任何建议我怎么能得到一个jdbc驱动程序在Android手机上工作? :/

提前致谢。


以下链接可能会有所帮助 - 如何向android应用程序添加清单权限

在我第一次在OpenLink软件中测试了一些JDBC驱动程序时,我自己遇到了这个问题......


如果查询返回该错误,那么您应该开始思考,可能不是关于Android或使用的jdbc。 你应该看看你的数据库设置。

链接地址: http://www.djcxy.com/p/94249.html

上一篇: Android: using JDBC?

下一篇: View's getWidth() and getHeight() returns 0