SHARE
TWEET

Untitled

a guest Dec 6th, 2016 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  private class consulta extends AsyncTask<Void, Void, Void> {
  2.  
  3.  
  4.  
  5.         @Override
  6.         protected Void doInBackground(Void... params) {
  7.  
  8.  
  9.             try {
  10.  
  11.                 //conexion
  12.                 Class.forName("com.mysql.jdbc.Driver");
  13.                 String url = "jdbc:mysql://mysql.ulearnet.com:3306/ulearnet_des";//"jdbc:mysql:///10.0.3.2:3306/dbname"
  14.                 Connection c = DriverManager.getConnection(url, "ulearnet_des", "ulearnet_des@");
  15.  
  16.                 //declaro el statement con la query para despues ejecutarla
  17.                 PreparedStatement st = c.prepareStatement(query1);
  18.                
  19.  
  20.                
  21.          
  22.                 st.execute();//se ejecuta la query
  23.                 st.close();//cierro el statement con la query
  24.                 c.close();//cierro la conexion
  25.  
  26.             } catch (ClassNotFoundException | SQLException e) {
  27.                 e.printStackTrace();
  28.  
  29.             }
  30.  
  31.  
  32.             return null;
  33.         }
  34.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top