1

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?

2
  • 4
    you don't wana use jdbc on android, belive me, it is a bad idea ... proper way is to use REST service and HTTP protocol(prefer JSON over XML/SOAP as transport) Commented Oct 2, 2013 at 15:06
  • anyway, you can waste your time and try jtds.sourceforge.net but it will be better for your sanity to do some research on REST solution Commented Oct 2, 2013 at 15:16

1 Answer 1

8

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.