최근에 내 AVD 및 Eclipse ADT를 업데이트했습니다. 업데이트 후 내 안드로이드 프로젝트가 제대로 실행되지 않습니다.Android Mysql 연결이 작동하지 않습니다.
제대로 작동하지 않는 부분은 mysql 데이터베이스에 대한 연결입니다.
내 코드 :
String data= "";
String database(){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn=DriverManager.getConnection("jdbc:mysql://10.0.2.2:3306/sakila","root","warlock");
PreparedStatement stmt= conn.prepareStatement("Select * from actor");
ResultSet res=stmt.executeQuery();
int i=0;
while(res.next() && i <9)
{
data=data+res.getString("actor_id") + " " + res.getString("first_name") + "&";
System.out.println(data);
i++;
}
}
catch(Exception e)
{
System.out.println(e); }
TextView tv=(TextView) findViewById(R.id.textview);
tv.setText(data);
업데이트하기 전에 그것은 벌금을 부과했다. 나는 PHP를 통해 연결할 필요가 없었어요. 이것에서 무엇이 잘못 될 수 있습니까? 나는 오늘 아침에 업데이트를했다. 5:30 IST
에 인터넷 권한을 추가인가? – Yahor10
아니요 LogCat 또는 Console에서 작동 할 때 출력을 제공함에 따라 디버그 할 수 있는지 확인하기 위해 썼습니다. 정확하게 기억하지 못합니다. – Brooklyn