Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement