Well, java.sql.NClob appears to be the problem. It looks like that
class is in rt.jar in a normal Java jre. Probably not part of Android
because I doubt they expect people to be doing this (I agree with
Charlie on why). I don't know why you don't have a choice, but I'll
say it looks like a bad design if someone has restricted you to doing
that.

So, if it's absolutely the only way you can do this, it *might* be
possible to extract the classes you need from rt.jar and include them
in your application. I think the dx tool will handle converting them
to dalvik. Not sure what the licensing is on doing something like
that. Might want to read it.

On Apr 23, 12:25 pm, scimitar <[EMAIL PROTECTED]> wrote:
> Hi, thanks for your reply. But I really have no choice in this matter.
> Using JDBC is my best bet here, and I would appreciate if somebody
> could tell me what's going on.
>
> On Apr 23, 2:56 pm, Charlie Collins <[EMAIL PROTECTED]> wrote:
>
> > I don't have any insight to help in terms of answering your question
> > about using a JDBC driver from Android, but would offer one
> > suggestion: don't try it to begin with.
>
> > You would probably be a lot better off connecting to a server using
> > XML over HTTP (RESTy) or such, and then doing your JDBC stuff on the
> > *server*. Write your own RESTy DAL API on the server side, and connect
> > to that from Android - a lot more performant (and easier to maintain
> > going forward, decoupling), and you can control all the data aspects
> > on the server using any library or technology you want.
>
> > Going directly from the Android client to adatabaseserver over JDBC
> > is going to be problematic, and even if you do get it to work, a lot
> > more overhead than using a server. Remember it's a small embedded
> > device.
>
> > On Apr 23, 3:38 am, scimitar <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I'm trying to connect to an external mysqldatabase. The code is
> > > something like:
>
> > > try
>
> > > >        {
> > > >            Class.forName(DBCLASS).newInstance();
> > > >        }
> > > >        catch (Exception e)
> > > >        {
> > > >            Log.i("DataLayer", "unable to load jdbc driver");
> > > >        }
> > > >              // Connect to thedatabase
> > > >        // 
> > > > jdbc:mysql://[hostname][,failoverhost...][:port]/[dbname][?param1=value1][&param2=value2].....
>
> > > >        try
> > > >        {
> > > >            connection = DriverManager.getConnection(
> > > >                DBCONNSTRING + DBHOST + "/" + DBNAME + "?user=" + USER + 
> > > > "&password=" + PASSWORD);
>
> > > >        }
> > > >        catch (Exception e)
> > > >        {
>
> > > >        }
>
> > > Basically the 'DriverManager.getConnection()' call fails. The error
> > > messages are:
>
> > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
>
> > > > PathClassLoader.java:205 not caught locally
> > > > D/dalvikvm(  596): NOTE: loadClass 'java.sql.NClob' 0x40069968 threw
> > > > an exception
> > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > PathClassLoader.java:205 not caught locally
> > > > D/dalvikvm(  596): NOTE: loadClass
> > > > 'com.mysql.jdbc.LocalizedErrorMessages_en_US' 0x40069968 threw an
> > > > exception
> > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > PathClassLoader.java:205 not caught locally
> > > > D/dalvikvm(  596): NOTE: loadClass
> > > > 'com.mysql.jdbc.LocalizedErrorMessages_en' 0x40069968 threw an exception
> > > > I/dalvikvm-heap(  596): GC! (75 sec since last GC)
> > > > I/dalvikvm-heap(  596): GC old usage 90.6%; now 0.985MB used / 1.971MB
> > > > soft max (2.062MB real max)
> > > > I/dalvikvm-heap(  596): GC freed 1736 objects / 106824 bytes in 56ms
> > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > PathClassLoader.java:205 not caught locally
> > > > D/dalvikvm(  596): NOTE: loadClass
> > > > 'com.mysql.jdbc.LocalizedErrorMessages' 0x40069968 threw an exception
> > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > PathClassLoader.java:205 not caught locally
> > > > D/dalvikvm(  596): NOTE: loadClass
> > > > 'com.mysql.jdbc.LocalizedErrorMessages_en_US' 0x40018950 threw an
> > > > exception
> > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > PathClassLoader.java:205 not caught locally
> > > > D/dalvikvm(  596): NOTE: loadClass
> > > > 'com.mysql.jdbc.LocalizedErrorMessages_en' 0x40018950 threw an exception
> > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > PathClassLoader.java:205 not caught locally
> > > > D/dalvikvm(  596): NOTE: loadClass
> > > > 'com.mysql.jdbc.LocalizedErrorMessages' 0x40018950 threw an exception
> > > > D/dalvikvm(  596): Exception Ljava/lang/RuntimeException; from
> > > > Messages.java:68 not caught locally
> > > > W/dalvikvm(  596): Exception Ljava/lang/RuntimeException; thrown
> > > > during Lcom/mysql/jdbc/Messages;.<clinit>
> > > > D/dalvikvm(  596): Exception Ljava/lang/ExceptionInInitializerError;
> > > > from Util.java:350 not caught locally
> > > > W/dalvikvm(  596): Exception Ljava/lang/ExceptionInInitializerError;
> > > > thrown during Lcom/mysql/jdbc/Util;.<clinit>
> > > > D/dalvikvm(  596): Exception Ljava/lang/ExceptionInInitializerError;
> > > > from ViewRoot.java:964 not caught locally
> > > > D/dalvikvm(  596): Exception Ljava/lang/ExceptionInInitializerError;
> > > > from ZygoteInit.java:1555 not caught locally
>
> > > I would really appreciate if somebody could help me.
>
> > > thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to