Re: [android-developers] How to connect to MySQL db
I think you have to connect MySQL via PHP as backend with HTTP requests and JSON parameters to send and receive data from/to database. On Fri, Aug 10, 2012 at 10:41 AM, Fabien R wrote: > On 03/08/2012 17:05, Andrey Shloma wrote: > > Now i user mysql-connector-java-5.1.21-bin.jar library > > And try next code: > > > This is not the way to connect to database on android. > You have to send http requests to a web service. > - > Fabien > > -- > 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 > -- 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
Re: [android-developers] How to connect to MySQL db
On 03/08/2012 17:05, Andrey Shloma wrote: > Now i user mysql-connector-java-5.1.21-bin.jar library > And try next code: > This is not the way to connect to database on android. You have to send http requests to a web service. - Fabien -- 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
[android-developers] How to connect to MySQL db
Now i user mysql-connector-java-5.1.21-bin.jar library And try next code: private static final String CONNECTION = "jdbc:mysql://x.x.x.x:3306/db"; private void getMySQLConnection() { Connection con = null; String str_res = ""; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); // Properties for user and password. Properties p = new Properties(); p.put("user","***"); p.put("password","***"); // Now try to connect Connection c = DriverManager.getConnection(CONNECTION, p); } catch (Exception e) {} Exception code: com.mysql.jdbc.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. -- 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