You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by José Augusto dos Santos Neto <ne...@microhosting.com.br> on 2002/05/14 20:51:23 UTC

Data Base

Hello,

My Apache:Asp is working fine. But i need to know,is can i Microsoft Access
(mdb) database like in w2k, without configure odbc ou something like, just
setting my conection file.

I nedd help, tks,

José Augusto dos Santos Neto
Microhosting Telecomunicações
Linux User #253575


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


Re: Apache::ASP DBI question

Posted by Ellers <el...@iinet.net.au>.
> I'm relatively new to the ASP model, but I like what I've seen so far.
> My question is regarding connection to a DB. Where in the ASP
> file/model does the connect string go? Wouldn't putting it in the asp
> file make it visible to the client with view source? Or am I missing
> something?

The perl code is processed on the server side. A client only ever receives HTML code or more correctly the _output_ of any perl code in 
your file.

So if this is your real source file:

[demo.asp]
<html>
<p>Hello from HTML.
<% print "<p>Hello from Perl"; %>
</html>

The server will process this (i.e. Apache, mod_perl and Apache::ASP), and produce this HTML:

<html>
<p>Hello from HTML.
<p>Hello from Perl
</html>

Much more interesting stuff is possible with this framework, like:

<p>Count from 1 to 10:
<? for ( $i = 1; $i <= 10; $i++ ) { %>
<p>This is <%= $i %>
<% } %>

Which will produce 
<p>Count from 1 to 10:
<p>This is 1
<p>This is 2
<p>This is 3
<p>This is 4
(etc)


So thats Apache::ASP 101 but to answer your question about database passwords, you _can_ put them in the actual .asp files but I 
wouldn't personally recommend it as good practice. 

A better solution is to put any database stuff in the global.asa file. You'll find doco on that on the Apache::ASP site but in a nutshell it is 
where you put reusable "global" functions for your asp pages. So I have something like:

sub getDatabaseConnection
{
	return $theDatabase if ( defined( $globalDBH ));
	$theDatabase = <connect to database here...>
	return $theDatabase;
}


Even better is to setup the database to be authenticated some other way. With mysql you can use the .my.cnf (is that the right filename?) 
etc.

HTH
Ellers




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


Re: Data Base

Posted by "Thomas A. Lowery" <tl...@stlowery.net>.
On Tue, May 14, 2002 at 09:05:33PM +0200, Sven Köhler wrote:
> Perl or DBI has DBD::ADO - i can find docs on the internet, but my 
> ActivePerl doesn't seem to support it anymore! don't ask be why...

DBD::ADO is no longer bundled with DBI. We need to ask ActiveState to
include it in the PPMs. It's a pure perl module, so if you need to
install it and don't have nmake, simple copy the lib/DBD/ADO.pm file
to perl/site_... directory. DBD::ADO does NOT work on Linux, it's
Win32 only.

> In MS-ASP you're using ADO. DBD::ADO should take the same 
> connection-strings - so DSN-less access to an AccessDB should be possible

Tom


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


Re: Data Base

Posted by Sven Köhler <sk...@upb.de>.
i guess you have installed Apache under MS-Windows. Otherwise accessing 
an Access-DB in impossible.

Perl or DBI has DBD::ADO - i can find docs on the internet, but my 
ActivePerl doesn't seem to support it anymore! don't ask be why...

In MS-ASP you're using ADO. DBD::ADO should take the same 
connection-strings - so DSN-less access to an AccessDB should be possible

José Augusto dos Santos Neto wrote:
> Hello,
> 
> My Apache:Asp is working fine. But i need to know,is can i Microsoft Access
> (mdb) database like in w2k, without configure odbc ou something like, just
> setting my conection file.
> 
> I nedd help, tks,
> 
> José Augusto dos Santos Neto
> Microhosting Telecomunicações
> Linux User #253575
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
> For additional commands, e-mail: asp-help@perl.apache.org
> 



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