Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: What is the difference between ADO and ODBC ?

by jehuni (Pilgrim)
on Oct 09, 2001 at 16:43 UTC ( [id://117713]=note: print w/replies, xml ) Need Help??


in reply to What is the difference between ADO and ODBC ?

ADO is basically a high-level OO interface to various low-level OLEDB data providers. ODBC is another kind of low-level data provider, and if there is no native OLEDB provider for the type of database you use, but there is an ODBC one, you can always use the OLEDB provider for ODBC to bridge that gap.

IMHO, ADO is a much more flexible option than dealing directly with a data provider like ODBC, unless you really have the need to some sort of low-level optimization. Plus, for an MS database technology like Access, using a native OLEDB provider should be faster.

Since you can't set up a DSN, I believe that something like this will work for you:

use strict; use Win32::OLE; my $provider = 'Microsoft.Jet.OLEDB.4.0'; my $dir = 'c:\perl\cgi-bin'; my $dbase = 'mydb.mdb'; my $user = ''; #use if needed my $password = ''; #use if needed my $connStr = "Provider=$provider;Data Source=$dir\\$dbase;User ID=$us +er;Password=$password;"; my $conn = Win32::OLE->new('ADODB.Connection') or die("Could not creat +e Connection: $!"); $conn->Open($connStr);

-jehuni

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://117713]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2025-03-15 20:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (53 votes). Check out past polls.