简体   繁体   中英

Error while Connecting to MS Access Database From Android

I'm trying to retrieve data's from MS Access Database on my desktop. I didn't add any external jar file to retrieve data actually i don't know whether i have to export any external jar file for accomplishing this. Here is the code which i'm using to connect to Ms Access Database on my PC.

String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
            Class.forName(driver).newInstance();
            String path="D:/MS ACCESS DATABASE/mydatabase.mdb";
            conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver  (*.mdb)};DBQ="+path+";","","root" );
            Log.w("Connection", "open");
            Statement stmt = conn.createStatement();
            ResultSet reset = stmt.executeQuery("select * from tblEmp");

while executing this i'm getting following error on my log-cat

10-25 11:31:40.545: W/Error connection(422): sun.jdbc.odbc.JdbcOdbcDriver

Please Help me to Solve this issue??

You can not connect from Android to MS Access using Sun's JDBC-ODBC Bridge. The JDBC-ODBC Bridge from sun will only connect to a local server not a remote one. There is a commercial option from Easysoft in there JDBC-ODBC Bridge . This can connect from a Java application / applet to a remove server and then on to an MS Access ODBC data source.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM