我只是想将数据发送到服务器.但它没有这样做,我已粘贴我的程序,请更正它.
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
System.out.println("before try blockkkkkkkkkkkkkkkkkkkkkkkk");
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println("after loading of driverssssssssssssssssssssss");
Connection con=DriverManager.getConnection("jdbc:mysql://111.118.182.212/dbbio","root", "");
System.out.println("after creating coonnectionnnnnnnnnnnnnnnn");
Statement stmt=con.createStatement();
String SQL="insert into LKRAJ VALUES ('02','01','amritsar','01','mohali','lkraj')";
stmt.executeUpdate(SQL);
} catch (Exception e) {
// TODO: handle exception
Toast.makeText(this,"can not create connectionnnnnnn",Toast.LENGTH_LONG).show();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的logcat错误是:
04-15 06:07:15.107: E/ActivityThread(558): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d31a88 that was originally bound here
04-15 06:07:15.107: E/ActivityThread(558): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection …Run Code Online (Sandbox Code Playgroud)