SQL Server 2000General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
I have made a program which uses a database in SQL Server 2000 (SP3) via DSN from VB6 (Y2K SP4). When I run the program in VB everything is just fine but when I install the program on any other pc connection doesn't work any more. This happens even if it's me who is logged on the pc. There are several users including me who should be able to use the database in SQL Server. The users have usernames in database.
I use DSN and in code as following: strConn = "DSN=databasename;"... I tried to add TrustedConnection=yes to the end of the line but it doesn't seem to help.
Firstly I would advise agaianst connection via dsn, you must create them on every machine that uses the application. Try using a dsn-less connection, there are lots of examples at:
We have an interesting situation here at GOVT where many of our batch jobs use DSN's - and one thing this is saving us much work is that somebody in their great wisdom had decided we must change all our server names from mountain names, Rainier, Bachlor, Hood, etc - to forest names, Spruce, Pine, Alder, etc.
So we just have to change the DSN's and not worry about all the app's that use them.
_________________________
Joe Horton
Database Developer / Software Engineer
WISHA/Legal Services Software Development
Department of Labor and Industries
Voice (360) 902-5928 fax (360) 902-6200
You may need to explicitly name the server in the DSN. This is necessary if you exist in a multi-server environment. If you don't explicitly name the server, the DSN will pick the default server which may be different for each pc.
We also use a lot of DSN's. The most difficult thing is standardizing them. I have a short VB utility program which allows me to create standardized DSN's from an internal array. It's designed to hold 28 DSN's and will create them very quickly. If anyone is interested, contact me directly (rgerald@usbnc.org) and I will supply the source code.
quote:Originally posted by hortoristic
We have an interesting situation here at GOVT where many of our batch jobs use DSN's - and one thing this is saving us much work is that somebody in their great wisdom had decided we must change all our server names from mountain names, Rainier, Bachlor, Hood, etc - to forest names, Spruce, Pine, Alder, etc.
So we just have to change the DSN's and not worry about all the app's that use them.
_________________________
Joe Horton
Database Developer / Software Engineer
WISHA/Legal Services Software Development
Department of Labor and Industries
Voice (360) 902-5928 fax (360) 902-6200
i would use a Microsoft Data Link (.udl) file for the connection in such cases, since a file is easier to manage.
Thank you for your answers. Actually I am aware of most of what you have written. I was just wondering if the connection text is not correct: "dsn="name". Has anyone experiences of same kind of situation. As far as I know I've done everything as I am supposed to do and it still won't work.