PDA

Click to See Complete Forum and Search --> : Win95 Issues with connecting to SQL Server


harjeen
Jun 22nd, 2000, 04:38 AM
I'm developing an ActiveX application to be run in a browser. When it loads, the app. connects to an SQL Server. The code works when the application is viewed in IE5.0 under Win98/NT, however, when I try to connect in Win95, I get error 80004005 (DSN not found or specified driver does not exist). Here is my code:

----------------------------------
Option Explicit
Private cntn As ADODB.Connection
Private Const DB_uid = "LDT_User"
Private Const DB_pwd = "LDT_User"
Private Const DB_driver = "SQL Server"

Public Function create(dbname As String, server As String) As Boolean
On Error GoTo Errhandler
Set cntn = New ADODB.Connection
cntn.ConnectionString = "uid=" & DB_uid & ";pwd=" & DB_pwd & ";server=" & server & ";driver=" & DB_driver & ";database=" & dbname
cntn.ConnectionTimeout = 30
cntn.open
cntn.BeginTrans
create = True
Exit Function
Errhandler:
create = False
End Function
-----------------------------------

Any idea what is going wrong?

Thanks in advance for your response,

Nahid Harjee

*NOTE: I realized that Win95 doesn't provide the SQL Server drivers, so I installed MDAC 2.1. Now the error message is no longer DSN not found...., it is: SQL Server not found.

[Edited by harjeen on 06-22-2000 at 06:19 PM]

JHausmann
Jun 22nd, 2000, 06:48 AM
The driver needs to be wrapped in braces; ie;

Private Const DB_driver = "{SQL Server}"

harjeen
Jun 23rd, 2000, 01:46 AM
Hmmm... that doesn't seem to work. I don't think it's a problem with the driver name specification, because the application works in Windows 98/NT.

I did a little more investigation of this problem, and there seems to be a difference in how 98/NT connect to the SQL server compared to how 95 does it. That is, in 98/NT, I can specify the SQL server by it's IP address, and it connects fine. However, when I attempt the same procedure in 95, I get the error:

[Microsoft][ODBC SQL Server Driver][Named Pipes]Specified SQL Server not found.

Yet, in 95, when I use the computer name instead of IP address, it DOES connect. This solution is not satisfactory for me though, because people will be connecting, via my app, from around the world to my SQL Server. They obviously will not be able to put in the server name, they have to use IP.

I'm quite confused about what the difference could be. Any ideas?

Nahid

JHausmann
Jun 23rd, 2000, 02:11 AM
Hmm, I have an application that uses ADO (now, I've just converted it from ODBC) that works fine under 98/NT [using a server name, not address. That runs counter to your experiences], I'll try it using 95 on Monday

Until then, are all your machines running the same version of MDAC?

What version of SQL server are you running, as well?

harjeen
Jun 23rd, 2000, 02:28 AM
Yep, all my machines are running the latest and "greatest" version of MDAC. My SQL Server is ver 7.0.

Thanks for all the help JHausmann. You're definitely the Database Master.

Clunietp
Jun 23rd, 2000, 11:34 PM
did you install DCOM 98 on your Win95 clients?

harjeen
Jun 25th, 2000, 09:29 PM
Clunietp,

Isn't DCOM98 just for Win98 machines? My Win95 clients all have DCOM95 and MDAC 2.5.

JHausmann
Jun 26th, 2000, 07:55 AM
You can install DCOM98 on Win95, I just did. MY application, however, doesn't work at all in Win95. I'm getting "No Such Interface Supported"...

Clunietp
Jun 26th, 2000, 11:31 AM
you are right Harjeen, my bad!

sorry

Clunietp
Jun 26th, 2000, 11:33 AM
why don't you just use a native OLEDB connection string?

"Provider=SQLOLEDB;Data Source=MyServer;UID=User;PWD=Password;Initial Catalog=Database"

harjeen
Jun 26th, 2000, 11:21 PM
You were almost there clunietp!

I changed my connection string to:

cntn.ConnectionString = "Provider=SQLOLEDB;Network Library=dbmssocn;uid=" & DB_uid & ";pwd=" & DB_pwd & ";server=" & server & ";database=" & dbname

and everything worked. The Network Library parameter specifies that the connection should be made via TCP/IP (dbmssocn is the TCP/IP library).

Thanks for everyone's help!

Nahid

Gil
Dec 27th, 2000, 09:21 AM
Ok, I hate to open an old post, but I'm having a problem using harjeen's solution. I am using VB 6.0 connecting to SQL Server 6.5 and trying to connect to the database server with remote computers over the internet using tcp/ip.

My connection string looks like this:
cntn.ConnectionString = "Provider=SQLOLEDB;Network Library=dbmssocn;uid=" & DB_uid & ";pwd=" & DB_pwd & ";server=" & server & ";database=" & dbname
cntn.Open

But when it tries to connect, I get a "General network error. Please see your network documentation". Anybody know why I would get this? Is sql server not configured properly?