Thread: Arduino SQL Connector

Arduino SQL Connector

From
Steve Spence
Date:
I'm using a MySQL library on my arduino that allows me to directly
connect to a MySQL database and perform SQL queries on the Arduino.

I need something similar for Postgres. Anyone have the knowledge and
interest to work with me?

Here is a sample of what I'm doing currently, and the results:

http://arduinotronics.blogspot.com/2014/04/arduino-based-sql-queries.html

http://green-trust.org/lmanco/find.php


Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


Re: Arduino SQL Connector

From
Bruce Momjian
Date:
On Thu, Apr 17, 2014 at 08:00:50AM -0400, Steve Spence wrote:
> I'm using a MySQL library on my arduino that allows me to directly
> connect to a MySQL database and perform SQL queries on the Arduino.
>
> I need something similar for Postgres. Anyone have the knowledge and
> interest to work with me?
>
> Here is a sample of what I'm doing currently, and the results:
>
> http://arduinotronics.blogspot.com/2014/04/arduino-based-sql-queries.html
>
> http://green-trust.org/lmanco/find.php

I have never heard of anyone writing a Postgres client connector for
Arduino, but it would certainly be possible to write if MySQL can have
one.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


Re: Arduino SQL Connector

From
Steve Spence
Date:
So, who wants to work on this with me? I'm a fair arduino programmer,
but know nothing about postgres.
Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


On Thu, Apr 17, 2014 at 9:37 AM, Bruce Momjian <bruce@momjian.us> wrote:
> On Thu, Apr 17, 2014 at 08:00:50AM -0400, Steve Spence wrote:
>> I'm using a MySQL library on my arduino that allows me to directly
>> connect to a MySQL database and perform SQL queries on the Arduino.
>>
>> I need something similar for Postgres. Anyone have the knowledge and
>> interest to work with me?
>>
>> Here is a sample of what I'm doing currently, and the results:
>>
>> http://arduinotronics.blogspot.com/2014/04/arduino-based-sql-queries.html
>>
>> http://green-trust.org/lmanco/find.php
>
> I have never heard of anyone writing a Postgres client connector for
> Arduino, but it would certainly be possible to write if MySQL can have
> one.
>
> --
>   Bruce Momjian  <bruce@momjian.us>        http://momjian.us
>   EnterpriseDB                             http://enterprisedb.com
>
>   + Everyone has their own god. +


Re: Arduino SQL Connector

From
Bruce Momjian
Date:
On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
> So, who wants to work on this with me? I'm a fair arduino programmer,
> but know nothing about postgres.

I would look at the MySQL one as a first step to see how that was done.
You are basically going to need to duplicate libpq, which is a major
undertaking.  There are some interfaces written in non-C languages like
Ruby and Java.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


Re: Arduino SQL Connector

From
Steve Spence
Date:
Here is the home for the mysql connector -
http://drcharlesbell.blogspot.com/2013/04/introducing-mysql-connectorarduino_6.html
Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


On Thu, Apr 17, 2014 at 10:37 AM, Bruce Momjian <bruce@momjian.us> wrote:
> On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>> So, who wants to work on this with me? I'm a fair arduino programmer,
>> but know nothing about postgres.
>
> I would look at the MySQL one as a first step to see how that was done.
> You are basically going to need to duplicate libpq, which is a major
> undertaking.  There are some interfaces written in non-C languages like
> Ruby and Java.
>
> --
>   Bruce Momjian  <bruce@momjian.us>        http://momjian.us
>   EnterpriseDB                             http://enterprisedb.com
>
>   + Everyone has their own god. +


Re: Arduino SQL Connector

From
David Rysdam
Date:
Bruce Momjian <bruce@momjian.us> writes:
> On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>> So, who wants to work on this with me? I'm a fair arduino programmer,
>> but know nothing about postgres.
>
> I would look at the MySQL one as a first step to see how that was done.
> You are basically going to need to duplicate libpq, which is a major
> undertaking.

Maybe I'm being naive, but isn't libpq already being compiled for ARM by
Debian? As long as it fits, you should be good. If it doesn't, you'll
need to strip some stuff out.

Attachment

Re: Arduino SQL Connector

From
Steve Spence
Date:
Not using arm or debian. Using a atmel 328p.
Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


On Thu, Apr 17, 2014 at 10:44 AM, David Rysdam <drysdam@ll.mit.edu> wrote:
> Bruce Momjian <bruce@momjian.us> writes:
>> On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>>> So, who wants to work on this with me? I'm a fair arduino programmer,
>>> but know nothing about postgres.
>>
>> I would look at the MySQL one as a first step to see how that was done.
>> You are basically going to need to duplicate libpq, which is a major
>> undertaking.
>
> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
> Debian? As long as it fits, you should be good. If it doesn't, you'll
> need to strip some stuff out.


Re: Arduino SQL Connector

From
Bruce Momjian
Date:
On Thu, Apr 17, 2014 at 10:44:36AM -0400, David Rysdam wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
> >> So, who wants to work on this with me? I'm a fair arduino programmer,
> >> but know nothing about postgres.
> >
> > I would look at the MySQL one as a first step to see how that was done.
> > You are basically going to need to duplicate libpq, which is a major
> > undertaking.
>
> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
> Debian? As long as it fits, you should be good. If it doesn't, you'll
> need to strip some stuff out.

Oh, can you run Debian ARM code on Arduino?  If so, Postgres's libpq
could be used directly, though it is probably too big, as you mentioned.
The MySQL driver is C++, which surprised me.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


Re: Arduino SQL Connector

From
Adrian Klaver
Date:
On 04/17/2014 07:44 AM, David Rysdam wrote:
> Bruce Momjian <bruce@momjian.us> writes:
>> On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>>> So, who wants to work on this with me? I'm a fair arduino programmer,
>>> but know nothing about postgres.
>>
>> I would look at the MySQL one as a first step to see how that was done.
>> You are basically going to need to duplicate libpq, which is a major
>> undertaking.
>
> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
> Debian? As long as it fits, you should be good. If it doesn't, you'll
> need to strip some stuff out.
>

If you get the MySQL connector from here:

https://launchpad.net/mysql-arduino/+milestone/release-1.0.2-beta

you will see they are doing the equivalent, using the MySQL libmysqlclient:

http://dev.mysql.com/downloads/connector/c/

--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Arduino SQL Connector

From
Steve Spence
Date:
no, you can't run arm / debian on an arduino UNO. it's all c++
compiled to machine code then uploaded.
Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


On Thu, Apr 17, 2014 at 10:49 AM, Bruce Momjian <bruce@momjian.us> wrote:
> On Thu, Apr 17, 2014 at 10:44:36AM -0400, David Rysdam wrote:
>> Bruce Momjian <bruce@momjian.us> writes:
>> > On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>> >> So, who wants to work on this with me? I'm a fair arduino programmer,
>> >> but know nothing about postgres.
>> >
>> > I would look at the MySQL one as a first step to see how that was done.
>> > You are basically going to need to duplicate libpq, which is a major
>> > undertaking.
>>
>> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
>> Debian? As long as it fits, you should be good. If it doesn't, you'll
>> need to strip some stuff out.
>
> Oh, can you run Debian ARM code on Arduino?  If so, Postgres's libpq
> could be used directly, though it is probably too big, as you mentioned.
> The MySQL driver is C++, which surprised me.
>
> --
>   Bruce Momjian  <bruce@momjian.us>        http://momjian.us
>   EnterpriseDB                             http://enterprisedb.com
>
>   + Everyone has their own god. +


Re: Arduino SQL Connector

From
David Rysdam
Date:
Bruce Momjian <bruce@momjian.us> writes:
> On Thu, Apr 17, 2014 at 10:44:36AM -0400, David Rysdam wrote:
>> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
>> Debian? As long as it fits, you should be good. If it doesn't, you'll
>> need to strip some stuff out.
>
> Oh, can you run Debian ARM code on Arduino?  If so, Postgres's libpq
> could be used directly, though it is probably too big, as you mentioned.
> The MySQL driver is C++, which surprised me.

Well, I don't know about just picking it up and moving it over. But back
in the day I wrote a C library which I cross-compiled for ARM on my
Intel Linux box and used with my Arduino. At least, I think that's what
I did. This was 6 years ago.

The fact that it (presumably) compiles on Debian under ARM should mean
it would Just Cross-Compile for Arduino. Whether it would fit is another
question.

Attachment

Re: Arduino SQL Connector

From
Jan Wieck
Date:
On 04/17/14 10:49, Bruce Momjian wrote:
> On Thu, Apr 17, 2014 at 10:44:36AM -0400, David Rysdam wrote:
>> Bruce Momjian <bruce@momjian.us> writes:
>> > On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>> >> So, who wants to work on this with me? I'm a fair arduino programmer,
>> >> but know nothing about postgres.
>> >
>> > I would look at the MySQL one as a first step to see how that was done.
>> > You are basically going to need to duplicate libpq, which is a major
>> > undertaking.
>>
>> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
>> Debian? As long as it fits, you should be good. If it doesn't, you'll
>> need to strip some stuff out.
>
> Oh, can you run Debian ARM code on Arduino?  If so, Postgres's libpq
> could be used directly, though it is probably too big, as you mentioned.
> The MySQL driver is C++, which surprised me.

No, to do that you'd need something like a Beaglebone, which is ARM
Cortex A8 based and runs Linux anyway.

http://www.ti.com/tool/beaglebk?DCMP=PPC_Google_TI&k_clickid=63c22498-5f5d-3789-4b41-00000dabd35d

I don't think porting the whole libpq over to an Arduino would be a good
move. For practical purposes a small subset of functionality through
some gateway service would probably be a better approach.

Note that I am not an Arduino user/developer. I'm more familiar with the
Microchip PICs.


73 de WI3CK

--
Jan Wieck
Senior Software Engineer
http://slony.info


Re: Arduino SQL Connector

From
David Rysdam
Date:
Steve Spence <greentrust@gmail.com> writes:
> no, you can't run arm / debian on an arduino UNO. it's all c++
> compiled to machine code then uploaded.

This is how all executables work.

Attachment

Re: Arduino SQL Connector

From
John R Pierce
Date:
On 4/17/2014 7:46 AM, Steve Spence wrote:
> Not using arm or debian. Using a atmel 328p.

which is an AVR processor architecture.   16 bit, limited memory space.

you should be able to compile libpq as a static linkable library if you
have an AVR compiler, its pure C.   I would leave out SSL support if you
can, as openssl is a mess.


--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: Arduino SQL Connector

From
Andy Colson
Date:
On 4/17/2014 9:44 AM, David Rysdam wrote:
> Bruce Momjian <bruce@momjian.us> writes:
>> On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>>> So, who wants to work on this with me? I'm a fair arduino programmer,
>>> but know nothing about postgres.
>>
>> I would look at the MySQL one as a first step to see how that was done.
>> You are basically going to need to duplicate libpq, which is a major
>> undertaking.
>
> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
> Debian? As long as it fits, you should be good. If it doesn't, you'll
> need to strip some stuff out.
>

Yeah, agreed, no need to rewrite it.  Just cross compile it.  Even if
you cant use the Debian build, you are already cross compiling stuff,
right?

-Andy


Re: Arduino SQL Connector

From
Steve Spence
Date:
Oracle thought it was a good idea to put out a MySQL version, I figure
there should be some effort to counter that here .....

Need a Team lead on this, and I'll collaborate as much as I can on the
Arduino / Networking side.
Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


On Thu, Apr 17, 2014 at 1:37 PM, Andy Colson <andy@squeakycode.net> wrote:
> On 4/17/2014 9:44 AM, David Rysdam wrote:
>>
>> Bruce Momjian <bruce@momjian.us> writes:
>>>
>>> On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>>>>
>>>> So, who wants to work on this with me? I'm a fair arduino programmer,
>>>> but know nothing about postgres.
>>>
>>>
>>> I would look at the MySQL one as a first step to see how that was done.
>>> You are basically going to need to duplicate libpq, which is a major
>>> undertaking.
>>
>>
>> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
>> Debian? As long as it fits, you should be good. If it doesn't, you'll
>> need to strip some stuff out.
>>
>
> Yeah, agreed, no need to rewrite it.  Just cross compile it.  Even if you
> cant use the Debian build, you are already cross compiling stuff, right?
>
> -Andy


Re: Arduino SQL Connector

From
Tomas Vondra
Date:
On 17.4.2014 16:51, Adrian Klaver wrote:
> On 04/17/2014 07:44 AM, David Rysdam wrote:
>> Bruce Momjian <bruce@momjian.us> writes:
>>> On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>>>> So, who wants to work on this with me? I'm a fair arduino programmer,
>>>> but know nothing about postgres.
>>>
>>> I would look at the MySQL one as a first step to see how that was done.
>>> You are basically going to need to duplicate libpq, which is a major
>>> undertaking.
>>
>> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
>> Debian? As long as it fits, you should be good. If it doesn't, you'll
>> need to strip some stuff out.
>>
>
> If you get the MySQL connector from here:
>
> https://launchpad.net/mysql-arduino/+milestone/release-1.0.2-beta
>
> you will see they are doing the equivalent, using the MySQL libmysqlclient:
>
> http://dev.mysql.com/downloads/connector/c/

Really? I see no reference to libmysqlclient there. It seems they're
simply reimplementing only a (small) subset of the library.

Tomas


Re: Arduino SQL Connector

From
Tomas Vondra
Date:
On 17.4.2014 19:43, Steve Spence wrote:
> Oracle thought it was a good idea to put out a MySQL version, I
> figure there should be some effort to counter that here .....

Really? I found no information about this on oracle.com or mysql.com,
except for a section in the discussion forum with ~20 posts. It's true
that the author is apparently a Senior Software Engineer at Oracle, but
this seems like a his own project. So much regarding the "Oracle
thought" part ...

BTW I doubt the approach "Oracle does X => you should do X too" will be
fruitful here.

> Need a Team lead on this, and I'll collaborate as much as I can on the
> Arduino / Networking side.

I'm a bit confused. What do you mean by "team lead"? I was thinking that
maybe this would be a fun project for the holidays, refreshing my
Arduino-fu. But no way I'm interested in being a TL of anything.

I was messing with the PostgreSQL protocol [1] recently, and writing a
code implementing something like what the mysql connector does would be
quite trivial. A day of work, maybe two if you know networking but not
the protocol.

regards
Tomas

[1] http://www.postgresql.org/docs/9.3/interactive/protocol.html


Re: Arduino SQL Connector

From
Adrian Klaver
Date:
On 04/17/2014 03:04 PM, Tomas Vondra wrote:
> On 17.4.2014 16:51, Adrian Klaver wrote:
>> On 04/17/2014 07:44 AM, David Rysdam wrote:
>>> Bruce Momjian <bruce@momjian.us> writes:
>>>> On Thu, Apr 17, 2014 at 09:39:55AM -0400, Steve Spence wrote:
>>>>> So, who wants to work on this with me? I'm a fair arduino programmer,
>>>>> but know nothing about postgres.
>>>>
>>>> I would look at the MySQL one as a first step to see how that was done.
>>>> You are basically going to need to duplicate libpq, which is a major
>>>> undertaking.
>>>
>>> Maybe I'm being naive, but isn't libpq already being compiled for ARM by
>>> Debian? As long as it fits, you should be good. If it doesn't, you'll
>>> need to strip some stuff out.
>>>
>>
>> If you get the MySQL connector from here:
>>
>> https://launchpad.net/mysql-arduino/+milestone/release-1.0.2-beta
>>
>> you will see they are doing the equivalent, using the MySQL libmysqlclient:
>>
>> http://dev.mysql.com/downloads/connector/c/
>
> Really? I see no reference to libmysqlclient there. It seems they're
> simply reimplementing only a (small) subset of the library.

My mistake, was reading to fast and assumed facts not in evidence.
>
> Tomas
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Arduino SQL Connector

From
Steve Spence
Date:
I'm trying to port my application from mysql to postgres (for the GIS
supoort). I had hoped there would be wild enthsuiasm for such a
project, as the Arduino community is extremely large, and this would
push postgres into a wider audience. I expected it would take multiple
people with varying backgrounds to accomplish the task. If you can do
it on your own, great. I'll be happy to lend what knowledge I have of
the Arduino and using the mysql connector -
http://www.green-trust.org/lmanco/find.php
Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


On Thu, Apr 17, 2014 at 6:21 PM, Tomas Vondra <tv@fuzzy.cz> wrote:
> On 17.4.2014 19:43, Steve Spence wrote:
>> Oracle thought it was a good idea to put out a MySQL version, I
>> figure there should be some effort to counter that here .....
>
> Really? I found no information about this on oracle.com or mysql.com,
> except for a section in the discussion forum with ~20 posts. It's true
> that the author is apparently a Senior Software Engineer at Oracle, but
> this seems like a his own project. So much regarding the "Oracle
> thought" part ...
>
> BTW I doubt the approach "Oracle does X => you should do X too" will be
> fruitful here.
>
>> Need a Team lead on this, and I'll collaborate as much as I can on the
>> Arduino / Networking side.
>
> I'm a bit confused. What do you mean by "team lead"? I was thinking that
> maybe this would be a fun project for the holidays, refreshing my
> Arduino-fu. But no way I'm interested in being a TL of anything.
>
> I was messing with the PostgreSQL protocol [1] recently, and writing a
> code implementing something like what the mysql connector does would be
> quite trivial. A day of work, maybe two if you know networking but not
> the protocol.
>
> regards
> Tomas
>
> [1] http://www.postgresql.org/docs/9.3/interactive/protocol.html
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


Re: Arduino SQL Connector

From
Jan Wieck
Date:
On 04/17/14 20:01, Steve Spence wrote:
> I'm trying to port my application from mysql to postgres (for the GIS
> supoort). I had hoped there would be wild enthsuiasm for such a
> project, as the Arduino community is extremely large, and this would
> push postgres into a wider audience. I expected it would take multiple
> people with varying backgrounds to accomplish the task. If you can do
> it on your own, great. I'll be happy to lend what knowledge I have of
> the Arduino and using the mysql connector -

This is a pattern I've seen for over a decade now. People think that
randomly sprinkling "MySQL" into a discussion will generate "wild
enthusiasm" for supporting "their attempt to port *their* appli ..."
wait ... oh ... didn't work again?

Bummer!


Jan


> http://www.green-trust.org/lmanco/find.php
> Steve Spence, KK4HFJ
> Director, Green Trust
> http://www.green-trust.org
> Http://arduinotronics.blogspot.com
>
>
> On Thu, Apr 17, 2014 at 6:21 PM, Tomas Vondra <tv@fuzzy.cz> wrote:
>> On 17.4.2014 19:43, Steve Spence wrote:
>>> Oracle thought it was a good idea to put out a MySQL version, I
>>> figure there should be some effort to counter that here .....
>>
>> Really? I found no information about this on oracle.com or mysql.com,
>> except for a section in the discussion forum with ~20 posts. It's true
>> that the author is apparently a Senior Software Engineer at Oracle, but
>> this seems like a his own project. So much regarding the "Oracle
>> thought" part ...
>>
>> BTW I doubt the approach "Oracle does X => you should do X too" will be
>> fruitful here.
>>
>>> Need a Team lead on this, and I'll collaborate as much as I can on the
>>> Arduino / Networking side.
>>
>> I'm a bit confused. What do you mean by "team lead"? I was thinking that
>> maybe this would be a fun project for the holidays, refreshing my
>> Arduino-fu. But no way I'm interested in being a TL of anything.
>>
>> I was messing with the PostgreSQL protocol [1] recently, and writing a
>> code implementing something like what the mysql connector does would be
>> quite trivial. A day of work, maybe two if you know networking but not
>> the protocol.
>>
>> regards
>> Tomas
>>
>> [1] http://www.postgresql.org/docs/9.3/interactive/protocol.html
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>
>


--
Jan Wieck
Senior Software Engineer
http://slony.info


Re: Arduino SQL Connector

From
Steve Spence
Date:
You know what? Fine, it doesn't matter that much to me. I'm happy to
continue using MySQL. It works with the Arduino quite nicely. Postgres
doesn't work. That's Postgres loss not mine. I really thought the
postgres team would be interested in providing support for a very
popular microcontroller system. If not, they are missing out on a
larger segment of users.

The MySQL connector is copyrighted and GPL'd by Oracle, it would be
nice if Postgres would do something similar for those that prefer
using Postgres instead of forcing people touse MySQL. My mistake in
thinking this might be the case. Or Maybe Jan doesn't speak for
Postgres .....
Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


On Fri, Apr 18, 2014 at 12:02 AM, Jan Wieck <jan@wi3ck.info> wrote:
> On 04/17/14 20:01, Steve Spence wrote:
>>
>> I'm trying to port my application from mysql to postgres (for the GIS
>> supoort). I had hoped there would be wild enthsuiasm for such a
>> project, as the Arduino community is extremely large, and this would
>> push postgres into a wider audience. I expected it would take multiple
>> people with varying backgrounds to accomplish the task. If you can do
>> it on your own, great. I'll be happy to lend what knowledge I have of
>> the Arduino and using the mysql connector -
>
>
> This is a pattern I've seen for over a decade now. People think that
> randomly sprinkling "MySQL" into a discussion will generate "wild
> enthusiasm" for supporting "their attempt to port *their* appli ..." wait
> ... oh ... didn't work again?
>
> Bummer!
>
>
> Jan
>
>
>> http://www.green-trust.org/lmanco/find.php
>> Steve Spence, KK4HFJ
>> Director, Green Trust
>> http://www.green-trust.org
>> Http://arduinotronics.blogspot.com
>>
>>
>> On Thu, Apr 17, 2014 at 6:21 PM, Tomas Vondra <tv@fuzzy.cz> wrote:
>>>
>>> On 17.4.2014 19:43, Steve Spence wrote:
>>>>
>>>> Oracle thought it was a good idea to put out a MySQL version, I
>>>> figure there should be some effort to counter that here .....
>>>
>>>
>>> Really? I found no information about this on oracle.com or mysql.com,
>>> except for a section in the discussion forum with ~20 posts. It's true
>>> that the author is apparently a Senior Software Engineer at Oracle, but
>>> this seems like a his own project. So much regarding the "Oracle
>>> thought" part ...
>>>
>>> BTW I doubt the approach "Oracle does X => you should do X too" will be
>>> fruitful here.
>>>
>>>> Need a Team lead on this, and I'll collaborate as much as I can on the
>>>> Arduino / Networking side.
>>>
>>>
>>> I'm a bit confused. What do you mean by "team lead"? I was thinking that
>>> maybe this would be a fun project for the holidays, refreshing my
>>> Arduino-fu. But no way I'm interested in being a TL of anything.
>>>
>>> I was messing with the PostgreSQL protocol [1] recently, and writing a
>>> code implementing something like what the mysql connector does would be
>>> quite trivial. A day of work, maybe two if you know networking but not
>>> the protocol.
>>>
>>> regards
>>> Tomas
>>>
>>> [1] http://www.postgresql.org/docs/9.3/interactive/protocol.html
>>>
>>>
>>> --
>>> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
>>> To make changes to your subscription:
>>> http://www.postgresql.org/mailpref/pgsql-general
>>
>>
>>
>
>
> --
> Jan Wieck
> Senior Software Engineer
> http://slony.info


Re: Arduino SQL Connector

From
John R Pierce
Date:
On 4/17/2014 9:09 PM, Steve Spence wrote:
> You know what? Fine, it doesn't matter that much to me. I'm happy to
> continue using MySQL. It works with the Arduino quite nicely. Postgres
> doesn't work. That's Postgres loss not mine. I really thought the
> postgres team would be interested in providing support for a very
> popular microcontroller system. If not, they are missing out on a
> larger segment of users.

personal opinion:

I don't think a terminal device like a PC or an embedded system should
be talking directly to SQL at all.   instead, they should be talking to
an application server which implements the "business logic", and THAT
talks to the database.




--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: Arduino SQL Connector

From
Steve Spence
Date:
On 4/18/2014 12:21 AM, John R Pierce wrote:
>
> personal opinion:
>
> I don't think a terminal device like a PC or an embedded system should
> be talking directly to SQL at all.   instead, they should be talking
> to an application server which implements the "business logic", and
> THAT talks to the database.
>
>
>
>
When all we need to do is log sensor values, there's no business logic
needed. It's scientific data collection, and direct to SQL works very
nicely. It's fast and clean.

--
Steve, KK4HFJ

http://www.green-trust.org

http://www.essnmag.com

http://arduinotronics.blogspot.com



Re: Arduino SQL Connector

From
Jan Wieck
Date:
On 04/18/14 00:09, Steve Spence wrote:
> You know what? Fine, it doesn't matter that much to me. I'm happy to
> continue using MySQL. It works with the Arduino quite nicely. Postgres
> doesn't work. That's Postgres loss not mine. I really thought the
> postgres team would be interested in providing support for a very
> popular microcontroller system. If not, they are missing out on a
> larger segment of users.
>
> The MySQL connector is copyrighted and GPL'd by Oracle, it would be
> nice if Postgres would do something similar for those that prefer
> using Postgres instead of forcing people touse MySQL. My mistake in
> thinking this might be the case. Or Maybe Jan doesn't speak for
> Postgres .....

Steve,

I certainly do *not* speak for Postgres or its community. I actually
resigned from the CORE team a few years ago, so I explicitly do *not*
speak in any such role!

I only happen to be someone who did contribute one or more features to
the PostgreSQL project in the past. None of those contributions happened
by simply asking for "wild enthusiasm" for whatever I needed at that
moment.

I understand that you want PostgreSQL support for your favorite embedded
platform, but that will not happen unless you can generate enthusiasm
for PostgreSQL in the Arduino community. I know how funny that sounds,
because that is like asking to generate PostgreSQL enthusiasm in the
"yet another Perl based CMS" community. Not going to happen any time
soon. They all love dumb and fast bit buckets because they don't
understand the term "set oriented".

Fine with me, and probably (note: not speaking for, just guesstimating)
most of the audience here.


Regards,
Jan


> Steve Spence, KK4HFJ
> Director, Green Trust
> http://www.green-trust.org
> Http://arduinotronics.blogspot.com
>
>
> On Fri, Apr 18, 2014 at 12:02 AM, Jan Wieck <jan@wi3ck.info> wrote:
>> On 04/17/14 20:01, Steve Spence wrote:
>>>
>>> I'm trying to port my application from mysql to postgres (for the GIS
>>> supoort). I had hoped there would be wild enthsuiasm for such a
>>> project, as the Arduino community is extremely large, and this would
>>> push postgres into a wider audience. I expected it would take multiple
>>> people with varying backgrounds to accomplish the task. If you can do
>>> it on your own, great. I'll be happy to lend what knowledge I have of
>>> the Arduino and using the mysql connector -
>>
>>
>> This is a pattern I've seen for over a decade now. People think that
>> randomly sprinkling "MySQL" into a discussion will generate "wild
>> enthusiasm" for supporting "their attempt to port *their* appli ..." wait
>> ... oh ... didn't work again?
>>
>> Bummer!
>>
>>
>> Jan
>>
>>
>>> http://www.green-trust.org/lmanco/find.php
>>> Steve Spence, KK4HFJ
>>> Director, Green Trust
>>> http://www.green-trust.org
>>> Http://arduinotronics.blogspot.com
>>>
>>>
>>> On Thu, Apr 17, 2014 at 6:21 PM, Tomas Vondra <tv@fuzzy.cz> wrote:
>>>>
>>>> On 17.4.2014 19:43, Steve Spence wrote:
>>>>>
>>>>> Oracle thought it was a good idea to put out a MySQL version, I
>>>>> figure there should be some effort to counter that here .....
>>>>
>>>>
>>>> Really? I found no information about this on oracle.com or mysql.com,
>>>> except for a section in the discussion forum with ~20 posts. It's true
>>>> that the author is apparently a Senior Software Engineer at Oracle, but
>>>> this seems like a his own project. So much regarding the "Oracle
>>>> thought" part ...
>>>>
>>>> BTW I doubt the approach "Oracle does X => you should do X too" will be
>>>> fruitful here.
>>>>
>>>>> Need a Team lead on this, and I'll collaborate as much as I can on the
>>>>> Arduino / Networking side.
>>>>
>>>>
>>>> I'm a bit confused. What do you mean by "team lead"? I was thinking that
>>>> maybe this would be a fun project for the holidays, refreshing my
>>>> Arduino-fu. But no way I'm interested in being a TL of anything.
>>>>
>>>> I was messing with the PostgreSQL protocol [1] recently, and writing a
>>>> code implementing something like what the mysql connector does would be
>>>> quite trivial. A day of work, maybe two if you know networking but not
>>>> the protocol.
>>>>
>>>> regards
>>>> Tomas
>>>>
>>>> [1] http://www.postgresql.org/docs/9.3/interactive/protocol.html
>>>>
>>>>
>>>> --
>>>> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
>>>> To make changes to your subscription:
>>>> http://www.postgresql.org/mailpref/pgsql-general
>>>
>>>
>>>
>>
>>
>> --
>> Jan Wieck
>> Senior Software Engineer
>> http://slony.info
>


--
Jan Wieck
Senior Software Engineer
http://slony.info


Re: Arduino SQL Connector

From
Jan Wieck
Date:
On 04/18/14 00:27, Steve Spence wrote:
> On 4/18/2014 12:21 AM, John R Pierce wrote:
>>
>> personal opinion:
>>
>> I don't think a terminal device like a PC or an embedded system should
>> be talking directly to SQL at all.   instead, they should be talking
>> to an application server which implements the "business logic", and
>> THAT talks to the database.
>>
>>
>>
>>
> When all we need to do is log sensor values, there's no business logic
> needed. It's scientific data collection, and direct to SQL works very
> nicely. It's fast and clean.

In that case you should be sending messages to a message bus or queue.

The bus/queue receiver will then push the data into the database or
whatever downstream system.


Jan


--
Jan Wieck
Senior Software Engineer
http://slony.info


Re: Arduino SQL Connector

From
Gavin Flower
Date:
On 18/04/14 16:27, Steve Spence wrote:
> On 4/18/2014 12:21 AM, John R Pierce wrote:
>>
>> personal opinion:
>>
>> I don't think a terminal device like a PC or an embedded system
>> should be talking directly to SQL at all.   instead, they should be
>> talking to an application server which implements the "business
>> logic", and THAT talks to the database.
>>
>>
>>
>>
> When all we need to do is log sensor values, there's no business logic
> needed. It's scientific data collection, and direct to SQL works very
> nicely. It's fast and clean.
>
If you are just logging sensor values, why bother with a database?

I share John's point of view.  If you find a database useful, then
architectures that shield the database from external systems and users
is preferred for a number of reasons - such as giving you far more
flexbility for adding additional functionality in the future, and
providing better security.  Any processing of scientific data is
considered "business logic", in this context. Simply because people use
MySQL in a dubious ways (there are many problems in MySQL anyway, that
make me want to cringe), does not mean they are practices to be
encouraged by responsible software developers.

So if you are serious about your data integrity, and really think a
database is appropriate, then I would definitely recommend PostgreSQL
over MySQL.  I have done programming and DBA work with MySQL, but I
would never recommend it (even before Oracle got their hands on it!) for
a new project.

Cheers,
Gavin





Re: Arduino SQL Connector

From
"Tomas Vondra"
Date:
Steve, please stop top-posting, especially if others bottom-post. It turns
the messages a hard to follow mess. I took the liberty to reshuffle the
parts a bit.

On 18 Duben 2014, 6:09, Steve Spence wrote:
>
> On Fri, Apr 18, 2014 at 12:02 AM, Jan Wieck <jan@wi3ck.info> wrote:
>> On 04/17/14 20:01, Steve Spence wrote:
>>>
>>> I'm trying to port my application from mysql to postgres (for the GIS
>>> supoort). I had hoped there would be wild enthsuiasm for such a
>>> project, as the Arduino community is extremely large, and this would
>>> push postgres into a wider audience. I expected it would take multiple
>>> people with varying backgrounds to accomplish the task. If you can do
>>> it on your own, great. I'll be happy to lend what knowledge I have of
>>> the Arduino and using the mysql connector -
>>
>>
>> This is a pattern I've seen for over a decade now. People think that
>> randomly sprinkling "MySQL" into a discussion will generate "wild
>> enthusiasm" for supporting "their attempt to port *their* appli ..."
>> wait
>> ... oh ... didn't work again?

Yeah. "MySQL does X" is not an argument for us to do X too.

> You know what? Fine, it doesn't matter that much to me. I'm happy to
> continue using MySQL. It works with the Arduino quite nicely. Postgres
> doesn't work. That's Postgres loss not mine. I really thought the
> postgres team would be interested in providing support for a very
> popular microcontroller system. If not, they are missing out on a
> larger segment of users.

Please, enough of this "Fine with me, if you're not interested!" attitude.

What exactly have you expected to happen, given the (minimal) amount of
info you provided initially? Had you wanted to get us excited, you'd
post an explanation of how exciting the project is, what it does etc.

> The MySQL connector is copyrighted and GPL'd by Oracle, it would be

It's witten by a person who happens to work for Oracle and apparently is
an arduino hacker too. That's exactly what Jan Wieck explained above.
And it's also very different from "Oracle decided to support arduino."

> nice if Postgres would do something similar for those that prefer
> using Postgres instead of forcing people touse MySQL. My mistake in
> thinking this might be the case. Or Maybe Jan doesn't speak for
> Postgres .....

We're not forcing anyone to use anything. But we're not responsible for
supporting every use-case that is out there either, that's not how this
community works IMHO.

But actually we already did a lot of work to support even your use case.
For example we have a great documentation of how the protocol works [1],
with detailed explanation of how to send simple queries [2].

If all you need is a simple authentication (trust, plaintext, md5) and
simple queries (insert as a single string), it's pretty trivial.

[1] http://www.postgresql.org/docs/9.1/static/protocol.html
[2] http://www.postgresql.org/docs/9.1/static/protocol-flow.html#AEN91596

Feel free to ask if you run into some issues here.

regards
Tomas

PS: I do share the view that sending the data to a simple proxy (e.g. a
    simple process waiting for data sent over UDP), forwarding the data
    to PostgreSQL would be simpler/cleaner/...




Re: Arduino SQL Connector

From
David Rysdam
Date:
Steve Spence <greentrust@gmail.com> writes:
> Need a Team lead on this, and I'll collaborate as much as I can on the
> Arduino / Networking side.

I don't understand why there is so much blowback to the idea that you
can just use the existing code. Why exactly wouldn't it work? It
compiles on that architecture already. The only possible issue is size.

Take the libpq source and cross-compile it for the Arduino. I did this
back in 2008 or so for a stepper motor driver that didn't work how I
wanted.

I wouldn't be surprised if the lame Arduino *IDE* won't do this, but
what does that matter?  You can make the library by cross-compiling,
then include it in your Arduino sketch.

That said, I agree with the other poster who questioned why you'd put
the DB client on the device anyway. Seems needlessly difficult and
limiting. Just put a simple serial writer on that end and have a tiny
serial->DB translator on the same machine you were going to put the DB
on. Done in about an hour and you can switch DBMSs without having to
touch the device.


Re: Arduino SQL Connector

From
Steve Spence
Date:
It's actually quite freeing, not complicating. I can put the values
right into the fields I need them to be in (or get values from the
database I need to control the Arduino), without going through a
intermediate process. If you have a serial process I can look at that
works with 1000 or more remote sensors all over the world to a hosted
database server, I'd love to look at it. Right now what I have works,
but I have no GIS functionality.

Sorry if I came across with perceived attitude, but I explained what I
was currently doing (and it works well), gave a working example link,
showed the source code link that makes it work, but apparently had the
audacity to think that Postgres would want to participate in a IOT
phenomenon. I'm not asking for help porting my application, I'm
suggesting that postgres would find hundreds of thousands of new fans
if they chose to support this useful device in such a manner.

The Arduino is very good at compiling includes written in C/C++. just
need a .h and .ccp file with the correct syntax, but very compact. It
used to be part of the fun making programs fit in 4-16k back in the
day.

I write my "business logic" in a php app that resides on the server
that uses the data from the sensor table, creates graphs, outputs pdf
reports and pushes control decisions back to the arduino through a
jobs queue table. A simple "select * from" on the arduino picks up the
control jobs and sets outputs accordingly.
Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


On Fri, Apr 18, 2014 at 6:53 AM, David Rysdam <drysdam@ll.mit.edu> wrote:
> Steve Spence <greentrust@gmail.com> writes:
>> Need a Team lead on this, and I'll collaborate as much as I can on the
>> Arduino / Networking side.
>
> I don't understand why there is so much blowback to the idea that you
> can just use the existing code. Why exactly wouldn't it work? It
> compiles on that architecture already. The only possible issue is size.
>
> Take the libpq source and cross-compile it for the Arduino. I did this
> back in 2008 or so for a stepper motor driver that didn't work how I
> wanted.
>
> I wouldn't be surprised if the lame Arduino *IDE* won't do this, but
> what does that matter?  You can make the library by cross-compiling,
> then include it in your Arduino sketch.
>
> That said, I agree with the other poster who questioned why you'd put
> the DB client on the device anyway. Seems needlessly difficult and
> limiting. Just put a simple serial writer on that end and have a tiny
> serial->DB translator on the same machine you were going to put the DB
> on. Done in about an hour and you can switch DBMSs without having to
> touch the device.


Re: Arduino SQL Connector

From
David Rysdam
Date:
Steve Spence <greentrust@gmail.com> writes:
> The Arduino is very good at compiling includes written in C/C++. just
> need a .h and .ccp file with the correct syntax, but very compact. It
> used to be part of the fun making programs fit in 4-16k back in the
> day.

And what happened when you tried the suggestions you got to use the
existing code?


Re: Arduino SQL Connector

From
Steve Spence
Date:
It's too big for the 20k memory slot, and not in the correct format.
it's not  formatted for a arduino library, and I'm not a good enough
coder to make it work. That's why I asked for help. I can use a
arduino library, I can't make one of this magnitude. I can't be the
only one that would like to use postgres with an arduino, right?
Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com


On Fri, Apr 18, 2014 at 7:24 AM, David Rysdam <drysdam@ll.mit.edu> wrote:
> Steve Spence <greentrust@gmail.com> writes:
>> The Arduino is very good at compiling includes written in C/C++. just
>> need a .h and .ccp file with the correct syntax, but very compact. It
>> used to be part of the fun making programs fit in 4-16k back in the
>> day.
>
> And what happened when you tried the suggestions you got to use the
> existing code?


Re: Arduino SQL Connector

From
David Rysdam
Date:
Steve Spence <greentrust@gmail.com> writes:
> It's actually quite freeing, not complicating. I can put the values
> right into the fields I need them to be in (or get values from the
> database I need to control the Arduino), without going through a
> intermediate process. If you have a serial process I can look at that
> works with 1000 or more remote sensors all over the world to a hosted
> database server, I'd love to look at it. Right now what I have works,
> but I have no GIS functionality.

I'm not going to claim this is a great design, but it's at least an
order of magnitude easier than your proposal:

Set up the simplest web server that will run PHP. Program the Arduinos
to submit POST requests to it (which is just networking you say you can
already handle), by which they submit their SQL strings. Write a PHP
script that passes those to PostgreSQL.

The webserver should be able to handle at least as much as what you were
going to throw at the DB server, so there's no load problem.


Re: Arduino SQL Connector

From
Steve Spence
Date:
And that is the way I used to do it, before the Arduino MySQL connector came out. It was nice not to have to go though the double stepping any more. Hence my interest in a Arduino PostgreSQL Connector. 

Here is how it works today. slim and clean - http://www.green-trust.org/lmanco/find.php

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Fri, Apr 18, 2014 at 8:15 AM, David Rysdam <drysdam@ll.mit.edu> wrote:
Steve Spence <greentrust@gmail.com> writes:
> It's actually quite freeing, not complicating. I can put the values
> right into the fields I need them to be in (or get values from the
> database I need to control the Arduino), without going through a
> intermediate process. If you have a serial process I can look at that
> works with 1000 or more remote sensors all over the world to a hosted
> database server, I'd love to look at it. Right now what I have works,
> but I have no GIS functionality.

I'm not going to claim this is a great design, but it's at least an
order of magnitude easier than your proposal:

Set up the simplest web server that will run PHP. Program the Arduinos
to submit POST requests to it (which is just networking you say you can
already handle), by which they submit their SQL strings. Write a PHP
script that passes those to PostgreSQL.

The webserver should be able to handle at least as much as what you were
going to throw at the DB server, so there's no load problem.

Re: Arduino SQL Connector

From
Robin
Date:
I have bottom posted

On 18/04/2014 14:20, Steve Spence wrote:
And that is the way I used to do it, before the Arduino MySQL connector came out. It was nice not to have to go though the double stepping any more. Hence my interest in a Arduino PostgreSQL Connector. 

Here is how it works today. slim and clean - http://www.green-trust.org/lmanco/find.php

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Fri, Apr 18, 2014 at 8:15 AM, David Rysdam <drysdam@ll.mit.edu> wrote:
Steve Spence <greentrust@gmail.com> writes:
> It's actually quite freeing, not complicating. I can put the values
> right into the fields I need them to be in (or get values from the
> database I need to control the Arduino), without going through a
> intermediate process. If you have a serial process I can look at that
> works with 1000 or more remote sensors all over the world to a hosted
> database server, I'd love to look at it. Right now what I have works,
> but I have no GIS functionality.

I'm not going to claim this is a great design, but it's at least an
order of magnitude easier than your proposal:

Set up the simplest web server that will run PHP. Program the Arduinos
to submit POST requests to it (which is just networking you say you can
already handle), by which they submit their SQL strings. Write a PHP
script that passes those to PostgreSQL.

The webserver should be able to handle at least as much as what you were
going to throw at the DB server, so there's no load problem.

Here is a workable solution to using Arduino with PostgreSQL - http://wildraspy.blogspot.co.uk/2014/01/the-pi-as-postgresql-database-server.html

If you are controlling lots of devices around the world, you should probably be clustering anyway.

Robin St.Clair

Re: Arduino SQL Connector

From
Steve Spence
Date:
Not a thing in that document about the Arduino. Just how to install Postgres on a Raspberry Pi. My Postgres is on a hosted server at a ISP.



Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Fri, Apr 18, 2014 at 10:04 AM, Robin <robinstc@live.co.uk> wrote:
I have bottom posted

On 18/04/2014 14:20, Steve Spence wrote:
And that is the way I used to do it, before the Arduino MySQL connector came out. It was nice not to have to go though the double stepping any more. Hence my interest in a Arduino PostgreSQL Connector. 

Here is how it works today. slim and clean - http://www.green-trust.org/lmanco/find.php

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Fri, Apr 18, 2014 at 8:15 AM, David Rysdam <drysdam@ll.mit.edu> wrote:
Steve Spence <greentrust@gmail.com> writes:
> It's actually quite freeing, not complicating. I can put the values
> right into the fields I need them to be in (or get values from the
> database I need to control the Arduino), without going through a
> intermediate process. If you have a serial process I can look at that
> works with 1000 or more remote sensors all over the world to a hosted
> database server, I'd love to look at it. Right now what I have works,
> but I have no GIS functionality.

I'm not going to claim this is a great design, but it's at least an
order of magnitude easier than your proposal:

Set up the simplest web server that will run PHP. Program the Arduinos
to submit POST requests to it (which is just networking you say you can
already handle), by which they submit their SQL strings. Write a PHP
script that passes those to PostgreSQL.

The webserver should be able to handle at least as much as what you were
going to throw at the DB server, so there's no load problem.

Here is a workable solution to using Arduino with PostgreSQL - http://wildraspy.blogspot.co.uk/2014/01/the-pi-as-postgresql-database-server.html

If you are controlling lots of devices around the world, you should probably be clustering anyway.

Robin St.Clair

Re: Arduino SQL Connector

From
Adrian Klaver
Date:
On 04/18/2014 06:20 AM, Steve Spence wrote:
> And that is the way I used to do it, before the Arduino MySQL connector
> came out. It was nice not to have to go though the double stepping any
> more. Hence my interest in a Arduino PostgreSQL Connector.

I think it is a interesting idea, unfortunately I do not have the
programming skills to make it happen. The primary issue to getting this
going is that the Postgres developers are already pushed to the limit on
keeping up with existing platforms. Adding a new one with such resource
constraints is not all that compelling. That being said I still believe
you could get something going via a cross community approach. In other
words post your idea on a relevant Arduino forum/list also. To make the
process smoother a written proposal/outline of what is desired would be
nice. As has been mentioned the MySQL connector you are using is a cut
down version of the full MySQL client, so what it offers could be a
starting point for what you would want in a Postgres client. To have a
home for this maybe set up a GitHub account to point people to and from
which developers could work.

>
> Here is how it works today. slim and clean -
> http://www.green-trust.org/lmanco/find.php
>
> Steve Spence, KK4HFJ
> Director, Green Trust
> http://www.green-trust.org
> Http://arduinotronics.blogspot.com



--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Arduino SQL Connector

From
Steve Spence
Date:
Thank you.

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Fri, Apr 18, 2014 at 10:35 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 04/18/2014 06:20 AM, Steve Spence wrote:
And that is the way I used to do it, before the Arduino MySQL connector
came out. It was nice not to have to go though the double stepping any
more. Hence my interest in a Arduino PostgreSQL Connector.

I think it is a interesting idea, unfortunately I do not have the programming skills to make it happen. The primary issue to getting this going is that the Postgres developers are already pushed to the limit on keeping up with existing platforms. Adding a new one with such resource constraints is not all that compelling. That being said I still believe you could get something going via a cross community approach. In other words post your idea on a relevant Arduino forum/list also. To make the process smoother a written proposal/outline of what is desired would be nice. As has been mentioned the MySQL connector you are using is a cut down version of the full MySQL client, so what it offers could be a starting point for what you would want in a Postgres client. To have a home for this maybe set up a GitHub account to point people to and from which developers could work.


Here is how it works today. slim and clean -
http://www.green-trust.org/lmanco/find.php

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org
Http://arduinotronics.blogspot.com



--
Adrian Klaver
adrian.klaver@aklaver.com

Re: Arduino SQL Connector

From
Jan Wieck
Date:
On 04/18/14 10:31, Steve Spence wrote:
> Not a thing in that document about the Arduino. Just how to install
> Postgres on a Raspberry Pi. My Postgres is on a hosted server at a ISP.

You intend to have thousands of Arduino devices, incapable of doing any
sort of encryption or other means of secure IP connections, directly
connect to a database, that is hosted on a publicly accessible VPS?

Maybe it is just me, but to me that design has DISASTER written in bold,
red, 120pt font all over it.


Good luck with that,
Jan

--
Jan Wieck
Senior Software Engineer
http://slony.info


Re: Arduino SQL Connector

From
Steve Spence
Date:
It's just temperature and humidity sensor data. Don't need secure connections. Why would I care? I'm doing it now with MySQL, and no disaster, and I'm having good luck with it. I think it's just you.

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Fri, Apr 18, 2014 at 10:53 AM, Jan Wieck <jan@wi3ck.info> wrote:
On 04/18/14 10:31, Steve Spence wrote:
Not a thing in that document about the Arduino. Just how to install
Postgres on a Raspberry Pi. My Postgres is on a hosted server at a ISP.

You intend to have thousands of Arduino devices, incapable of doing any sort of encryption or other means of secure IP connections, directly connect to a database, that is hosted on a publicly accessible VPS?

Maybe it is just me, but to me that design has DISASTER written in bold, red, 120pt font all over it.


Good luck with that,
Jan

--
Jan Wieck
Senior Software Engineer
http://slony.info

Re: Arduino SQL Connector

From
Adrian Klaver
Date:
On 04/18/2014 07:53 AM, Jan Wieck wrote:
> On 04/18/14 10:31, Steve Spence wrote:
>> Not a thing in that document about the Arduino. Just how to install
>> Postgres on a Raspberry Pi. My Postgres is on a hosted server at a ISP.
>
> You intend to have thousands of Arduino devices, incapable of doing any
> sort of encryption or other means of secure IP connections, directly
> connect to a database, that is hosted on a publicly accessible VPS?
>
> Maybe it is just me, but to me that design has DISASTER written in bold,
> red, 120pt font all over it.

Jan,

It is already established you do not like any part of this idea. Beating
the dead horse really does not accomplish anything.

>
>
> Good luck with that,
> Jan
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Arduino SQL Connector

From
Robin
Date:
Bottom posted

On 18/04/2014 15:31, Steve Spence wrote:
Not a thing in that document about the Arduino. Just how to install Postgres on a Raspberry Pi. My Postgres is on a hosted server at a ISP.



Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Fri, Apr 18, 2014 at 10:04 AM, Robin <robinstc@live.co.uk> wrote:
I have bottom posted

On 18/04/2014 14:20, Steve Spence wrote:
And that is the way I used to do it, before the Arduino MySQL connector came out. It was nice not to have to go though the double stepping any more. Hence my interest in a Arduino PostgreSQL Connector. 

Here is how it works today. slim and clean - http://www.green-trust.org/lmanco/find.php

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Fri, Apr 18, 2014 at 8:15 AM, David Rysdam <drysdam@ll.mit.edu> wrote:
Steve Spence <greentrust@gmail.com> writes:
> It's actually quite freeing, not complicating. I can put the values
> right into the fields I need them to be in (or get values from the
> database I need to control the Arduino), without going through a
> intermediate process. If you have a serial process I can look at that
> works with 1000 or more remote sensors all over the world to a hosted
> database server, I'd love to look at it. Right now what I have works,
> but I have no GIS functionality.

I'm not going to claim this is a great design, but it's at least an
order of magnitude easier than your proposal:

Set up the simplest web server that will run PHP. Program the Arduinos
to submit POST requests to it (which is just networking you say you can
already handle), by which they submit their SQL strings. Write a PHP
script that passes those to PostgreSQL.

The webserver should be able to handle at least as much as what you were
going to throw at the DB server, so there's no load problem.

Here is a workable solution to using Arduino with PostgreSQL - http://wildraspy.blogspot.co.uk/2014/01/the-pi-as-postgresql-database-server.html

If you are controlling lots of devices around the world, you should probably be clustering anyway.

Robin St.Clair

Whoops - I wasn't aware that I had to explain the relationship between Arduino and the Raspberry Pi - its pretty well exploited.

R+C

Re: Arduino SQL Connector

From
Edson Richter
Date:
Em 17/04/2014 09:00, Steve Spence escreveu:
> I'm using a MySQL library on my arduino that allows me to directly
> connect to a MySQL database and perform SQL queries on the Arduino.
>
> I need something similar for Postgres. Anyone have the knowledge and
> interest to work with me?
>
> Here is a sample of what I'm doing currently, and the results:
>
> http://arduinotronics.blogspot.com/2014/04/arduino-based-sql-queries.html
>
> http://green-trust.org/lmanco/find.php
>
>
> Steve Spence, KK4HFJ
> Director, Green Trust
> http://www.green-trust.org
> Http://arduinotronics.blogspot.com
>
>

Is Arduino capable of running Java apps?
If so, you can use the excellent high quality PgSQL JDBC driver.
Java interfacing with native libraries is not difficult, JNI are pretty
well know and documented (and long lived already).

Just my 2c (if you disregard, please just ignore me :-) ),

Edson Richter



Re: Arduino SQL Connector

From
"Tomas Vondra"
Date:
On 18 Duben 2014, 18:11, Edson Richter wrote:
> Is Arduino capable of running Java apps?
> If so, you can use the excellent high quality PgSQL JDBC driver.
> Java interfacing with native libraries is not difficult, JNI are pretty
> well know and documented (and long lived already).
>
> Just my 2c (if you disregard, please just ignore me :-) ),

Arduino is a tiny computer, with a just a few kBs of memory. That's hardly
sufficient for a Java environment (especially if even the libpq library is
considered too large).

regards
Tomas



Re: Arduino SQL Connector

From
Steve Atkins
Date:
On Apr 18, 2014, at 9:11 AM, Edson Richter <edsonrichter@hotmail.com> wrote:

> Em 17/04/2014 09:00, Steve Spence escreveu:
>> I'm using a MySQL library on my arduino that allows me to directly
>> connect to a MySQL database and perform SQL queries on the Arduino.
>>
>> I need something similar for Postgres. Anyone have the knowledge and
>> interest to work with me?
>>
>> Here is a sample of what I'm doing currently, and the results:
>>
>> http://arduinotronics.blogspot.com/2014/04/arduino-based-sql-queries.html
>>
>> http://green-trust.org/lmanco/find.php
>>
>>
>> Steve Spence, KK4HFJ
>> Director, Green Trust
>> http://www.green-trust.org
>> Http://arduinotronics.blogspot.com
>>
>>
>
> Is Arduino capable of running Java apps?

It's a microcontroller, with significantly less functionality than
my wristwatch. The big configurations have something like 8k
of RAM and a few hundred k or flash. The regular ones have
a couple of k of RAM and a few tens of k of flash.

There's no OS, just a single running application.

I'm pretty sure it'd be possible to implement a cut down version
of the PG protocol for it (though for the use case the original
poster mentioned it's a terribly idea, for system security reasons
as much as anything else). It'd be an interesting Saturday
afternoon project, at least.

But running virtual machines on it, or doing naive ports of
a full featured API isn't going to work - there's just not
enough space on the chip, for either code or storage.

Cheers,
  Steve



Re: Arduino SQL Connector

From
"Tomas Vondra"
Date:
On 18 Duben 2014, 17:01, Adrian Klaver wrote:
> On 04/18/2014 07:53 AM, Jan Wieck wrote:
>> On 04/18/14 10:31, Steve Spence wrote:
>>> Not a thing in that document about the Arduino. Just how to install
>>> Postgres on a Raspberry Pi. My Postgres is on a hosted server at a ISP.
>>
>> You intend to have thousands of Arduino devices, incapable of doing any
>> sort of encryption or other means of secure IP connections, directly
>> connect to a database, that is hosted on a publicly accessible VPS?
>>
>> Maybe it is just me, but to me that design has DISASTER written in bold,
>> red, 120pt font all over it.
>
> Jan,
>
> It is already established you do not like any part of this idea. Beating
> the dead horse really does not accomplish anything.

I don't think pointing out weaknesses of a proposed solution is equal to
beating a dead horse.

I see two potential issues here - security and excessive number of
connections. Security, because while you can reasonably authenticate the
client (e.g. using MD5 authentication), there's no way of encrypting the
traffic. But if the data is not sensitive, this might be sufficient.

Excessive number of connections, because if you keep one connection from
each arduino device, and you have 1000s of devices ... you get the idea.
But this might be resolved using pgbouncer + transaction pooling or so.

regards
Tomas



Re: Arduino SQL Connector

From
Steve Spence
Date:
32k of flash for the Arduino. A lot more than my old 4k TRS-80 Model 1.

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Fri, Apr 18, 2014 at 12:30 PM, Steve Atkins <steve@blighty.com> wrote:

On Apr 18, 2014, at 9:11 AM, Edson Richter <edsonrichter@hotmail.com> wrote:

> Em 17/04/2014 09:00, Steve Spence escreveu:
>> I'm using a MySQL library on my arduino that allows me to directly
>> connect to a MySQL database and perform SQL queries on the Arduino.
>>
>> I need something similar for Postgres. Anyone have the knowledge and
>> interest to work with me?
>>
>> Here is a sample of what I'm doing currently, and the results:
>>
>> http://arduinotronics.blogspot.com/2014/04/arduino-based-sql-queries.html
>>
>> http://green-trust.org/lmanco/find.php
>>
>>
>> Steve Spence, KK4HFJ
>> Director, Green Trust
>> http://www.green-trust.org
>> Http://arduinotronics.blogspot.com
>>
>>
>
> Is Arduino capable of running Java apps?

It's a microcontroller, with significantly less functionality than
my wristwatch. The big configurations have something like 8k
of RAM and a few hundred k or flash. The regular ones have
a couple of k of RAM and a few tens of k of flash.

There's no OS, just a single running application.

I'm pretty sure it'd be possible to implement a cut down version
of the PG protocol for it (though for the use case the original
poster mentioned it's a terribly idea, for system security reasons
as much as anything else). It'd be an interesting Saturday
afternoon project, at least.

But running virtual machines on it, or doing naive ports of
a full featured API isn't going to work - there's just not
enough space on the chip, for either code or storage.

Cheers,
  Steve



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: Arduino SQL Connector

From
Adrian Klaver
Date:
On 04/18/2014 09:39 AM, Tomas Vondra wrote:
> On 18 Duben 2014, 17:01, Adrian Klaver wrote:
>> On 04/18/2014 07:53 AM, Jan Wieck wrote:
>>> On 04/18/14 10:31, Steve Spence wrote:
>>>> Not a thing in that document about the Arduino. Just how to install
>>>> Postgres on a Raspberry Pi. My Postgres is on a hosted server at a ISP.
>>>
>>> You intend to have thousands of Arduino devices, incapable of doing any
>>> sort of encryption or other means of secure IP connections, directly
>>> connect to a database, that is hosted on a publicly accessible VPS?
>>>
>>> Maybe it is just me, but to me that design has DISASTER written in bold,
>>> red, 120pt font all over it.
>>
>> Jan,
>>
>> It is already established you do not like any part of this idea. Beating
>> the dead horse really does not accomplish anything.
>
> I don't think pointing out weaknesses of a proposed solution is equal to
> beating a dead horse.

Well the point is that the OP is already doing this with MySQL as the
backend. He just wants to move to Postgres if possible.

>
> I see two potential issues here - security and excessive number of
> connections. Security, because while you can reasonably authenticate the
> client (e.g. using MD5 authentication), there's no way of encrypting the
> traffic. But if the data is not sensitive, this might be sufficient.
>
> Excessive number of connections, because if you keep one connection from
> each arduino device, and you have 1000s of devices ... you get the idea.
> But this might be resolved using pgbouncer + transaction pooling or so.

Valid concerns whether MySQL or Postgres or some other data store is
used. Though as of now, from what I gather there are only 2 Arduinos
being polled:

http://arduinotronics.blogspot.com/2014/04/arduino-based-sql-queries.html

>
> regards
> Tomas
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Arduino SQL Connector

From
Edson Richter
Date:
Em 18/04/2014 13:30, Steve Atkins escreveu:
> On Apr 18, 2014, at 9:11 AM, Edson Richter <edsonrichter@hotmail.com> wrote:
>
>> Em 17/04/2014 09:00, Steve Spence escreveu:
>>> I'm using a MySQL library on my arduino that allows me to directly
>>> connect to a MySQL database and perform SQL queries on the Arduino.
>>>
>>> I need something similar for Postgres. Anyone have the knowledge and
>>> interest to work with me?
>>>
>>> Here is a sample of what I'm doing currently, and the results:
>>>
>>> http://arduinotronics.blogspot.com/2014/04/arduino-based-sql-queries.html
>>>
>>> http://green-trust.org/lmanco/find.php
>>>
>>>
>>> Steve Spence, KK4HFJ
>>> Director, Green Trust
>>> http://www.green-trust.org
>>> Http://arduinotronics.blogspot.com
>>>
>>>
>> Is Arduino capable of running Java apps?
> It's a microcontroller, with significantly less functionality than
> my wristwatch. The big configurations have something like 8k
> of RAM and a few hundred k or flash. The regular ones have
> a couple of k of RAM and a few tens of k of flash.
>
> There's no OS, just a single running application.
>
> I'm pretty sure it'd be possible to implement a cut down version
> of the PG protocol for it (though for the use case the original
> poster mentioned it's a terribly idea, for system security reasons
> as much as anything else). It'd be an interesting Saturday
> afternoon project, at least.
>
> But running virtual machines on it, or doing naive ports of
> a full featured API isn't going to work - there's just not
> enough space on the chip, for either code or storage.
>
> Cheers,
>    Steve
>
>
>
Ok, in that case (and based on my experience with old Z80 tiny devices I
used to program 30 years ago), the best solution that would fit with any
database (not only with PostgreSQL or MySQL, but also making possible to
run other devices than Arduino) is to send data over TCP using
streamlined protocol to a server app - much faster and capable of
handling thousands of devices, and a correctly streamlined protocol will
be hundreds of times faster than any database protocol (a specific piece
of code is always faster than a generic purpose one).

All other's arguments about security, pooling, stability, etc, would be
easily addressed using this combination of customized protocol + custom
receiver server: with a "plus" - you don't have to upgrade your devices
if you want to upgrade database libraries, change schema structure (very
common after a while: change schemas to increase performance or opmize
storage), or similar adjustments that would happen after your app is
running.

That's my 2c,

Edson.



Re: Arduino SQL Connector

From
vincent elschot
Date:
On 18-04-14 06:21, John R Pierce wrote:
> On 4/17/2014 9:09 PM, Steve Spence wrote:
>> You know what? Fine, it doesn't matter that much to me. I'm happy to
>> continue using MySQL. It works with the Arduino quite nicely. Postgres
>> doesn't work. That's Postgres loss not mine. I really thought the
>> postgres team would be interested in providing support for a very
>> popular microcontroller system. If not, they are missing out on a
>> larger segment of users.
>
> personal opinion:
>
> I don't think a terminal device like a PC or an embedded system should
> be talking directly to SQL at all.   instead, they should be talking
> to an application server which implements the "business logic", and
> THAT talks to the database

+1, especially if the sensors are located off-site, where sysadmins
have a tendency to close ports and filter protocols. HTTP gets through
pretty much any firewall without changes to the payload.
Also; using a native protocol means that the Arduino's must use the same
version
as the server, which means you need a way to upgrade them, all at the
same time.
Yikes.

Nope, I would dearly love to have a native PostgreSQL driver just to
prove it can be done,
but I don't think it is a particularly good idea to actually use in
production environments.


Re: Arduino SQL Connector

From
Steve Spence
Date:
The sensors are offsite, but those locations don't filter outbound 3306, so no issues there. Sha1 is being used, and hosting companies allow inbound 3306 from known or any ip, based on a table. Tried the connector against 3 different versions of MySQL, and was not version dependent, so pretty sure if the protocol does not change, a PostGRES version would not need to be version dependent either. It's now working flawlessly in a production environment, logging weather sensor data from a number of mobile locations.

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Mon, Apr 28, 2014 at 8:25 AM, vincent elschot <vinny@xs4all.nl> wrote:

On 18-04-14 06:21, John R Pierce wrote:
On 4/17/2014 9:09 PM, Steve Spence wrote:
You know what? Fine, it doesn't matter that much to me. I'm happy to
continue using MySQL. It works with the Arduino quite nicely. Postgres
doesn't work. That's Postgres loss not mine. I really thought the
postgres team would be interested in providing support for a very
popular microcontroller system. If not, they are missing out on a
larger segment of users.

personal opinion:

I don't think a terminal device like a PC or an embedded system should be talking directly to SQL at all.   instead, they should be talking to an application server which implements the "business logic", and THAT talks to the database

+1, especially if the sensors are located off-site, where sysadmins
have a tendency to close ports and filter protocols. HTTP gets through
pretty much any firewall without changes to the payload.
Also; using a native protocol means that the Arduino's must use the same version
as the server, which means you need a way to upgrade them, all at the same time.
Yikes.

Nope, I would dearly love to have a native PostgreSQL driver just to prove it can be done,
but I don't think it is a particularly good idea to actually use in production environments.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: Arduino SQL Connector

From
vincent elschot
Date:
Reply is at the bottom.

On 28-04-14 14:45, Steve Spence wrote:
The sensors are offsite, but those locations don't filter outbound 3306, so no issues there. Sha1 is being used, and hosting companies allow inbound 3306 from known or any ip, based on a table. Tried the connector against 3 different versions of MySQL, and was not version dependent, so pretty sure if the protocol does not change, a PostGRES version would not need to be version dependent either. It's now working flawlessly in a production environment, logging weather sensor data from a number of mobile locations.

Steve Spence, KK4HFJ
Director, Green Trust
http://www.green-trust.org


On Mon, Apr 28, 2014 at 8:25 AM, vincent elschot <vinny@xs4all.nl> wrote:

On 18-04-14 06:21, John R Pierce wrote:
On 4/17/2014 9:09 PM, Steve Spence wrote:
You know what? Fine, it doesn't matter that much to me. I'm happy to
continue using MySQL. It works with the Arduino quite nicely. Postgres
doesn't work. That's Postgres loss not mine. I really thought the
postgres team would be interested in providing support for a very
popular microcontroller system. If not, they are missing out on a
larger segment of users.

personal opinion:

I don't think a terminal device like a PC or an embedded system should be talking directly to SQL at all.   instead, they should be talking to an application server which implements the "business logic", and THAT talks to the database

+1, especially if the sensors are located off-site, where sysadmins
have a tendency to close ports and filter protocols. HTTP gets through
pretty much any firewall without changes to the payload.
Also; using a native protocol means that the Arduino's must use the same version
as the server, which means you need a way to upgrade them, all at the same time.
Yikes.

Nope, I would dearly love to have a native PostgreSQL driver just to prove it can be done,
but I don't think it is a particularly good idea to actually use in production environments.


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


I'm sure it works flawlessly when all requirements are met, but it's that list of requirements that worries me. Everything that can fail, will fail, sooner or later.

Anyway, you know your setup better than I, I just hope you are making the right choice for your environment.