I can't really tell. You just don't provide much information to work with.
Part of the problem is that you're using a DSN to connect, and that hides a lot of information. With just a DSN name, I don't know a thing about your data source configuration. I try to avoid using DSNs and instead spell out the details for each connection, but that's just a personal preference. If you're going to use a DSN to connect to SQL server, though, you need to know a few things. For example, what sort of DSN is it? I'd suggest using a System DSN if you have a choice. If it's a User DSN, then you have to make sure you set up the DSN for the account the web server runs in in exactly the same way as the DSN on your account.
Which ODBC driver does the DSN use? The SQL Native Client might be pretty good, but I've been using the SQL Server driver (v 2000.85.1132.00) for the past few years, and it works well connecting to SQL Server 2005. So just to debug your connection, I'd try using that one. Once you resolve your connection issues, you can then try moving to a different driver, if desired.
I use the DBI module with DBD::ODBC and other modules to access databases, so I have no experience with Win32::ODBC, so if it has any quirks, you'll either have to delve into the documentation, or perhaps someone else might mention them.
The next part of the problem is that you don't specify the way that it doesn't work. Error messages are sort of handy. Normally they tell you what the problem is. So if you don't tell us the exact text of the error message, we don't know where to start looking for problems. For all we know, you could be using a command line on one computer and the script running on another computer with a different configuration, etc.
...roboticusIn reply to Re^3: Data base connection error
by roboticus
in thread Data base connection error
by mhoang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |