[android-developers] Re: JDBC Driver for SQLiteDatabase

2010-01-22 Thread jotobjects
There are a number of open source JDBC drivers for SQLLite out there
already (including the one already built into Android).

On Jan 21, 10:22 pm, Elliott Hughes  wrote:
> On Jan 12, 1:53 pm, jotobjects  wrote:
>
>
>
> > On Jan 11, 9:14 pm, Elliott Hughes  wrote:
>
> > > On Dec 19 2009, 2:05 am, kristianlm  wrote:
>
> > > > hi Elliott,
>
> > > > what exactly does it mean that the driver is unsupported and that
> > > > it shouldn't be used?
>
> > > > are you saying that JDBC should not be used at all?
>
> > > you can use JDBC, though it isn't well tested. but we do publicly
> > > support the java.sql API.
>
> > Hi Elliott -
>
> > You cannot use JDBC if you can't get a Connection. And you cannot get
> > a Connection unless there is some documented way for the DriverManager
> > to find the SQLite driver.  ASFAIK this would be done by the platform
> > registering the driver, or it is done in a static initializer in the
> > driver class, hence the use of Class.forName().
>
> > This is the pattern that you apparently say is NOT supported -
>
> >             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
> >             Class.forName("SQLite.JDBCDriver");
> >             Connection conn = DriverManager.getConnection(db);
>
> > So then what is the correct supported way to get a Connection object?
>
> you supply your own driver, and use that.
>
>  --elliott
>
> > If there is no documented way then maybe it is true that JDBC is NOT
> > usable on Android currently?
>
> > I don't think JDBC is that critical to the platform but it would be
> > nice to clarify if it is even usable.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2010-01-22 Thread Elliott Hughes


On Jan 12, 1:53 pm, jotobjects  wrote:
> On Jan 11, 9:14 pm, Elliott Hughes  wrote:
>
> > On Dec 19 2009, 2:05 am, kristianlm  wrote:
>
> > > hi Elliott,
>
> > > what exactly does it mean that the driver is unsupported and that
> > > it shouldn't be used?
>
> > > are you saying that JDBC should not be used at all?
>
> > you can use JDBC, though it isn't well tested. but we do publicly
> > support the java.sql API.
>
> Hi Elliott -
>
> You cannot use JDBC if you can't get a Connection. And you cannot get
> a Connection unless there is some documented way for the DriverManager
> to find the SQLite driver.  ASFAIK this would be done by the platform
> registering the driver, or it is done in a static initializer in the
> driver class, hence the use of Class.forName().
>
> This is the pattern that you apparently say is NOT supported -
>
>             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
>             Class.forName("SQLite.JDBCDriver");
>             Connection conn = DriverManager.getConnection(db);
>
> So then what is the correct supported way to get a Connection object?

you supply your own driver, and use that.

 --elliott

> If there is no documented way then maybe it is true that JDBC is NOT
> usable on Android currently?
>
> I don't think JDBC is that critical to the platform but it would be
> nice to clarify if it is even usable.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2010-01-22 Thread Elliott Hughes


On Jan 18, 1:49 am, kristianlm  wrote:
> Hi folks,
>
> I guess we've concluded that the built-in JDBC for Android should not
> be used (even though it's there). Those of you who still want to use
> JDBC on Android can check out the JDBC driver I started myself for
> precisely this reason:
>
> http://code.google.com/p/sqldroid/
>
> It's a relatively simple implementation but does its job: offer jdbc
> access to android sqlite db.

writing a JDBC driver in terms of the supported
android.database.sqlite API, as you've done, is a clever idea! let us
know in the issue tracker if you find bugs in either
android.database.sqlite or java.sql. (you might want to go for the
APL2 license, though, if you want to maximize the number of projects
that will be able to use it. ianal.)

 --elliott

> And thanks for all the constructive feedback!
> Kris
>
> On Jan 12, 10:53 pm, jotobjects  wrote:
>
>
>
> > On Jan 11, 9:14 pm, Elliott Hughes  wrote:
>
> > > On Dec 19 2009, 2:05 am, kristianlm  wrote:
>
> > > > hi Elliott,
>
> > > > what exactly does it mean that the driver is unsupported and that
> > > > it shouldn't be used?
>
> > > > areyousaying thatJDBCshould not be used at all?
>
> > >youcanuseJDBC,thoughitisn'twelltested.butwedopublicly
> > >supportthejava.sqlAPI.
>
> > Hi Elliott -
>
> > YoucannotuseJDBCifyoucan't get a Connection. Andyoucannot get
> > a Connection unless there is some documented way for the DriverManager
> > to find the SQLite driver.  ASFAIK this would be done by the platform
> > registering the driver, or it is done in a static initializer in the
> > driver class, hence theuseof Class.forName().
>
> > This is the pattern thatyouapparently say is NOT supported -
>
> >             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
> >             Class.forName("SQLite.JDBCDriver");
> >             Connection conn = DriverManager.getConnection(db);
>
> > So then what is the correct supported way to get a Connection object?
> > If there is no documented way then maybe it is true thatJDBCis NOT
> > usable on Android currently?
>
> > I don't thinkJDBCis that critical to the platformbutit would be
> > nice to clarify if it is even usable.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2010-01-19 Thread jotobjects
You can just include the Android driver in your application if you
want to be sure that it is available on every device.  You can find
the Android SQLLite driver at this location -

http://android.git.kernel.org/?p=platform/dalvik.git;a=blob;f=libcore/sql/src/main/java/SQLite/JDBCDriver.java;h=63b95ee7197416e41f670b8f5bcb60539a4c48a1;hb=HEAD


On Jan 18, 1:49 am, kristianlm  wrote:
> Hi folks,
>
> I guess we've concluded that the built-in JDBC for Android should not
> be used (even though it's there). Those of you who still want to use
> JDBC on Android can check out the JDBC driver I started myself for
> precisely this reason:
>
> http://code.google.com/p/sqldroid/
>
> It's a relatively simple implementation but does its job: offer jdbc
> access to android sqlite db.
>
> And thanks for all the constructive feedback!
> Kris
>
> On Jan 12, 10:53 pm, jotobjects  wrote:
>
> > On Jan 11, 9:14 pm, Elliott Hughes  wrote:
>
> > > On Dec 19 2009, 2:05 am, kristianlm  wrote:
>
> > > > hi Elliott,
>
> > > > what exactly does it mean that the driver is unsupported and that
> > > > it shouldn't be used?
>
> > > > areyousaying thatJDBCshould not be used at all?
>
> > >youcanuseJDBC,thoughitisn'twelltested.butwedopublicly
> > >supportthejava.sqlAPI.
>
> > Hi Elliott -
>
> > YoucannotuseJDBCifyoucan't get a Connection. Andyoucannot get
> > a Connection unless there is some documented way for the DriverManager
> > to find the SQLite driver.  ASFAIK this would be done by the platform
> > registering the driver, or it is done in a static initializer in the
> > driver class, hence theuseof Class.forName().
>
> > This is the pattern thatyouapparently say is NOT supported -
>
> >             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
> >             Class.forName("SQLite.JDBCDriver");
> >             Connection conn = DriverManager.getConnection(db);
>
> > So then what is the correct supported way to get a Connection object?
> > If there is no documented way then maybe it is true thatJDBCis NOT
> > usable on Android currently?
>
> > I don't thinkJDBCis that critical to the platformbutit would be
> > nice to clarify if it is even usable.
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: JDBC Driver for SQLiteDatabase

2010-01-18 Thread kristianlm

Hi folks,

I guess we've concluded that the built-in JDBC for Android should not
be used (even though it's there). Those of you who still want to use
JDBC on Android can check out the JDBC driver I started myself for
precisely this reason:

http://code.google.com/p/sqldroid/

It's a relatively simple implementation but does its job: offer jdbc
access to android sqlite db.

And thanks for all the constructive feedback!
Kris

On Jan 12, 10:53 pm, jotobjects  wrote:
> On Jan 11, 9:14 pm, Elliott Hughes  wrote:
>
> > On Dec 19 2009, 2:05 am, kristianlm  wrote:
>
> > > hi Elliott,
>
> > > what exactly does it mean that the driver is unsupported and that
> > > it shouldn't be used?
>
> > > areyousaying thatJDBCshould not be used at all?
>
> >youcanuseJDBC,thoughitisn'twelltested.butwedopublicly
> >supportthejava.sqlAPI.
>
> Hi Elliott -
>
> YoucannotuseJDBCifyoucan't get a Connection. Andyoucannot get
> a Connection unless there is some documented way for the DriverManager
> to find the SQLite driver.  ASFAIK this would be done by the platform
> registering the driver, or it is done in a static initializer in the
> driver class, hence theuseof Class.forName().
>
> This is the pattern thatyouapparently say is NOT supported -
>
>             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
>             Class.forName("SQLite.JDBCDriver");
>             Connection conn = DriverManager.getConnection(db);
>
> So then what is the correct supported way to get a Connection object?
> If there is no documented way then maybe it is true thatJDBCis NOT
> usable on Android currently?
>
> I don't thinkJDBCis that critical to the platformbutit would be
> nice to clarify if it is even usable.
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: JDBC Driver for SQLiteDatabase

2010-01-12 Thread jotobjects
On Jan 11, 9:14 pm, Elliott Hughes  wrote:
> On Dec 19 2009, 2:05 am, kristianlm  wrote:
>
> > hi Elliott,
>
> > what exactly does it mean that the driver is unsupported and that
> > it shouldn't be used?
>
> > are you saying that JDBC should not be used at all?
>
> you can use JDBC, though it isn't well tested. but we do publicly
> support the java.sql API.

Hi Elliott -

You cannot use JDBC if you can't get a Connection. And you cannot get
a Connection unless there is some documented way for the DriverManager
to find the SQLite driver.  ASFAIK this would be done by the platform
registering the driver, or it is done in a static initializer in the
driver class, hence the use of Class.forName().

This is the pattern that you apparently say is NOT supported -

String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
Class.forName("SQLite.JDBCDriver");
Connection conn = DriverManager.getConnection(db);

So then what is the correct supported way to get a Connection object?
If there is no documented way then maybe it is true that JDBC is NOT
usable on Android currently?

I don't think JDBC is that critical to the platform but it would be
nice to clarify if it is even usable.
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: JDBC Driver for SQLiteDatabase

2010-01-12 Thread Elliott Hughes


On Dec 19 2009, 2:05 am, kristianlm  wrote:
> hi Elliott,
>
> what exactly does it mean that the driver is unsupported and that
> it shouldn't be used?
>
> are you saying that JDBC should not be used at all?

you can use JDBC, though it isn't well tested. but we do publicly
support the java.sql API.

> without
> loading the jdbc driver with Class.forName() it isn't registered.

that's the part that's unsupported: do not assume that any given
Android device has that JDBC driver available. it's unsupported,
undocumented, and you really really don't want to be using it.

> that concludes the code snippet in Joerg's post above is
> not allowed?

correct.

 --elliott

> Thanks a bunch,
> - Kris
>
> On Dec 15, 12:42 am, enh  wrote:
>
>
>
> > theJDBCdriver is undocumented because it's unsupported. please do
> > not use reflection to access undocumented/unsupported API.
>
> >  --elliott
>
> > On Dec 14, 5:29 am, kristianlm  wrote:
>
> > > Hi jotobject,
> > > I don't understant why this wouldn't be part of the public API. if
> > > Android is shipped with aJDBCdriver, why not let people use it? It's
> > > certainly useful for many of us!
>
> > > Kris
>
> > > On Dec 12, 10:42 pm, jotobjects  wrote:
>
> > > > On Dec 8, 10:41 pm, Joerg Pleumann  wrote:> 
> > > > Regarding android.jar, I never checked but I could imagine that it
> > > > > contains only the public API classes and might even have the actual
> > > > > bytecode erased. Nothing is ever run against it. It is just there to
> > > > > make Javac or Eclipse happy (somebody please correct me if I'm wrong).
> > > > > On the device, the driver should be part of /system/framework/
> > > > > core.jar.
>
> > > > The SQLite driver is never used by the public API.  You pass the name
> > > > as a String URI "jdbc:sqlite:" to getConnection().  That is the way
> > > >JDBCalways works. The drivers are not part of the public API so the
> > > > documentation is NOT missing anything regarding drivers.
>
> > > > As far as I can see the only missing documentation is the URI
> > > > "jdbc:sqlite:" as in Joerg's example -
>
> > > >             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
> > > >             Class.forName("SQLite.JDBCDriver");
> > > >             Connection conn = DriverManager.getConnection(db);
>
> > > > The Class.forName() call is only necessary if Android does not
> > > > automatically register the driver with DriverManager (I don't know if
> > > > it does or not).
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: JDBC Driver for SQLiteDatabase

2010-01-12 Thread Elliott Hughes


On Dec 22 2009, 12:50 pm, jotobjects  wrote:
> On Dec 19, 2:05 am, kristianlm  wrote:
>
> > hi Elliott,
>
> > what exactly does it mean that the driver is unsupported and that
> > it shouldn't be used?
>
> The SQLite driver could change in a future a release.  It is
> undocumented because you should not rely on the API for the driver.
> That means you should not call any methods on the driver (you never
> need to call the driver if you are using JDBC).
>
>
>
> > are you saying that JDBC should not be used at all? without
> > loading the jdbc driver with Class.forName() it isn't registered.
>
> No, JDBC is part of the public API for Android and therefore it is
> supported and  you can use it.
>
>
>
> > that concludes the code snippet in Joerg's post above is
> > not allowed?
>
> No, the example only uses the public JDBC API so therefore it is
> allowed.

no, it uses reflection to access an undocumented class (the JDBC
driver). that's not okay.

 --elliott
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-22 Thread jotobjects


On Dec 19, 2:05 am, kristianlm  wrote:
> hi Elliott,
>
> what exactly does it mean that the driver is unsupported and that
> it shouldn't be used?

The SQLite driver could change in a future a release.  It is
undocumented because you should not rely on the API for the driver.
That means you should not call any methods on the driver (you never
need to call the driver if you are using JDBC).

>
> are you saying that JDBC should not be used at all? without
> loading the jdbc driver with Class.forName() it isn't registered.

No, JDBC is part of the public API for Android and therefore it is
supported and  you can use it.

>
> that concludes the code snippet in Joerg's post above is
> not allowed?

No, the example only uses the public JDBC API so therefore it is
allowed.


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-19 Thread kristianlm

hi Elliott,

what exactly does it mean that the driver is unsupported and that
it shouldn't be used?

are you saying that JDBC should not be used at all? without
loading the jdbc driver with Class.forName() it isn't registered.

that concludes the code snippet in Joerg's post above is
not allowed?

Thanks a bunch,
- Kris


On Dec 15, 12:42 am, enh  wrote:
> theJDBCdriver is undocumented because it's unsupported. please do
> not use reflection to access undocumented/unsupported API.
>
>  --elliott
>
> On Dec 14, 5:29 am, kristianlm  wrote:
>
>
>
> > Hi jotobject,
> > I don't understant why this wouldn't be part of the public API. if
> > Android is shipped with aJDBCdriver, why not let people use it? It's
> > certainly useful for many of us!
>
> > Kris
>
> > On Dec 12, 10:42 pm, jotobjects  wrote:
>
> > > On Dec 8, 10:41 pm, Joerg Pleumann  wrote:> 
> > > Regarding android.jar, I never checked but I could imagine that it
> > > > contains only the public API classes and might even have the actual
> > > > bytecode erased. Nothing is ever run against it. It is just there to
> > > > make Javac or Eclipse happy (somebody please correct me if I'm wrong).
> > > > On the device, the driver should be part of /system/framework/
> > > > core.jar.
>
> > > The SQLite driver is never used by the public API.  You pass the name
> > > as a String URI "jdbc:sqlite:" to getConnection().  That is the way
> > >JDBCalways works. The drivers are not part of the public API so the
> > > documentation is NOT missing anything regarding drivers.
>
> > > As far as I can see the only missing documentation is the URI
> > > "jdbc:sqlite:" as in Joerg's example -
>
> > >             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
> > >             Class.forName("SQLite.JDBCDriver");
> > >             Connection conn = DriverManager.getConnection(db);
>
> > > The Class.forName() call is only necessary if Android does not
> > > automatically register the driver with DriverManager (I don't know if
> > > it does or not).

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-18 Thread jotobjects


On Dec 15, 8:46 am, kristianlm  wrote:

> I understand that the driver doesn't have to be
> documented if you're not supposed to be using
> it since it's going "low-level".

That's right. There is nothing useful you can do with the driver
anyway.  That's what the JDBC API is for.

>
> But the driver does not seem to register itself,
> without Class.forName("SQLite.JDBCDriver"),
> I get "no suitable driver found".
>
Class.forName() is the convention for registering a JDBC driver.

> So that means we're not supposed to be using
> the sqlite back-end through JDBC at all? I'm
> not happy! Why is the JDBC built-in if no one is
> allowed to use it?
>
No it means call Class.forName().  Just get a Connection object as in
the examples in this thread and you can use JDBC with SQLite.   This
is way JDBC always works

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-15 Thread enh
the JDBC driver is undocumented because it's unsupported. please do
not use reflection to access undocumented/unsupported API.

 --elliott

On Dec 14, 5:29 am, kristianlm  wrote:
> Hi jotobject,
> I don't understant why this wouldn't be part of the public API. if
> Android is shipped with a JDBC driver, why not let people use it? It's
> certainly useful for many of us!
>
> Kris
>
> On Dec 12, 10:42 pm, jotobjects  wrote:
>
> > On Dec 8, 10:41 pm, Joerg Pleumann  wrote:> 
> > Regarding android.jar, I never checked but I could imagine that it
> > > contains only the public API classes and might even have the actual
> > > bytecode erased. Nothing is ever run against it. It is just there to
> > > make Javac or Eclipse happy (somebody please correct me if I'm wrong).
> > > On the device, the driver should be part of /system/framework/
> > > core.jar.
>
> > The SQLite driver is never used by the public API.  You pass the name
> > as a String URI "jdbc:sqlite:" to getConnection().  That is the way
> > JDBC always works. The drivers are not part of the public API so the
> > documentation is NOT missing anything regarding drivers.
>
> > As far as I can see the only missing documentation is the URI
> > "jdbc:sqlite:" as in Joerg's example -
>
> >             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
> >             Class.forName("SQLite.JDBCDriver");
> >             Connection conn = DriverManager.getConnection(db);
>
> > The Class.forName() call is only necessary if Android does not
> > automatically register the driver with DriverManager (I don't know if
> > it does or not).

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-15 Thread kristianlm


Hi again everybody.
I really wanna get to the bottom of this.

I posted a ticket
http://code.google.com/p/android/issues/detail?id=5437
and, perhaps as expected, the reply sounded:

"this code is undocumented because
 it's unsupported. please do not use
 undocumented API."

The ticket has been closed but I am still
not satisfied.

I understand that the driver doesn't have to be
documented if you're not supposed to be using
it since it's going "low-level".

But the driver does not seem to register itself,
without Class.forName("SQLite.JDBCDriver"),
I get "no suitable driver found".

So that means we're not supposed to be using
the sqlite back-end through JDBC at all? I'm
not happy! Why is the JDBC built-in if no one is
allowed to use it?


jotobjects:
I have had several projects where you have to
invoke the driver (using Class.forName) to
have it register itself. This seems to be the
common convention. You don't see the driver
in DriverManager.getConnection() - but the
driver will link to a certain url.



On Dec 14, 11:34 pm, jotobjects  wrote:
> JDBCdrivers are never used directly byJDBCapplications. In aJDBC
> application you reference the URI name of the driver in
> DriverManager.getConnection().  That is the only time you ever see the
> driver and you never actually call a method on the driver itself in 
> aJDBCapplication.  This has nothing to do with Android. It is just
> part ofJDBC.
>
> On Dec 14, 5:29 am, kristianlm  wrote:
>
> > Hi jotobject,
> > I don't understant why this wouldn't be part of the public API. if
> > Android is shipped with aJDBCdriver, why not let people use it? It's
> > certainly useful for many of us!
>
> > Kris
>
> > On Dec 12, 10:42 pm, jotobjects  wrote:
>
> > > On Dec 8, 10:41 pm, Joerg Pleumann  wrote:> 
> > > Regarding android.jar, I never checked but I could imagine that it
> > > > contains only the public API classes and might even have the actual
> > > > bytecode erased. Nothing is ever run against it. It is just there to
> > > > make Javac or Eclipse happy (somebody please correct me if I'm wrong).
> > > > On the device, the driver should be part of /system/framework/
> > > > core.jar.
>
> > > The SQLite driver is never used by the public API.  You pass the name
> > > as a String URI "jdbc:sqlite:" to getConnection().  That is the way
> > >JDBCalways works. The drivers are not part of the public API so the
> > > documentation is NOT missing anything regarding drivers.
>
> > > As far as I can see the only missing documentation is the URI
> > > "jdbc:sqlite:" as in Joerg's example -
>
> > >             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
> > >             Class.forName("SQLite.JDBCDriver");
> > >             Connection conn = DriverManager.getConnection(db);
>
> > > The Class.forName() call is only necessary if Android does not
> > > automatically register the driver with DriverManager (I don't know if
> > > it does or not).

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-14 Thread jotobjects
JDBC drivers are never used directly by JDBC applications. In a JDBC
application you reference the URI name of the driver in
DriverManager.getConnection().  That is the only time you ever see the
driver and you never actually call a method on the driver itself in a
JDBC application.  This has nothing to do with Android. It is just
part of JDBC.

On Dec 14, 5:29 am, kristianlm  wrote:
> Hi jotobject,
> I don't understant why this wouldn't be part of the public API. if
> Android is shipped with a JDBC driver, why not let people use it? It's
> certainly useful for many of us!
>
> Kris
>
> On Dec 12, 10:42 pm, jotobjects  wrote:
>
> > On Dec 8, 10:41 pm, Joerg Pleumann  wrote:> 
> > Regarding android.jar, I never checked but I could imagine that it
> > > contains only the public API classes and might even have the actual
> > > bytecode erased. Nothing is ever run against it. It is just there to
> > > make Javac or Eclipse happy (somebody please correct me if I'm wrong).
> > > On the device, the driver should be part of /system/framework/
> > > core.jar.
>
> > The SQLite driver is never used by the public API.  You pass the name
> > as a String URI "jdbc:sqlite:" to getConnection().  That is the way
> > JDBC always works. The drivers are not part of the public API so the
> > documentation is NOT missing anything regarding drivers.
>
> > As far as I can see the only missing documentation is the URI
> > "jdbc:sqlite:" as in Joerg's example -
>
> >             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
> >             Class.forName("SQLite.JDBCDriver");
> >             Connection conn = DriverManager.getConnection(db);
>
> > The Class.forName() call is only necessary if Android does not
> > automatically register the driver with DriverManager (I don't know if
> > it does or not).

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-14 Thread kristianlm

Hi jotobject,
I don't understant why this wouldn't be part of the public API. if
Android is shipped with a JDBC driver, why not let people use it? It's
certainly useful for many of us!


Kris

On Dec 12, 10:42 pm, jotobjects  wrote:
> On Dec 8, 10:41 pm, Joerg Pleumann  wrote:> 
> Regarding android.jar, I never checked but I could imagine that it
> > contains only the public API classes and might even have the actual
> > bytecode erased. Nothing is ever run against it. It is just there to
> > make Javac or Eclipse happy (somebody please correct me if I'm wrong).
> > On the device, the driver should be part of /system/framework/
> > core.jar.
>
> The SQLite driver is never used by the public API.  You pass the name
> as a String URI "jdbc:sqlite:" to getConnection().  That is the way
> JDBC always works. The drivers are not part of the public API so the
> documentation is NOT missing anything regarding drivers.
>
> As far as I can see the only missing documentation is the URI
> "jdbc:sqlite:" as in Joerg's example -
>
>             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
>             Class.forName("SQLite.JDBCDriver");
>             Connection conn = DriverManager.getConnection(db);
>
> The Class.forName() call is only necessary if Android does not
> automatically register the driver with DriverManager (I don't know if
> it does or not).

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-12 Thread jotobjects

On Dec 8, 10:41 pm, Joerg Pleumann  wrote:
> Regarding android.jar, I never checked but I could imagine that it
> contains only the public API classes and might even have the actual
> bytecode erased. Nothing is ever run against it. It is just there to
> make Javac or Eclipse happy (somebody please correct me if I'm wrong).
> On the device, the driver should be part of /system/framework/
> core.jar.
>
The SQLite driver is never used by the public API.  You pass the name
as a String URI "jdbc:sqlite:" to getConnection().  That is the way
JDBC always works. The drivers are not part of the public API so the
documentation is NOT missing anything regarding drivers.

As far as I can see the only missing documentation is the URI
"jdbc:sqlite:" as in Joerg's example -

String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
Class.forName("SQLite.JDBCDriver");
Connection conn = DriverManager.getConnection(db);

The Class.forName() call is only necessary if Android does not
automatically register the driver with DriverManager (I don't know if
it does or not).

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-12 Thread Joerg Pleumann
Hi Kris,

yes, this is the general bugtracker for the Android open-source
project. Please use it. I think it is adequate also for documentation
issues or feature requests. I don't know about your specific issue,
but the issues are being looked at by the Android team (mostly Google
guys) and worked on. For instance, I filed a small feature request for
DDMS, and the feature is now part of the SDK.

Cheers,
Joerg

On 10 Dez., 17:13, kristianlm  wrote:
> Ok. Thanks a lot Joerg!
>
> I wanna create a ticket, but I don't know where to turn
>
> Is this where I'm supposed to 
> post:http://code.google.com/p/android/issues/list
>
> It seems to be only for bugs though, is it?
> Anyhow, I commited a bug there half a year
> ago and it still hasn't been looked at, is
> anyone dealing with those issues at all?
>
> K
>
> On Dec 9, 7:41 am, Joerg Pleumann  wrote:
>
> > I agree the existence of the driver should be mentioned at least in
> > theJDBCpackage docs. Would you mind creating a ticket for this?
>
> >JDBCis somewhat of a second-class citizen in the Android world, since
> > Android has its own database API (that is actually not too far away
> > fromJDBC, but has much better integration with the UI framework). I
> > guess this is why the docs don't encourage you to useJDBC. Still,
> >JDBCis usable, and - as you already noticed - it is possible to
> > install additional drivers.
>
> > Regarding android.jar, I never checked but I could imagine that it
> > contains only the public API classes and might even have the actual
> > bytecode erased. Nothing is ever run against it. It is just there to
> > make Javac or Eclipse happy (somebody please correct me if I'm wrong).
> > On the device, the driver should be part of /system/framework/
> > core.jar.
>
> > Cheers,
> > Joerg
>
> > On 8 Dez., 21:56, kristianlm  wrote:
>
> > > I see. I still think the documents are lacking!
>
> > > Am I the only one who'd want a comment on theJDBC
> > > support in the dev-guide documents?
>
> > > There seems to be a fair share of confused people out there ...
>
> > > On Dec 8, 8:33 pm, jotobjects  wrote:
>
> > > > On Dec 8, 11:02 am, kristianlm  wrote:
>
> > > > > I cant believe this though - there's already a driver available? I
> > > > > can't find that in the docs anywhere! Which java.sql online manual are
> > > > > you looking at? I'm 
> > > > > athttp://developer.android.com/reference/java/sql/package-summary.html
>
> > > >http://dev.android.com/reference/java/sql/package-summary.html
>
> > > > That'sJDBC- the Connection object uses aJDBCdriver for SQLite.
>
> > > > Try Connection.getMetaData().getDriverName() and see what you get.
> > > > Probably it will be "SQLite.JDBCDriver"
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-10 Thread kristianlm
Ok. Thanks a lot Joerg!

I wanna create a ticket, but I don't know where to turn

Is this where I'm supposed to post:
http://code.google.com/p/android/issues/list

It seems to be only for bugs though, is it?
Anyhow, I commited a bug there half a year
ago and it still hasn't been looked at, is
anyone dealing with those issues at all?

K

On Dec 9, 7:41 am, Joerg Pleumann  wrote:
> I agree the existence of the driver should be mentioned at least in
> the JDBC package docs. Would you mind creating a ticket for this?
>
> JDBC is somewhat of a second-class citizen in the Android world, since
> Android has its own database API (that is actually not too far away
> from JDBC, but has much better integration with the UI framework). I
> guess this is why the docs don't encourage you to use JDBC. Still,
> JDBC is usable, and - as you already noticed - it is possible to
> install additional drivers.
>
> Regarding android.jar, I never checked but I could imagine that it
> contains only the public API classes and might even have the actual
> bytecode erased. Nothing is ever run against it. It is just there to
> make Javac or Eclipse happy (somebody please correct me if I'm wrong).
> On the device, the driver should be part of /system/framework/
> core.jar.
>
> Cheers,
> Joerg
>
> On 8 Dez., 21:56, kristianlm  wrote:
>
> > I see. I still think the documents are lacking!
>
> > Am I the only one who'd want a comment on the JDBC
> > support in the dev-guide documents?
>
> > There seems to be a fair share of confused people out there ...
>
> > On Dec 8, 8:33 pm, jotobjects  wrote:
>
> > > On Dec 8, 11:02 am, kristianlm  wrote:
>
> > > > I cant believe this though - there's already a driver available? I
> > > > can't find that in the docs anywhere! Which java.sql online manual are
> > > > you looking at? I'm 
> > > > athttp://developer.android.com/reference/java/sql/package-summary.html
>
> > >http://dev.android.com/reference/java/sql/package-summary.html
>
> > > That's JDBC - the Connection object uses a JDBC driver for SQLite.
>
> > > Try Connection.getMetaData().getDriverName() and see what you get.
> > > Probably it will be "SQLite.JDBCDriver"

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-08 Thread Joerg Pleumann
I agree the existence of the driver should be mentioned at least in
the JDBC package docs. Would you mind creating a ticket for this?

JDBC is somewhat of a second-class citizen in the Android world, since
Android has its own database API (that is actually not too far away
from JDBC, but has much better integration with the UI framework). I
guess this is why the docs don't encourage you to use JDBC. Still,
JDBC is usable, and - as you already noticed - it is possible to
install additional drivers.

Regarding android.jar, I never checked but I could imagine that it
contains only the public API classes and might even have the actual
bytecode erased. Nothing is ever run against it. It is just there to
make Javac or Eclipse happy (somebody please correct me if I'm wrong).
On the device, the driver should be part of /system/framework/
core.jar.

Cheers,
Joerg

On 8 Dez., 21:56, kristianlm  wrote:
> I see. I still think the documents are lacking!
>
> Am I the only one who'd want a comment on the JDBC
> support in the dev-guide documents?
>
> There seems to be a fair share of confused people out there ...
>
> On Dec 8, 8:33 pm, jotobjects  wrote:
>
> > On Dec 8, 11:02 am, kristianlm  wrote:
>
> > > I cant believe this though - there's already a driver available? I
> > > can't find that in the docs anywhere! Which java.sql online manual are
> > > you looking at? I'm 
> > > athttp://developer.android.com/reference/java/sql/package-summary.html
>
> >http://dev.android.com/reference/java/sql/package-summary.html
>
> > That's JDBC - the Connection object uses a JDBC driver for SQLite.
>
> > Try Connection.getMetaData().getDriverName() and see what you get.
> > Probably it will be "SQLite.JDBCDriver"
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-08 Thread kristianlm

I see. I still think the documents are lacking!

Am I the only one who'd want a comment on the JDBC
support in the dev-guide documents?

There seems to be a fair share of confused people out there ...

On Dec 8, 8:33 pm, jotobjects  wrote:
> On Dec 8, 11:02 am, kristianlm  wrote:
>
> > I cant believe this though - there's already a driver available? I
> > can't find that in the docs anywhere! Which java.sql online manual are
> > you looking at? I'm 
> > athttp://developer.android.com/reference/java/sql/package-summary.html
>
> http://dev.android.com/reference/java/sql/package-summary.html
>
> That's JDBC - the Connection object uses a JDBC driver for SQLite.
>
> Try Connection.getMetaData().getDriverName() and see what you get.
> Probably it will be "SQLite.JDBCDriver"

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-08 Thread jotobjects


On Dec 8, 11:02 am, kristianlm  wrote:

> I cant believe this though - there's already a driver available? I
> can't find that in the docs anywhere! Which java.sql online manual are
> you looking at? I'm 
> athttp://developer.android.com/reference/java/sql/package-summary.html

http://dev.android.com/reference/java/sql/package-summary.html

That's JDBC - the Connection object uses a JDBC driver for SQLite.

Try Connection.getMetaData().getDriverName() and see what you get.
Probably it will be "SQLite.JDBCDriver"

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-08 Thread kristianlm
no worries! I think we're all confused here (except Joerg)
i'm glad I'm not the only one who got this JDBC-android-support jungle
wrong

On Dec 8, 7:46 pm, "Mark Murphy"  wrote:
> > There is JDBC support in Android (see online reference for package
> > java.sql). There is also a built-in, though somewhat limited JDBC
> > driver for SQLite.
>
> :: blink, blink ::
>
> My apologies!
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Android App Developer Books:http://commonsware.com/books.html

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-08 Thread kristianlm


Hi Joerg,

sorry your post just came in while I was writing the other.

I cant believe this though - there's already a driver available? I
can't find that in the docs anywhere! Which java.sql online manual are
you looking at? I'm at 
http://developer.android.com/reference/java/sql/package-summary.html
but I don't see it anywhere.

Also, SQLite.JDBCDriver doesn't seem to be in android.jar ... any
ideas where it's coming from and why it's a secret?

And why is there no mention of JDBC in the database-section of:
http://developer.android.com/guide/topics/data/data-storage.html

Where can you turn to suggest such doc change?
I've seen several posts looking for JDBC access to their Android
SQLite db.

Anyways,
Thanks a lot for your help

On Dec 8, 7:37 pm, Joerg Pleumann  wrote:
> There is JDBC support in Android (see online reference for package
> java.sql). There is also a built-in, though somewhat limited JDBC
> driver for SQLite. Try this inside an Activity:
>
>         try {
>             String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";
>
>             Class.forName("SQLite.JDBCDriver");
>             Connection conn = DriverManager.getConnection(db);
>             Statement stat = conn.createStatement();
>             stat.executeUpdate("create table primes (number int);");
>             stat.executeUpdate("insert into primes values (2);");
>             stat.executeUpdate("insert into primes values (3);");
>             stat.executeUpdate("insert into primes values (5);");
>             stat.executeUpdate("insert into primes values (7);");
>
>             ResultSet rs = stat.executeQuery("select * from primes");
>             boolean b = rs.first();
>             while (b) {
>                 Log.d("JDBC", "Prime=" + rs.getInt(1));
>                 b = rs.next();
>             }
>
>             conn.close();
>         } catch (Exception e) {
>             Log.e("JDBC", "Error", e);
>         }
>
> Unless you really need to write or maintain portable code, I'd still
> recommend using the SQLite interface in the android.database package,
> because it's nicely integrated with the UI classes (ListActivity and
> the like).
>
> Cheers,
> Joerg
>
> On 8 Dez., 16:00, "Mark Murphy"  wrote:
>
> > > Why is no such JDBC driver already included in Android?
>
> > Android does not support JDBC.
>
> > > Am I missing the big picture here?
>
> > Android is designed to be used on devices with limited RAM, limited CPU,
> > limited storage space for application code, and limited electricity
> > (battery), to connect to local databases.
>
> > JDBC is designed to be used on devices with lots of RAM, lots of CPU
> > speed, comparatively unlimited storage space for application code,
> > full-time AC power, to connect to local databases and database servers.
>
> > > Why would you not want to interface the built-in SQLite engine
> > > through JDBC?
>
> > You lose performance, battery life, and on-board storage space, all of
> > which are in short supply in an Android device.
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > Android App Developer Books:http://commonsware.com/books.html

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-08 Thread jotobjects

> JDBC is designed to be used on devices with lots of RAM, lots of CPU
> speed, comparatively unlimited storage space for application code,
> full-time AC power, to connect to local databases and database servers.
>
JDBC drivers are often/usually used with remote databases (this is the
simplest meaning of 'n' tier).

> > Why would you not want to interface the built-in SQLite engine
> > through JDBC?
>
By Java API standards the JDBC API is pretty compact and some of the
drivers are very small.  But then you need a different driver for each
database and the drivers would be duplicated in every application
unless they were built into the platform (which databases would you
vote to exclude?).  JDBC by itself has verbose syntax. It require
knowledge of SQL and is not object oriented which has lead to a
plethora of ORM's like Hibernate and more recently to standard JPA
(OpenJPA).  All those drivers and all those ORM's would be a blot of
cement on an Android platform.  So for the intended use it seems like
SQLite is a pretty good alternative.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-08 Thread Mark Murphy
> There is JDBC support in Android (see online reference for package
> java.sql). There is also a built-in, though somewhat limited JDBC
> driver for SQLite.

:: blink, blink ::

My apologies!

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-08 Thread kristianlm
Hi Mark,
and thanks for your feedback.

I cannot say I quite follow you though. There isn't really that much
overhead involved, and my JAR-file is only 17kB. The JDBC Driver is a
simple wrapper for the SQLiteDatabase calls, but only a small subset
of the JDBC interface is implemented.

I haven't used JDBC extensively, but I don't see why you wouldn't want
to do the database basics using JDBC. That way, everyone wouldn't have
to learn another database API and the code would be portable. In my
opinion, these benefits undermine the minor overhead introduced by a
JDBC driver.

In JDBC, you can specify things like directions of cursor (e.g.
CURSOR_FORWARD_ONLY) etc. which fits nicely into the existing
SQLiteDatabase architecture. So I guess my argument is while JDBC is
designed for heavy stuff, it is still suitable for embedded stuff.
Specially when Android already has the JDBC interface readily
available.

- Kris


On Dec 8, 4:00 pm, "Mark Murphy"  wrote:
> > Why is no such JDBC driver already included in Android?
>
> Android does not support JDBC.
>
> > Am I missing the big picture here?
>
> Android is designed to be used on devices with limited RAM, limited CPU,
> limited storage space for application code, and limited electricity
> (battery), to connect to local databases.
>
> JDBC is designed to be used on devices with lots of RAM, lots of CPU
> speed, comparatively unlimited storage space for application code,
> full-time AC power, to connect to local databases and database servers.
>
> > Why would you not want to interface the built-in SQLite engine
> > through JDBC?
>
> You lose performance, battery life, and on-board storage space, all of
> which are in short supply in an Android device.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Android App Developer Books:http://commonsware.com/books.html

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: JDBC Driver for SQLiteDatabase

2009-12-08 Thread Joerg Pleumann
There is JDBC support in Android (see online reference for package
java.sql). There is also a built-in, though somewhat limited JDBC
driver for SQLite. Try this inside an Activity:

try {
String db = "jdbc:sqlite:" + getFilesDir() + "/test.db";

Class.forName("SQLite.JDBCDriver");
Connection conn = DriverManager.getConnection(db);
Statement stat = conn.createStatement();
stat.executeUpdate("create table primes (number int);");
stat.executeUpdate("insert into primes values (2);");
stat.executeUpdate("insert into primes values (3);");
stat.executeUpdate("insert into primes values (5);");
stat.executeUpdate("insert into primes values (7);");

ResultSet rs = stat.executeQuery("select * from primes");
boolean b = rs.first();
while (b) {
Log.d("JDBC", "Prime=" + rs.getInt(1));
b = rs.next();
}

conn.close();
} catch (Exception e) {
Log.e("JDBC", "Error", e);
}

Unless you really need to write or maintain portable code, I'd still
recommend using the SQLite interface in the android.database package,
because it's nicely integrated with the UI classes (ListActivity and
the like).

Cheers,
Joerg

On 8 Dez., 16:00, "Mark Murphy"  wrote:
> > Why is no such JDBC driver already included in Android?
>
> Android does not support JDBC.
>
> > Am I missing the big picture here?
>
> Android is designed to be used on devices with limited RAM, limited CPU,
> limited storage space for application code, and limited electricity
> (battery), to connect to local databases.
>
> JDBC is designed to be used on devices with lots of RAM, lots of CPU
> speed, comparatively unlimited storage space for application code,
> full-time AC power, to connect to local databases and database servers.
>
> > Why would you not want to interface the built-in SQLite engine
> > through JDBC?
>
> You lose performance, battery life, and on-board storage space, all of
> which are in short supply in an Android device.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> Android App Developer Books:http://commonsware.com/books.html

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en