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:

[code]
public void connectdb(String url, String user, String pass) throws
ClassNotFoundException, SQLException {
         Class.forName("com.mysql.jdbc.Driver");
         Connection conn = (Connection)
DriverManager.getConnection("jdbc:mysql://"+url, user, pass);
         conn.close();
}
[/code]

It is being called in this syntax:

[code]
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");
}
[/code]

Where txt_server_host is a string containing an IP and port
("192.168.1.169:33060" 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://
192.168.1.169:3306/".  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$PerformClick.run() 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$MethodAndArgsCaller.run() line: 868
        ZygoteInit.main(String[]) line: 626
        NativeStart.main(String[]) line: not available [native method]

--



Other Threads

1. PKCS#10, BouncyCastle

Hello everyone !

I would like to generate a request of certification (PKCS#10) using
Android.

This feature is available in BouncyCastle and I know that Android uses
some class of it, but unfortunately there is no longer this feature.

Do you know if it is possible to import bouncycastle .jar to an
android project ? (I tried and when my application is launched, it
stopps at the moment some features of BouncyCastle are requested).

Or is there a way to generate PKCS#10 using Android ?

Thanks,

Jiss

-- 

2. Eclair Cache Problem

After switching my phone from Donut to Eclair, I've been experiencing
a lot of performance issues. The phone will work well for a while but
after 15 or 20 minutes of clicking through the UI, it will become
almost completely unresponsive and mostly stay that way. The CPU usage
is pretty low, and there is about 35MB of cache with a few MB of free
RAM. I was using 2.6.29 on both Donut and Eclair, although they have
some modifications on top of that.

When watching `top`, I can see that there is a substantial amount of
IO wait (>50%) when I'm in this state. When I put 1 in block_dump and
watch /proc/kmsg, I see that most of the IO seems to be coming from
kswapd when I'm in this state (the phone doesn't have swap enabled).

I've been trying to figure out the root cause of this, and the two
best indicators that I've found so far are that:

- When I look at /proc/meminfo when I'm in this state, "Active(file)"
and "Inactive(file)" are very low compared to my Donut device (<2MB
versus ~20MB)
- When I run `echo 3 > /proc/sys/vm/drop_caches`, the lag immediately
goes away (for a while)

Could it be that pages are being stuck in the cache? Is there a way
for that to happen? I don't know how to see a good overview from the
cache, although I've been getting systemtap working on my device, so I
hope I can find a point to probe in the kernel to log this
information. The only other alternative to pages being stuck that I've
considered is that there is a setting, which dictates some min/max
amounts for the cache in terms of page cache vs file cache.

Does anyone have suggestions about what I could investigate to find
the root cause of this? I'm not familiar at all with the kernel, but
I've started reading through some of the page cache related code,
though I haven't learned much from that, yet.

Thank you

-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: 

3. Animation using several drawables

4. Icon issue - building with 2.1 sdk for 1.5 target

5. adding a ViewGroup to a ViewGroup

6. Why is the android jar stubbed?

7. GLSurfaceView transparent bg within a ViewGroup