Thanks growlf,
That is good to know. Out of curiosity, do you have to pass the username and password, or can you just run it with the UID/PWD set up in the DSN connection? I spent a while bashing my head against this, and if I do have the time to rewrite it, I'd like to do it right (or at least more right :).
Thanks again,
Ardenstone | [reply] |
I have done both DSN only (UID and PASSWD in a DSN) and "DSNless" with everything in the connection string. DBI also provides for sepparation of the connection string and the UID/PASSWORD - but i have had troubles using both at the same time.
Honestly, I think that DBI is a better way to go to begin with - it is more portable for one (and the clients are always changing platforms on me - so that is a plus for me at least!) and as I delve deeper into all the modules that use/support it (like my Fetchall-Answer concerning HTML::Template) I really like some of the things it simplifies becuase of that support from the other mods.
Update: I use ActiveState Perl heavily in my dev process, and so am tempted to use alot of the Win32 stuff, but every time that I do - it bites me in the butt. Either due to client changes in spec, or inability of the Win32 to work as well period. Hence the fondness of a more portable solution like DBI/DBD.
*G*
| [reply] |
Well, snot. So all this talk about DBI finally convinced me to give it a shot, and I've ended up right back at the same place I started. Here's what I've got right now:
use strict;
use DBI;
my $db = DBI->connect('DBI:ODBC:myDSN')
or die "Could not connect to database: " . DBI->errstr;
and I get squat. Actually, I get the same, "Login failed for user '(null)'" error as before. Now, if I do:
use strict;
use DBI;
my $db = DBI->connect('DBI:ODBC:myDSN','user','passwd')
or die "Could not connect to database: " . DBI->errstr;
It works just great. I can fetch data, the sun comes out, etc. So am I missing the blindingly obvious? Is it just not possible to save the Username and Password in the DSN?
I'm going to continue to scour the web for help, but so far every example I've seen hard codes the username and password.
Thanks again,
Ardenstone | [reply] [d/l] [select] |