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] -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en