App crashing after JDBC DB connection attempt

by josh s » Wed, 30 Jun 2010 02:51:43 GMT

Sponsored Links
 I wrote a function that is supposed to connect to a DB, then close the
connection, for testing purposes, on Android. This is the function:

public void connectdb(String url, String user, String pass) throws
ClassNotFoundException, SQLException {
         Connection conn = (Connection)
DriverManager.getConnection("jdbc:mysql://"+url, user, pass);

It is being called in this syntax:

try {
        connectdb(txt_server_host, txt_username, txt_password);
        popupNotification("Yes!", "Connected successfully!");
} catch (ClassNotFoundException e) {
        popupNotification("ClassNotFoundException", "Error");
} catch (SQLException e) {
        popupNotification("SQLException", "Error");

Where txt_server_host is a string containing an IP and port
("" for testing), txt_username and txt_password
contain just plain strings. I know I can successfully connect to the
host (outside my app), since it is also a web server, and Browser can
bring up a page off it. Any ideas? I have the MySQL connector in my
classpath. I just wrote a small function to create a popup with the
attempted URL. It seems correct so far: "jdbc:mysql://".  The app's only permission is Internet.

Stack trace:
Thread [<1> main] (Suspended (exception VerifyError))
        DriverManager.getConnection(String, Properties) line: 196
        DriverManager.getConnection(String) line: 154
        myapp$1.connectdb(String, String, String) line: 66
        myapp$1.onClick(View) line: 53
        Button(View).performClick() line: 2408
        View$ line: 8816
        ViewRoot(Handler).handleCallback(Message) line: 587
        ViewRoot(Handler).dispatchMessage(Message) line: 92
        Looper.loop() line: 123
        ActivityThread.main(String[]) line: 4627
        Method.invokeNative(Object, Object[], Class, Class[], Class, int,
boolean) line: not available [native method]
        Method.invoke(Object, Object...) line: 521
        ZygoteInit$ line: 868
        ZygoteInit.main(String[]) line: 626
        NativeStart.main(String[]) line: not available [native method]


Other Threads

1. Android Hacking For The Masses

Reasons to hack, or "root," your Android handset: Custom OS upgrades,
PC tethering, full-phone SD backups. Reason not to: It's really scary.
At least it was, until now.

RyeBrye has pieced together an Android app that does all the rooting
legwork, a process that used to range from mildly intimidating to
headache-inducing. In either case, the prospect was always daunting
for the mainstream, which kept the joys of an unbound Android from
most G1 and MyTouch owners. With this app, here's the new, streamlined

Download "Recovery Flasher" From the Android Market (or sideload it)
Run it
Tap "Back up recovery image"
Tap "Flash Cyanogen Recovery 1.4"

Seriously, that's it. Now your Android phone is splayed wide open, and
ready for you to have your way with it. But, uh, what does that mean,

Plenty of things! The biggest draw to rooting is the ability to
install a new ROMn other words, replace the operating system on your
phone. There are two ways to go with this, both equally awesome. The
first is to go with a super-customized community ROM. These are
tweaked and enhanced versions of the phone's default software, often
grafted with pieces of Google's forthcoming updates to Android, some
near, some far, and all dessert-themed. Practically, this means
multitouchince the G1 and MyTouch already support this on the
hardware sidepp storage on SD cards, tethering, more home screens,
new system keyboards, and perhaps most importantly, vastly improved
performance. A lot of users say using one of these is a night-and-day
difference, and given the kinds of things the HTC ROM community has
done with Windows Mobile phones, I'm inclined to believe them.

Your second path is to go full Heron other words, to install the HTC
Hero's heavily customized OS, which is nothing short of fantastic, and
about to get even better. This is a full phone conversion, and even in
its current, slightly precarious state, well worth it.

In either case, you're going to need to choose a ROM, download it, and
put it on your phone's SD card. You can select from an expansive list
hereor reference, the MyTouch 3G is also known as the Magic 32But
as far as non-Hero ROMs go, your best bet is the near-legendary, well-
supported CyanogenMod. The newest release, out just two days ago, is
fully compatible with the G1 and MyTouch. But don't stress too much
over which ROM to choose, since changing them over is a breeze now
that you're fully unlocked. An overview from Android and Me:

    Power off your phone.
    Boot into recovery mode. Press and hold the Home key, then hit
the power button.
    Before you flash a rom file, perform a wipe. Press Alt+W to wipe
the data and cache folders. You must wipe when going form different
builds of Android.
    Wait for the wipe to finish and the recovery image to display
again, then select "apply any zip from sd". Flash the zip file of your
    After flashing any zip you should be able to reboot your system
and watch it load to the home screen.

You'll want to read their full rooting and flashing guide for caveats,
but that easy little list there is about the size of it.

A few more reasons to root that don't involve totally flashing your

Full backups to SD cards
Wi-Fi tethering!
Autorotation for all apps
Install apps to an SD card

This alongside a treasure trove of smaller tweaks and tricks you can
find at the every-active XDA forums. And of course, it should go
without saying: this is potentially risky, and could brick your phone.
The rooting process is almost foolproof, but before you jump in, make
sure you've got the right hardware (American MyTouch 3Gs and G1s only)
and have backed up any important data. Happy hacking! [RyeBrye,

2. creating a driver for a smart card


I'm trying to figure out how to create and install a driver for a
smart card in the Android phone.  This may not be the right place to
post this question, but I've done some research and and played around
with a couple of things but I'm still a bit lost.  I could really use
some help making sure that I am pointed in the right direction.

Where is the best place to get started for creating a driver for the
phone?  What I've already been looking at is the ndk and the Android
open source.  I don't know how to set up a stand-alone driver using
the ndk and I'm not sure where in the open source I need to be placing
my source or object file.

Another question I have with the open source is, say I have the driver
all set up properly and everything builds just fine, how do I get this
to the phone to be able to test it?

Thanks for the help.


3. Does OpenGL implementation support GL_AMD_compressed_* extensions?

4. Regarding Android supported OpenGL version

5. How to use OverlayItem's fields (Title and snippet)?

6. large database file

7. possible bug in android browser when accessing site with htaccess/htpasswd?