외부db 이용하는 법을 알고싶어요 ㅠㅠ
안드로이드에서 외부db에 직접 접근하기 보다는 중간에 web-server를 거칠려고 합니다..
public class TestHttpGet {
public void excuteHttpGet() throws Exception{
BufferedReader in =null;
try{
HttpClient client = new DefaultHttpClient();
HttpGet request= new HttpGet();
request.setURI(new URI("http://code.google.com/android/"));
HttpResponse response=client.execute(request);
in= new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer sb= new StringBuffer("");
String line="";
String NL=System.getProperty("line.separator");
while((line=in.readLine())!=null){
sb.append(line+NL);
}
in.close();
String page=sb.toString();
System.out.println(page);
}finally{
if(in!=null){
try{
in.close();
}catch(IOException e){
e.printStackTrace();
}
}
}
}
}
위의 코드 방식으로 예를들자면 request.setURI(new URI("웹서버 주소"));
이런식으로 해줘야되는건가요/????ㅠㅠ
도저히 감이 안잡혀서..........
도와주세요!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!