无法连接的Andr​​oid到PostgreSQL数据库 [英] Can't connect Android to PostgreSQL DB

查看:325
本文介绍了无法连接的Andr​​oid到PostgreSQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的计算器上的第一篇文章,所以希望我不健全的太无能了。我在连接我的Andr​​oid应用程序,以一个PostgresDB,我创建了一个问题。我用code本教程 http://appliedcoffeetechnology.tumblr.com/post/10657124340。虽然我修改字符串网址...线以下几点: 字符串URL =的jdbc:PostgreSQL的://192.168.1.101:5556 / postgres用户= postgres的&放大器;密码= yeahright; 我也跟着上下载JDBC并将其添加到包中的其他指令,我还增加了网络的权限行。

This is my first post on stackoverflow so hopefully I don't sound too incompetent. I'm having an issue connecting my Android App to a PostgresDB that I created. I used the code from this tutorial http://appliedcoffeetechnology.tumblr.com/post/10657124340. Although I modified the String url ... line to the following: String url = "jdbc:postgresql://192.168.1.101:5556/postgres?user=postgres&password=yeahright"; I followed the other instructions on downloading the JDBC and adding it to the package, I also added the internet permissions line.

我已经在我的Windows 7计算机配置PostgreSQL的数据库,以允许连接,甚至设置为信任的传入连接,这样密码不会碍事。我还开了5556端口上的Windows防火墙。我可以连接到它从我的Ubuntu的笔记本电脑,使用下面的命令: PSQL 192.168.1.101 -U Postgres的-p 5556 -d的Postgres 但是,(在真实设备上)上运行的Andr​​oid应用程序,当我得到值java.sql.SQLException:没有合适的驱动程序抛出康恩=的DriverManager.getConnection(URL)调用。

I've configured the postgreSQL DB on my Windows 7 machine to allow connections, and even set the incoming connections to "trust" so that the password won't get in the way. I also opened up the 5556 port on the Windows firewall. I can connect to it from my Ubuntu laptop, using the following command: psql 192.168.1.101 -U postgres -p 5556 -d postgres However, when running the Android App (on a real device) I get "java.sql.SQLException: No suitable driver" thrown by the conn = DriverManager.getConnection(url) call.

感谢各位大大提前为您的帮助,让我知道,如果我可以提供任何其他有用的信息。

Thank you greatly in advance for your help, and let me know if I can provide any other useful information.

克雷格·林格下面提及的Web服务应用程序。本来我还在犹豫,因为我不想甚至更加陡峭的斜坡添加到我的学习曲线,但我决定去与Django的,它一直非常简单。

Craig Ringer below mentioned a web service app. Originally I was hesitant as I didn't want to add an even steeper incline to my learning curve, but I decided to go with Django, and it has been amazingly simple.

推荐答案

AFAIK Android不支持JDBC本身。 (更新:更新的版本一样)。说实话,你的 WAY 的更好运行的Web服务,让你的Andr​​oid应用程序通过Web服务请求与数据库进行通讯。

AFAIK Android doesn't support JDBC natively. (Update: newer versions do). Honestly, you're WAY better off running a web service and having your Android app communicate with the DB via web service requests.

搜索,以便为机器人的PostgreSQL。

Search SO for "android postgresql".

一些相关的讨论:

  • Android操作系统和PostgreSQL
  • <一个href="http://stackoverflow.com/questions/10634167/how-to-create-webservice-in-java-using-apache-tomcat-using-postgresql">How创建使用使用PostgreSQL
  • 的Apache Tomcat Web服务在Java中
  • JDBC驱动程序的PostgreSQL与Android
  • <一个href="http://stackoverflow.com/questions/10881538/how-can-i-securely-indirectly-query-a-postgresql-database-within-android">How我可以安全地(间接)内的android查询PostgreSQL数据库?
  • <一个href="http://stackoverflow.com/questions/10970918/postgresql-jdbc-connection-fails-on-android-4-0">PostgreSQL JDBC连接失败在Android 4.0
  • Android OS and postgreSQL
  • How to create webservice in java using apache tomcat using PostgreSQL
  • Driver JDBC PostgreSQL with Android
  • How can I securely (indirectly) query a postgresql database within android?
  • PostgreSQL JDBC connection fails on Android 4.0

这篇关于无法连接的Andr​​oid到PostgreSQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆