我只是想将数据发送到服务器。但它不这样做,我已经粘贴了我的程序,请更正它。
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();
}
}
}
我的 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 com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d31a88 that was originally bound here
04-15 06:07:15.107: E/ActivityThread(558): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
04-15 06:07:15.107: E/ActivityThread(558): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
04-15 06:07:15.107: E/ActivityThread(558): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
04-15 06:07:15.107: E/ActivityThread(558): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
04-15 06:07:15.107: E/ActivityThread(558): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
04-15 06:07:15.107: E/ActivityThread(558): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
04-15 06:07:15.107: E/ActivityThread(558): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
04-15 06:07:15.107: E/ActivityThread(558): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
04-15 06:07:15.107: E/ActivityThread(558): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
04-15 06:07:15.107: E/ActivityThread(558): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
04-15 06:07:15.107: E/ActivityThread(558): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
04-15 06:07:15.107: E/ActivityThread(558): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
04-15 06:07:15.107: E/ActivityThread(558): at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-15 06:07:15.107: E/ActivityThread(558): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-15 06:07:15.107: E/ActivityThread(558): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-15 06:07:15.107: E/ActivityThread(558): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-15 06:07:15.107: E/ActivityThread(558): at java.lang.Thread.run(Thread.java:856)
04-15 06:07:15.246: E/StrictMode(558): null
04-15 06:07:15.246: E/StrictMode(558): android.app.ServiceConnectionLeaked: 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.246: E/StrictMode(558): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
04-15 06:07:15.246: E/StrictMode(558): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
04-15 06:07:15.246: E/StrictMode(558): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
04-15 06:07:15.246: E/StrictMode(558): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
04-15 06:07:15.246: E/StrictMode(558): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
04-15 06:07:15.246: E/StrictMode(558): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
04-15 06:07:15.246: E/StrictMode(558): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
04-15 06:07:15.246: E/StrictMode(558): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
04-15 06:07:15.246: E/StrictMode(558): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
04-15 06:07:15.246: E/StrictMode(558): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
04-15 06:07:15.246: E/StrictMode(558): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
04-15 06:07:15.246: E/StrictMode(558): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
04-15 06:07:15.246: E/StrictMode(558): at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-15 06:07:15.246: E/StrictMode(558): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-15 06:07:15.246: E/StrictMode(558): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-15 06:07:15.246: E/StrictMode(558): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-15 06:07:15.246: E/StrictMode(558): at java.lang.Thread.run(Thread.java:856)
04-15 06:07:15.246: W/ActivityManager(288): Unbind failed: could not find connection for android.os.BinderProxy@40e07cd0
04-15 06:07:15.376: E/ActivityThread(558): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40ce6e38 that was originally bound here
04-15 06:07:15.376: E/ActivityThread(558): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40ce6e38 that was originally bound here
04-15 06:07:15.376: E/ActivityThread(558): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
04-15 06:07:15.376: E/ActivityThread(558): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
04-15 06:07:15.376: E/ActivityThread(558): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
04-15 06:07:15.376: E/ActivityThread(558): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
04-15 06:07:15.376: E/ActivityThread(558): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
04-15 06:07:15.376: E/ActivityThread(558): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
04-15 06:07:15.376: E/ActivityThread(558): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
04-15 06:07:15.376: E/ActivityThread(558): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
04-15 06:07:15.376: E/ActivityThread(558): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
04-15 06:07:15.376: E/ActivityThread(558): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
04-15 06:07:15.376: E/ActivityThread(558): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
04-15 06:07:15.376: E/ActivityThread(558): at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-15 06:07:15.376: E/ActivityThread(558): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-15 06:07:15.376: E/ActivityThread(558): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-15 06:07:15.376: E/ActivityThread(558): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-15 06:07:15.376: E/ActivityThread(558): at java.lang.Thread.run(Thread.java:856)
04-15 06:07:15.496: E/StrictMode(558): null
04-15 06:07:15.496: E/StrictMode(558): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40ce6e38 that was originally bound here
04-15 06:07:15.496: E/StrictMode(558): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
04-15 06:07:15.496: E/StrictMode(558): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
04-15 06:07:15.496: E/StrictMode(558): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
04-15 06:07:15.496: E/StrictMode(558): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
04-15 06:07:15.496: E/StrictMode(558): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
04-15 06:07:15.496: E/StrictMode(558): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
04-15 06:07:15.496: E/StrictMode(558): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
04-15 06:07:15.496: E/StrictMode(558): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
04-15 06:07:15.496: E/StrictMode(558): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
04-15 06:07:15.496: E/StrictMode(558): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
04-15 06:07:15.496: E/StrictMode(558): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
04-15 06:07:15.496: E/StrictMode(558): at android.os.AsyncTask$2.call(AsyncTask.java:287)
04-15 06:07:15.496: E/StrictMode(558): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
04-15 06:07:15.496: E/StrictMode(558): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
04-15 06:07:15.496: E/StrictMode(558): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
04-15 06:07:15.496: E/StrictMode(558): at java.lang.Thread.run(Thread.java:856)
04-15 06:07:15.506: W/ActivityManager(288): Unbind failed: could not find connection for android.os.BinderProxy@40e2be70