JDBC驱动程序的PostgreSQL采用Android

编程入门 行业动态 更新时间:2024-10-27 07:25:37
本文介绍了JDBC驱动程序的PostgreSQL采用Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想我的Andr​​oid应用程序连接到服务器(PostgreSQL的)与JDBC驱动程序,但我有此错误:

I'm trying to connect my android application to a server (PostgreSQL) with JDBC Driver, but i have this error :

java.lang.ClassNotFoundException: org.postgresql.Driver ... Caused by: java.lang.NoClassDefFoundError: org/postgresql/Driver ... 12 more Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver ... java.sql.SQLException: No suitable driver

我试了很多东西,比如添加在路径驱动程序的地址,但没有工作。我跟着这个教程: appliedcoffeetechnology.tumblr/post/10657124340 并增加了驾驶员JDBC4(我也尝试了JDBC3),在构建路径。

I tried many things, like add the address of the driver in the Path, but nothing work. I followed this tutorial : appliedcoffeetechnology.tumblr/post/10657124340 and added the driver JDBC4 (i also tried the JDBC3), in the Build Path.

每个人都可以帮我吗?

推荐答案

虽然不是严格的回答你的问题,我有一个建议。

While not the strict answer to your question, I do have a suggestion.

不要试图直接在Android设备上使用JDBC。你可以节省很多麻烦的方式。 I更详细地写上了JDBC VS Web Service的Andr​​oid的问题。

Don't try to use JDBC on the Android device directly. You'll save a lot of hassle that way. I wrote about that in more detail on the "JDBC vs Web Service for Android" question.

写您的数据库逻辑通过Web访问的应用程序服务器上,并通过HTTP + JSON,SOAP,XML-RPC,或类似的交谈,该应用程序服务器。这将是一个很大的带宽效率,你可以让你的应用程序有更多的宽容与连接这样的问题。它也使您不必直接暴露你的数据库服务器的互联网 - 没有太大的PostgreSQL的一个担心,只要您使用SSL,但还是最好不要有做所有

Write your database logic on a web-accessible application server and talk to that application server via HTTP+JSON, SOAP, XML-RPC, or similar. This will be a lot more bandwidth efficient and you can make your app a lot more tolerant of issues with connectivity that way. It also saves you from having to expose your database server directly to the Internet - not much of a worry with PostgreSQL so long as you use SSL, but still better not to have to do at all.

使用JAX-RS在JBoss AS 7,Tomcat 7的或类似的,你应该能够把一个网页REST风格的XML / JSON API服务,为您的应用程序pretty的轻松。人们似乎也把REST / JSON API一起使用pretty的迅速用PHP。

Using JAX-RS on JBoss AS 7, Tomcat 7, or similar you should be able to put together a web RESTful XML/JSON services API for your app pretty easily. People also seem to put REST/JSON APIs together pretty quickly with PHP.

您可以写在pretty的一个JSON / REST的Web API的多,你想用不同程度的缓解任何语言。只要搜索 REST服务器yourlanguagename 。

You can write a JSON/REST web API in pretty much any language you like with varying degrees of ease. Just search for REST server yourlanguagename.

卡奥已经指出,在一个已删除的答案,也有虚拟的JDBC驱动程序,通过HTTP隧道请求。这些可适合于一些应用。

"Kaw" has pointed out in a deleted answer that there are also virtual JDBC drivers that tunnel requests over HTTP. These may be suitable for some applications.

更多推荐

JDBC驱动程序的PostgreSQL采用Android

本文发布于:2023-10-28 23:51:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538126.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:驱动程序   JDBC   Android   PostgreSQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!