Accessing PostgreSQL DB from Android app

Поиск
Список
Период
Сортировка
От alexbruy
Тема Accessing PostgreSQL DB from Android app
Дата
Msg-id 22354398-1a5f-49a2-a12f-e4aa49a3bf9f@glegroupsg2000goo.googlegroups.com
обсуждение исходный текст
Список pgsql-jdbc
Hi all,

I'm new to Android development and Java. Now I'm work on application
that should interact with PostgreSQL (to be exact PostGIS) database. I
read "Android & PostgreSQL" presentation by Mark Wong [1] and know
that latest PostgreSQL JDBC driver (postgresql-9.0-801.jdbc.jar) should
work on Android.

First I try to add external JAR in console because my PC is a bit slow
for using Eclipse. As I understand from presentation, to use JDBC driver
I should create .classpath file in the my ptoject directory and all will
work.

So I create .classpath with this content

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
       <classpathentry kind="lib" path="/home/alex/devel/java/
postgresql-9.0-801.jdbc4.jar"
</classpath>

But when I try to build project with ant I get next error:

[javac] /home/alex/files/data/git/firereporter/src/com/nextgis/
firereporter/ReportActivity.java:51: unreported exception
java.lang.ClassNotFoundException; must be caught or declared to be
thrown
[javac]         Class.forName("org.postgresql.Driver");
[javac]                      ^
[javac] 1 error

Seems that driver cannot be found and JAR file not "linked" to my
project.

Then I installed Eclipse and ADT plugin, and tried to do same things
with it. After creating new Android project and I add JAR as described
in [2] and [3] but this also don't help. I again get error on string

Class.forName("org.postgresql.Driver");

and project doesn't builds.
Also I found sources of several apps developed during
AndroidAppContest: PgQuilt and PGTop and try to learn
from this sources how to add PostgreSQL driver to app
but can't find any usefull info.

Can anyone help me with this? May be I miss something
or do it wrong?

[1] http://www.pgcon.org/2011/schedule/events/278.en.html
[2] http://developer.android.com/resources/faq/commontasks.html#addexternallibrary
[3] http://www.youtube.com/watch?v=eY_uqi_qIz0

Thanks and sorry for my bad English,
Alex

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Bruno Harbulot
Дата:
Сообщение: Re: Connecting over UNIX domain sockets
Следующее
От: Wiz of Id
Дата:
Сообщение: Re: 9.1 non-devel jar