public void connectionToDataBase() { try { TextView textViewWhere = (TextView) findViewById(R.id.dateStart); TextView textViewFrom = (TextView)findViewById(R.id.dateEnd); EditText editTextTickets = (EditText)findViewById(R.id.tickets); String userName = "1111"; String password = "1111"; String url = "jdbc:mysql://77.87.193.68/abcd"; Class.forName ("com.mysql.jdbc.Driver").newInstance (); conn = DriverManager.getConnection (url, userName, password); String insertDataIntoSQL = "INSERT INTO BUS_ORDER(pay_status, real_date_from, real_date_back)values('no', '" + textViewFrom.getText() +"', '" +textViewWhere.getText() +"')"; Statement statement = conn.createStatement(); statement.executeUpdate(insertDataIntoSQL); } catch (Exception e) { System.err.println ("Cannot connect to database server"); e.printStackTrace(); } finally { if(conn != null) { try{ conn.close(); } catch(Exception e) {} } } } public void Bronirovat(View v) { connectionToDataBase(); startActivity(new Intent(this, Tickets.class)); } 

I can not add data to the table, more precisely to the columns. What could be the problem? JDBC drivers were placed in the folder C: \ Program Files \ Java \ Jre1.8.0_77 \ lib \ ext. Nowhere else did I prescribe and did nothing.

  • where are the error messages? The code is monstrous, of course (sorry). Try on Traa and chase trai. How are yavists living, interesting? - strangeqargo
  • @strangeqargo there are actually no errors, the application switches to another activity - Kirill Avdeev
  • To push in one try and connection and insert - not the best idea, by the way. close and open a connection for each request - IMHO - is also not very. - strangeqargo pm
  • <uses-permission android:name="android.permission.INTERNET" /> registered in manifest.xml ? - no news
  • @nonews yes registered - Kirill Avdeev

0