简体   繁体   中英

java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver

I am using Eclipse with Android SDK.

I want to access to SQL Server 2008.

When I used String ...

classforname= "sun.jdbc.odbc.JdbcOdbcDriver";

I get the following error:

java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver

I used JDK 1.7 and configured build pbath to rt.jar.

What am I doing wrong?

What am I doing wrong?

You are attempting to use ODBC on Android. ODBC is a Windows technology, and Android is not Windows. There is no sun.jdbc.odbc.JdbcOdbcDriver on Android.

You will need to find some other solution for your database access. Selvin's suggestion of a REST Web service is the typical approach.

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