4 messages in com.googlegroups.android-beginners[android-beginners] Re: failure to co...
FromSent OnAttachments
scimitar23 Apr 2008 00:37 
Justin (Google Employee)24 Apr 2008 13:46 
scimitar24 Apr 2008 20:37 
Justin (Google Employee)07 May 2008 11:42 
Subject:[android-beginners] Re: failure to connect to database
From:scimitar (umar@gmail.com)
Date:04/24/2008 08:37:29 PM
List:com.googlegroups.android-beginners

Hi Justin,

thanks. I'm now trying to connect to a webservice, and for that I need to import java.rmi.RemoteException. But the Android Eclipse plugin is not letting me do that. It is giving the error message: 'The import java.rmi.RemoteException cannot be resolved'. Is it because Android doesn't support this library. What could be the solution for this ?

-umar

On Apr 24, 4:47 pm, "Justin (Google Employee)" <j.@google.com> wrote:

Try searching this forum for "mysql"
(http://groups.google.com/group/android-developers/search?group=androi... ) or "jdbc"
(http://groups.google.com/group/android-developers/search?group=androi... ) .

The short answer, however, is that you can't or maybe you can, but it'll be incredibly difficult. Android doesn't have support for arbitrary third-party libraries because they may rely on Java libraries we don't support. Remember, Android does *not* run Java bytecode, despite the fact that code for Android is written in the Java language.

The slightly longer answer to this question is that you don't want to do this anyway. JDBC was not a communications protocol that was designed to run over unreliable, high latency, low bandwidth data connections like most cellular devices will have. Using JDBC is most likely going to lead to a horrible experience for users. What is a better idea is to expose your data via an HTTP-based interface. HTTP was built to handle the communications environment that Android devices are most likely to live in.

Cheers, Justin Android Team @ Google

On Apr 23, 12:37 am, scimitar <umar@gmail.com> wrote:

Hi,

I'm trying to connect to an external mysql database. The code is something like:

try

{ Class.forName(DBCLASS).newInstance(); } catch (Exception e) { Log.i("DataLayer", "unable to load jdbc driver"); } // Connect to the database //
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.