i tried mysql connection through jdbc in android....here i added dis code in myapplication.java file.
Code:
// interact with <em>MySQL</em>!!!
private View.OnClickListener onSendRequest = new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText username = (EditText) findViewById(R.id.Huusername);
// String un = " " + username.getText().toString() + " ";
System.out.println("<em>MySQL</em> Connect Example.");
Connection conn = null;
String url = "jdbc:<em>mysql</em>://localhost:3306/";
String dbName = "database";
String driver = "com.<em>mysql</em>.jdbc.Driver";
String userName = "root";
String password = "";
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
Toast.makeText(getBaseContext(),
"Connected to the database.", Toast.LENGTH_LONG)
.show();
conn.close();
Toast.makeText(getBaseContext(),
"Disconnected form the database.", Toast.LENGTH_LONG)
.show();
} catch (<em>Exception</em> e) {
Toast.makeText(getBaseContext(),
"<em>Exception</em> e.", Toast.LENGTH_LONG)
.show();
e.printStackTrace();
}
}
};
...Here i got dis error in my console part:
Dxwarning: Ignoring InnerClasses attribute for an anonymous inner class
(com.<em>mysql</em>.jdbc.interceptors.ResultSetScannerInterceptor$ 1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
------------------------------------------------------------------------
Then my logcat also having one error:
dexopt cannot open '/data/dalvik-cache/data@app@com.login.register-2.apk@classes.dex' for output...
how is cleared both error.plz help me.