You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by "mnobrebr <marcos.otc@onix.com.br>" <ma...@onix.com.br> on 2003/01/28 02:15:27 UTC

DBI / DBD(xy) are already installed, and NOW ?!?

Ok Csongor Fagyal, you're right !
For now I have DBD::mysql and DBD::Pg installed.

Viewing the man pages, it seems to me that the instructions concerns
to purely Perl or I am wrong ?

Where (site or tutorial) do I can find some sample code of Apache::ASP
with Perl (embeded or somewhat) working with DBI/DBD ?

Thanks In Advance.

Marcos Nobre.


> I would rather recommend to use the Perl way, like this:
> perl -MCPAN -e shell
> and then
> install DBI
> and also
> install DBD::mysql    <- or whatever DBD you need
> 
> I think rpm -qa will not give you the right thing if you did not use an 
> RPM install previously.
> 
> Also if you have a DBD driver, you probably have the mans, too. Just 
> type man DBD::drivername and if you get something, you have that
driver :-)
> 
> - Cs.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@p...
> For additional commands, e-mail: asp-help@p...


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: DBI / DBD(xy) are already installed, and NOW ?!?

Posted by Csongor Fagyal <co...@conceptonline.hu>.
mnobrebr wrote:

>Ok Csongor Fagyal, you're right !
>For now I have DBD::mysql and DBD::Pg installed.
>
>Viewing the man pages, it seems to me that the instructions concerns
>to purely Perl or I am wrong ?
>
>Where (site or tutorial) do I can find some sample code of Apache::ASP
>with Perl (embeded or somewhat) working with DBI/DBD ?
>
>Thanks In Advance.
>
>Marcos Nobre.
>  
>
Well...

You just use ASP and mix it with whatever Perl functionality you like.
But let me write an example for you...

x.asp :

<%
# Connect
my $dbh = DBI->connect("DBI:mysql:database=test;host=host:port", 'user', 
'pass');

# Check error (or use eval + RaiseError)
if ($dbh->errstr) {
    $Response->AppendToLog($dbh->errstr);
    $Response->End;
}

# Fecth something from DB
my ($value) = $dbh->selectrow_array('SELECT field FROM table LIMIT 0,1', 
undef);

# You should have something in $value now
%>

<html>
<body>
Here is the result of your query: <%= $value %>
</body>
</html>


Got the point?

- Cs.


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: DBI / DBD(xy) are already installed, and NOW ?!?

Posted by Josh Chamas <jo...@chamas.com>.
mnobrebr  wrote:
> Ok Csongor Fagyal, you're right !
> For now I have DBD::mysql and DBD::Pg installed.
> 
> Viewing the man pages, it seems to me that the instructions concerns
> to purely Perl or I am wrong ?
> 

Apache::ASP allows pure perl to be embedded with <% # perl code %>
so any code you see about perl can be run simply by enclosing it
in the <% %> brackets.

Regards,

Josh
_________________________________________________
Josh Chamas, Founder                   phone:925-552-0128
Chamas Enterprises Inc.                http://www.chamas.com
NodeWorks Link Checking                http://www.nodeworks.com


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org