Hi Mike..

The following is a section of a postauthhook that we are currently using.
This hook creates its own handle to connect to a database...I am not really
sure what database are you using but this works for MySQL. Well, you will
not have a problem for as long as the database that you are using is
supported by PERL's DBI.

You just have to make sure that you finish all sql statements using the
$sth->finish statement.. and you close your database
connection using $dbh->disconnect.


----
sub
{
my $p=${$_[0]};
my $username;
my $userpassword;
my
($NSD,$DUD,$cycle,$date,$datestamp,$host,$database,$user,$password,$dbh,$sql
,$sth,$rv,$table,$i,$j);
#Connect to MySQL database
$host="192.168.0.1";
$database="billing";
$user="mike";
$password="gladtohelp";
$dbh=DBI->connect("DBI:mysql:$database:$host",$user,$password);
$sql="select * from TABLE";
$sth=$dbh->prepare($sql);
$rv=$sth->execute;
$sth->finish;
....
...
my $rc;
$rc=$dbh->disconnect;
return;


-----END OF POST AUTH HOOK---

Hope this gives you an idea on how to go about what you want to do...=)

Egie
---
Edgar R Gutierrez
NOC- Network Services Manager
Impact Information Systems

----- Original Message -----
From: Hugh Irvine <[EMAIL PROTECTED]>
To: Mike Nerone <[EMAIL PROTECTED]>; Radiator List <[EMAIL PROTECTED]>
Sent: Friday, June 02, 2000 8:24 AM
Subject: Re: (RADIATOR) SQL access from within a hook


>
> Hello Mike -
>
> On Thu, 01 Jun 2000, Mike Nerone wrote:
> >
> > Hugh,
> >
> > In answer to another person's question, you mentioned doing SQL
> accesses from within a PostAuthHook. Can I use the database handle that my
> AuthBy clause already has open, or do I have to manage my own handle?
Either
> way, can you give me a line or two of code that shows an example of how I
would
> do it (it doesn't have to be a useful example...just give me
a ->prepare(), and
> a connect() if I have to manage my own).
> >
> > If I can use AuthBy's handle,
> then what happens if I try to do that in a PreClientHook, or a
PreAuthHook, or
> any other time when the handle has not been connected yet? Is there a way
I can
> call the AuthBy and make it connect? Like an autoconnect? If I do have to
> manage my own handle, can I at least make it persistent?
>
> I think the answer here is going to depend on what you are trying to do.
Could
> you describe your requirements in more detail please?
>
> thanks
>
> Hugh
>
> --
> Radiator: the most portable, flexible and configurable RADIUS server
> anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
> Platypus, Freeside, Interbiller, TACACS+, PAM, external, etc, etc.
> Available on Unix, Linux, FreeBSD, Windows 95/98/2000, NT, MacOS X.
>
>
>
> ===
> Archive at http://www.starport.net/~radiator/
> Announcements on [EMAIL PROTECTED]
> To unsubscribe, email '[EMAIL PROTECTED]' with
> 'unsubscribe radiator' in the body of the message.
>
>




---End of forwarded mail from [EMAIL PROTECTED]

-- 
Mike McCauley                               [EMAIL PROTECTED]
Open System Consultants Pty. Ltd            Unix, Perl, Motif, C++, WWW
24 Bateman St Hampton, VIC 3188 Australia   http://www.open.com.au
Phone +61 3 9598-0985                       Fax   +61 3 9598-0955

Radiator: the most portable, flexible and configurable RADIUS server 
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald, 
Platypus, Freeside, TACACS+, PAM, external, etc etc on Unix, Win95/8, 
2000, NT, MacOS X
===
Archive at http://www.starport.net/~radiator/
Announcements on [EMAIL PROTECTED]
To unsubscribe, email '[EMAIL PROTECTED]' with
'unsubscribe radiator' in the body of the message.

Reply via email to