Android: using JDBC?

can you use the JDBC driver on android? i have found blobdb that is suppose to support android but i cant seem to get it to work i get get java.sql.SQLException: Permission denied when trying to get the results from the query :(

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

ok so i fixed the original error now i get a null point exception in the same place where the results are about to be viewed:

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

i have tried it with a original version if the jdbc driver for desktop applications and it receives the results i wish anyone got any suggestions on how i can get a jdbc driver to work on a android phone? :/

thanks in advance.


The following link might help -- How to add manifest permission to android application

I came across this myself the first time I tested some of our JDBC Drivers here at OpenLink Software...


If the query returned that error you shoud start thinking that maybe isn´t about Android or the jdbc used. You shoud look at your DB settings.

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

上一篇: Android JDBC不工作:驱动程序上的ClassNotFoundException

下一篇: Android:使用JDBC?