in reply to MSSQL/Perl
I think at least part of the problem is the connection string you are using. Use 'UID' for 'USER' and 'PWD' for 'PASSWORD'
my $db = DBI->connect("DBI:ODBC:driver={SQL Server};server=dbServer01;database=testdb;uid=bilfurd;pwd=testPassword;")
I will e-mail this, as well
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: MSSQL/Perl
by Anonymous Monk on Jul 02, 2003 at 22:06 UTC | |
| [reply] [d/l] |
by rnahi (Curate) on Jul 02, 2003 at 22:38 UTC | |
This code can't compile. You are missing a semicolon after use DBD::ODBC and after my $sql ... and some variables don't match with their declaration ($user $userid, $connect_string $conn_string). You didn't declare $sth and $count. Moreover, you are assigning the result of fetchrow_hashref to an array. You should read Reading from a database to get started with the DBI, and maybe some of the more basic Tutorials to use the language more proficiently. And, please, use CODE tags when you post your code. Update Here is your code a little bit better formatted. I won't guarantee that it does what you want, but at least it compiles without errors.
I changed your code to use fetchrow_array instead of fetchrow_hashref. You really need to read some docs. The DBI documentation (perldoc DBI) will give you good references on how to use things. The tutorial I have mentioned above is a good start. It is true that it uses MySQL, but using DBI, the only thing that is (in principle) different is only the connection statement. After that, the methods are the same. Good luck. | [reply] [d/l] [select] |
by Anonymous Monk on Jul 02, 2003 at 23:23 UTC | |
The errors in the code, when corrected only made for more errors when it was run. And the code reference that you politely pointed out to me is all well and good if I were using mySQL but I'm not. I am using MS SQL2000, OS is Win2000, and IIS 5. I have been going around in circles with no luck connecting to SQL2000. Thanks again and any futher help will be appretiated. | [reply] |
by Ionizor (Pilgrim) on Jul 03, 2003 at 00:06 UTC | |
by AcidHawk (Vicar) on Jul 02, 2003 at 23:53 UTC | |
There are a few things I found difficult with your code. | [reply] [d/l] [select] |
by mje (Curate) on Sep 30, 2013 at 08:57 UTC | |
Apart from all the other things people have told you about this script:
| [reply] [d/l] |