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. [WTA] Mohon bantu pilih Fascinate VS Droid X

As subject, mohon bantuan masukan pengguna kedua HH diatas untuk ngeracun
memilih salah satu antara Fascinate VS Droid x. Kebetulan lagi lirik lirik
android CDMA.


2. Help needed tabs

Hi all,
Please share the xml code for adding multiple edittexts in a single tab .
Thanks alot


3. Perbandingan ZTE Tab dan HUawei Ideos S7

4. How to launch the interface for incoming/outgoing calls ?

5. what is the difference between progressdialog and progressbar?

6. hapus file bawaan sprint evo 4G

7. Salam Nubie