Thread: Debian + PG + JDBC

Debian + PG + JDBC

From
"Jason C. Leach"
Date:
hi,

I'm looking to connect a Pg database to JDBC.  Right now I am running
Debian Linux 2.1r3 w/ JDK 1.2 and Postgres (not sure what V). If 
anyone can give me some tips on where to get the drives, or how to
get them that would be apreciated.

Thanks,
Jason.
-- 
Method Digital Logic Company                                                    
http://www.methodlogic.net     

Solutions for:                                                                  -Web Design            -Database
Programming                                  -Office Networking     -Custom Applications       
 


Re: Debian + PG + JDBC

From
Joseph Shraibman
Date:
they come with postgres, but they aren't the latest ones.  Peter Mount
has the lates ones on his home network somewhere.

"Jason C. Leach" wrote:

> hi,
>
> I'm looking to connect a Pg database to JDBC.  Right now I am running
> Debian Linux 2.1r3 w/ JDK 1.2 and Postgres (not sure what V). If
> anyone can give me some tips on where to get the drives, or how to
> get them that would be apreciated.
>
> Thanks,
> Jason.
> --
> Method Digital Logic Company
> http://www.methodlogic.net
>
> Solutions for:
>  -Web Design            -Database Programming
>  -Office Networking     -Custom Applications



RE: Debian + PG + JDBC

From
Peter Mount
Date:
Which I'm hoping to have on the central repository by this weekend.

I was hoping to use the two days leave last week to get it on, but ended
up spending them and the weekend getting my development system back
online (I think I have a duff motherboard), then the last two days
confined in bed. I am trying, but everything is stacking against me at
the moment :-(

Now to try to think on how to get out of going to a stupid M$ Exchange
seminar on Friday ;)

Peter

-- 
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council.



-----Original Message-----
From: Joseph Shraibman [mailto:jks@p1.selectacast.net]
Sent: Tuesday, April 04, 2000 6:36 PM
To: jleach@mail.ocis.net
Cc: pgsql-interfaces@postgresql.org
Subject: Re: [INTERFACES] Debian + PG + JDBC


they come with postgres, but they aren't the latest ones.  Peter Mount
has the lates ones on his home network somewhere.

"Jason C. Leach" wrote:

> hi,
>
> I'm looking to connect a Pg database to JDBC.  Right now I am running
> Debian Linux 2.1r3 w/ JDK 1.2 and Postgres (not sure what V). If
> anyone can give me some tips on where to get the drives, or how to
> get them that would be apreciated.
>
> Thanks,
> Jason.
> --
> Method Digital Logic Company
> http://www.methodlogic.net
>
> Solutions for:
>  -Web Design            -Database Programming
>  -Office Networking     -Custom Applications


Re: Debian + PG + JDBC

From
Thomas Lockhart
Date:
> Which I'm hoping to have on the central repository by this weekend.

That will be great, and fits with the release schedule (still somewhat
unspecified, but certainly not in the next few days).
                   - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


Re: Debian + PG + JDBC

From
Joseph Shraibman
Date:
Thomas Lockhart wrote:

> > Which I'm hoping to have on the central repository by this weekend.
>
> That will be great, and fits with the release schedule (still somewhat
> unspecified, but certainly not in the next few days).
>

That's the release schedule for 7.0.  We're still waiting for the latest
6.5.x drivers.




Re: Debian + PG + JDBC

From
Thomas Lockhart
Date:
> That's the release schedule for 7.0.  We're still waiting for the latest
> 6.5.x drivers.

*shrug* The latest 6.5.x drivers are the ones that are posted. If you
get them with 7.0, enjoy ;)
                   - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


Re: Debian + PG + JDBC

From
Peter Mount
Date:
On Wed, 5 Apr 2000, Joseph Shraibman wrote:

> Thomas Lockhart wrote:
> 
> > > Which I'm hoping to have on the central repository by this weekend.
> >
> > That will be great, and fits with the release schedule (still somewhat
> > unspecified, but certainly not in the next few days).
> >
> 
> That's the release schedule for 7.0.  We're still waiting for the latest
> 6.5.x drivers.

They will still be in there. This is because the base package is
different. ie:

The Class.forName() line changes:

6.x.x:    postgresql.Driver
7.x.x:    org.postgresql.Driver

So the source for the 6.5.3 and 7.0 drivers are actually in different
directories.

Peter

--      Peter T Mount peter@retep.org.uk     Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgresJava PDF Generator: http://www.retep.org.uk/pdf



a trigger that sends an email

From
"Oscar Serrano"
Date:
Hi:

I need to do something special.
I need that when a new record is inserted in one of my tables, the system
sends an email.
I thing I need to create a trigger. And I thing I need to create a function
that sends an email.
Is it possible?
May I do the function that sends the email in Perl?

Any idea?

Thank you very much.




Re: a trigger that sends an email + returning multiple records

From
"Moray McConnachie"
Date:
7.0 provides support for calling Perl functions, although I haven't had time
to experiment with it. In beta4 (not sure about earlier betas), it can be
found in the src/interfaces/perl5 directory, with examples in the eg
subdirectory beneath that...
Looks pretty good, although I guess it still can't return multiple records.

Incidentally, I've just thought of a work around for not being able to
return multiple records, although I'm not sure how exactly it would work.
Could one have a function that would create a table with (e.g.) a random
time-based name, fill it with the desired records, and return the name of
the table as the result of the argument?

Could one do for example, something like

SELECT searchid FROM searchfunction('criteria1','criteria2','criteria3')

or is that going to be rejected because you can't have functions returning
tablenames?

Haven't got time to look at any of this :-<
Yours,
Moray
----------------------------------------------------------------
Moray.McConnachie@computing-services.oxford.ac.uk
----- Original Message -----
From: "Oscar Serrano" <oserra@fondos.net>
To: "pgsql-interfaces@postgreSQL.org" <pgsql-interfaces@postgresql.org>
Sent: Thursday, April 06, 2000 9:50 AM
Subject: [INTERFACES] a trigger that sends an email


> Hi:
>
> I need to do something special.
> I need that when a new record is inserted in one of my tables, the system
> sends an email.
> I thing I need to create a trigger. And I thing I need to create a
function
> that sends an email.
> Is it possible?
> May I do the function that sends the email in Perl?
>
> Any idea?
>
> Thank you very much.
>
>
>



RE: a trigger that sends an email + returning multiple records

From
"Oscar Serrano"
Date:

> -----Mensaje original-----
> De: Moray McConnachie
> [mailto:moray.mcconnachie@computing-services.oxford.ac.uk]
> Enviado el: jueves, 06 de abril de 2000 13:09
> Para: Oscar Serrano; pgsql-interfaces@postgreSQL.org
> Asunto: Re: [INTERFACES] a trigger that sends an email + returning
> multiple records
>
>
> 7.0 provides support for calling Perl functions, although I
> haven't had time
> to experiment with it. In beta4 (not sure about earlier betas), it can be
> found in the src/interfaces/perl5 directory, with examples in the eg
> subdirectory beneath that...
> Looks pretty good, although I guess it still can't return
> multiple records.

This sounds really interesting. I will have to try it.

But I don't really undertand the rest of the email. I do not need
a function that returns any record. It just must open the sendmail and
send an email. And it must be done each time a record is inserted on
a table.

> Incidentally, I've just thought of a work around for not being able to
> return multiple records, although I'm not sure how exactly it would work.
> Could one have a function that would create a table with (e.g.) a random
> time-based name, fill it with the desired records, and return the name of
> the table as the result of the argument?
>
> Could one do for example, something like
>
> SELECT searchid FROM searchfunction('criteria1','criteria2','criteria3')
>
> or is that going to be rejected because you can't have functions returning
> tablenames?
>
> Haven't got time to look at any of this :-<
> Yours,
> Moray
> ----------------------------------------------------------------
> Moray.McConnachie@computing-services.oxford.ac.uk
> ----- Original Message -----
> From: "Oscar Serrano" <oserra@fondos.net>
> To: "pgsql-interfaces@postgreSQL.org" <pgsql-interfaces@postgresql.org>
> Sent: Thursday, April 06, 2000 9:50 AM
> Subject: [INTERFACES] a trigger that sends an email
>
>
> > Hi:
> >
> > I need to do something special.
> > I need that when a new record is inserted in one of my tables,
> the system
> > sends an email.
> > I thing I need to create a trigger. And I thing I need to create a
> function
> > that sends an email.
> > Is it possible?
> > May I do the function that sends the email in Perl?
> >
> > Any idea?
> >
> > Thank you very much.
> >
> >
> >



Re: a trigger that sends an email + returning multiple records

From
"Moray McConnachie"
Date:
----- Original Message -----
From: "Oscar Serrano" <oserra@fondos.net>
To: "Moray McConnachie" <moray.mcconnachie@computing-services.oxford.ac.uk>;
"pgsql-interfaces@postgreSQL.org" <pgsql-interfaces@postgresql.org>
Sent: Thursday, April 06, 2000 12:23 PM
Subject: RE: [INTERFACES] a trigger that sends an email + returning multiple
records



> This sounds really interesting. I will have to try it.
>
> But I don't really undertand the rest of the email. I do not need
> a function that returns any record. It just must open the sendmail and
> send an email. And it must be done each time a record is inserted on
> a table.

Sorry, the rest of the email was off-topic, but related to other discussions
that people have been having on the pgsql lists in the recent past.

"Incidentally" tends to imply that.

Yours,
Moray
----------------------------------------------------------------
Moray.McConnachie@computing-services.oxford.ac.uk



Re: a trigger that sends an email

From
Tom Lane
Date:
"Oscar Serrano" <oserra@fondos.net> writes:
>>>> I thing I need to create a trigger. And I thing I need to create a
>>>> function that sends an email.
>>>> Is it possible?
>>>> May I do the function that sends the email in Perl?

I don't think you can do this directly from a trigger, unless you want
to add the mail-sending function as a C extension to the backend.
You'll run into security restrictions.  All of the higher-level trigger
programming languages we offer are "trusted", which means you can't do
anything that would affect files or programs outside the database.
Sending email is right out.

Of course there's nothing wrong with a C-coded function; the system's
full of them ;-).  But you might want to think about other ways.

One possibility is to set up an always-running application that connects
to the database and then just sits there waiting for records to be added
to the table, then sends the email when that happens.  You could use a
NOTIFY command (executed by a trigger on the table) to wake up the app
when something happens, so that it doesn't need to take up CPU time
checking the table unnecessarily.
        regards, tom lane


Re: a trigger that sends an email + returning multiple records

From
Richard
Date:
Moray McConnachie wrote:
[snip]
> > But I don't really undertand the rest of the email. I do not need
> > a function that returns any record. It just must open the sendmail and
> > send an email. And it must be done each time a record is inserted on
> > a table.
> 
> Sorry, the rest of the email was off-topic, but related to other discussions
> that people have been having on the pgsql lists in the recent past.
> 
> "Incidentally" tends to imply that.
> 
> Yours,
> Moray
> ----------------------------------------------------------------
> Moray.McConnachie@computing-services.oxford.ac.uk

I've just had a little chin-wag with Mr. Webster, and we both have come
to the conclusion that "incidentally" does not in fact imply "off
topic".  We believe it means something more along the lines of
"subordinate" or "non-essential" to the topic under discussion. 
Incidentally, Mr. Merriam is vacationing in the Bahamas and could not be
reached for comment.  ;)

Cheers,
Richard


Re: a trigger that sends an email

From
"Moray McConnachie"
Date:
----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Oscar Serrano" <oserra@fondos.net>
Cc: "pgsql-interfaces@postgreSQL.org" <pgsql-interfaces@postgresql.org>
Sent: Thursday, April 06, 2000 3:51 PM
Subject: Re: [INTERFACES] a trigger that sends an email


> "Oscar Serrano" <oserra@fondos.net> writes:
> >>>> I thing I need to create a trigger. And I thing I need to create a
> >>>> function that sends an email.
> >>>> Is it possible?
> >>>> May I do the function that sends the email in Perl?
>
> I don't think you can do this directly from a trigger, unless you want
> to add the mail-sending function as a C extension to the backend.
> You'll run into security restrictions.  All of the higher-level trigger
> programming languages we offer are "trusted", which means you can't do
> anything that would affect files or programs outside the database.
> Sending email is right out.

Could one do a rule that used a dummy function, where the function called
the Perl routine which generates the email?

CREATE RULE emailer AS ON INSERT TO new_accounts   DO SELECT new_account_email_function(NEW.emailaddress);

or something like that? Or is this subject to the same restrictions?

M.



Re: a trigger that sends an email

From
Tom Lane
Date:
"Moray McConnachie" <moray.mcconnachie@computing-services.oxford.ac.uk> writes:
>> programming languages we offer are "trusted", which means you can't do
>> anything that would affect files or programs outside the database.
>> Sending email is right out.

> Could one do a rule that used a dummy function, where the function called
> the Perl routine which generates the email?

If it's in plperl then it's going to be running in a "safe" interpreter,
which should mean that you won't be able to do anything to send mail.

> CREATE RULE emailer AS ON INSERT TO new_accounts
>     DO SELECT new_account_email_function(NEW.emailaddress);

> or something like that? Or is this subject to the same restrictions?

Wouldn't be much of a security system if it were that easy to get
around, would it?

The problem here is that anything done by the backend is done with the
full permissions of user postgres (or whatever the backend is running
as).  So we don't want ordinary users to have access to programming
languages that will allow them to muck around with postgres' files.
The only way to escape the restrictions is to write a C-language
extension.  That has to be installed by the database admin, and we
expect him to exercise some caution in what he will install...
        regards, tom lane


Re: a trigger that sends an email

From
Craig Orsinger
Date:
On 06-Apr-00 Tom Lane wrote:
> "Oscar Serrano" <oserra@fondos.net> writes:
       [snip]

> One possibility is to set up an always-running application that connects
> to the database and then just sits there waiting for records to be added
> to the table, then sends the email when that happens.  You could use a
> NOTIFY command (executed by a trigger on the table) to wake up the app
> when something happens, so that it doesn't need to take up CPU time
> checking the table unnecessarily.
>        Seems like if you really want e-mail, a separate program
that waits for a NOTIFY event and then sends e-mail might be the
best answer. I may be off-base here, but it seems best to keep
functions that are run by the database as light and simple as
possible. Sending e-mail, using C or any other method, is a pretty
complex action. A separate program could be written in Perl, C,
C++, or TCL, or any other language that has PostgreSQL bindings
or libraries.

----------------------------------
Date: 06-Apr-00  Time: 10:50:16

Craig Orsinger                  (email: <orsingerc@epg-gw1.lewis.army.mil>)
Logicon RDA
Bldg. 8B28                      "Just another megalomaniac with ideas above his
6th & F Streets                 station. The Universe is full of them."
Ft. Lewis, WA   98433                   - The Doctor
----------------------------------