如何从Android应用程序访问Oracle数据库。

问题描述:

Android应用程序将在数据库服务器从显示的外部数据库(Oracle)的数据。它可以是可能只有 Web服务(REST风格),所以我决定发展中的Java / Java EE的本身就是一个Web服务。
我不想去与PHP或其他一些technologies.Pls建议我继续这样。

Android application which will show data from external Data Base(Oracle) in the database server .It can be possible only with web services(RESTful),so i decided to develop a web services in Java/Java EE itself. I dont want go with PHP or some other technologies.Pls suggest me to proceed this.

依赖于Web服务。难道仅仅是RESTful的XML? JAX-WS? JSON? Etc.Either方式,它应该是为呼唤与HTTP套接字,并解析响应一样简单。

Depends on the web service. Is it just RESTful XML? JAX-WS? JSON? Etc.Either way it should be as easy as calling out with an HTTP socket and parsing the response.

要创建一个Web服务按照下面的链接

To create a web-service follow the below link

REST Web服务

使用了HTTPClient

using Using HTTPClient

public static String hitService(String host, int port, String path, String postBody) throws IOException {
        HttpHost target = new HttpHost(host, port);
        HttpClient client = new DefaultHttpClient();
        HttpGet get = new HttpGet(path);
        HttpEntity results = null;
        try {
            HttpResponse response=client.execute(target, get);
            results = response.getEntity();
            return EntityUtils.toString(results);
        } catch (Exception e) {
            throw new RuntimeException("Web Service Failure");
        } finally {
            if (results!=null)
                try {
                    results.consumeContent();
                } catch (IOException e) {
                    // empty, Checked exception but don't care
                }
        }
    }

Android的食谱例如