Link to home
Start Free TrialLog in
Avatar of rajesh_khater
rajesh_khater

asked on

Problem accessing MSDE2000 database from VB program on Win98 machine

Hi,

I have a VB program that connects to a MSDE database using ADO.
The program uses ADO 2.8

This program works perfectly in Win XP.
But on Win 98, I get this error:

Runtime error '-2147467259 (80004005)':

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection"

I am sure there are no problems in the connection string, coz the same works in XP.

Please help.
Avatar of MikeWalsh
MikeWalsh
Flag of United States of America image

are you trying to use windows authentication? This may be the problem. Try using Mixed Mode authentication and change your string to pass a SQL Login with it's password. I don't believe you can use the WIndows Authentication coming from a 98 box.
Avatar of rajesh_khater
rajesh_khater

ASKER

I am passing the SQL login 'sa' and no password.
well according to the error message it sounds like you are not passing a username at all, and trying to use windows authentication which won't work.

Double check your connection string. It probably works on XP because the account you are using has permissions on the SQL box. In Windows 98 you can't use Windows authentication. You also should not have a null SA password, a lot of exploits can happen that way.
I am absolutely sure about the connection string.
Here it is:

"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=MyDatabase;Data Source=Machine1\Test"

Yes, the error message seems to be indicating that I am not passing the username, whereas it is not the case.
ASKER CERTIFIED SOLUTION
Avatar of MikeWalsh
MikeWalsh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So you will need to change the connection string. This works on the XP box because you are probably logged on to the domain and are authenticated. You are not connecting as SA there most likely but are actually connecting as the user you are logged on as.
http://www.governmentsecurity.org/articles/MicrosoftDatabaseSecurity.php

scroll down and read the paragraph describing integrated security.
no I dont have password for sa.

That is not a concern again. The database server is on a network with only 2 computers and not connected to internet.

How do I not use Integrated Security ?
Whats the connection string for that ?
I am not a programmer but I believe it is just this
Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=;"
just change what is native to your connection.

This site has a bunch of connection strings easy to get at:
http://www.connectionstrings.com/

Also yes SA password is a concern. It does not matter if it is attached to the internet. Security is security. The SA account shouldn't even be used. You should create a separate account for use. SA has the complete keys to the kingdom. If someone works at this client and wants to teachthemselves sql and they play around with the insecure SA account, they can potentially destroy the clients setup, corrupt databases and make your life miserable when you have to explain to the client why you lef the most important password on their server blank. Make a password and make your life easier in the long run. Being off the internet lowers some risk but there stills exists plenty of risk...
Thnx Mike.

You have been of great help. I will close most of these questions I have asked after a visit to the client's place if things work out.

I just posted one more question:

https://www.experts-exchange.com/questions/21797984/How-to-run-database-and-table-creation-script-programmatically.html
Thnx. Just removing "Integrated Security=SSPI" from the connection string worked.