Author |
Topic |
dev45
Yak Posting Veteran
54 Posts |
Posted - 2009-02-22 : 13:21:28
|
Hi, i am developing a vb.net (visual studio 2005) application using SQL 2005 as backend. I am using the following piece of code to locate the available instances of SQL : Dim dtServers As New DataTable dtServers = SmoApplication.EnumAvailableSqlServers(False)This code fetches the SQL Server that i have installed on my pc (let's say mySQLServer). There are also 2 textboxes in which i key in the login credentials (let's say : username = sa, password = sa). After that, a connection string is created :(the database name is fixed : myDB)connStr= "Provider=SQLOledb.1;Initial Catalog=myDB; UserId=sa;Password=sa;Data Source=mySQLServer"A connection is opened and everything works fine...where's the problem then ? It only works when i am running the client application in the same PC where the SQL resides. When i try to port it to another pc, it gives me and error : [DBNETLIB] [(ConnectionOpen connect()).] SQL does not exist or access is denied.The problem is that i am not at all into network stuff so basically dont know what to do. I am not even sure if the PCs are in a network (i think they are in a workgroup). The sure thing is that the code that locates the SQL Servers is working fine on all PCs because i can see the name of the PC running the SQL Server. I am open to any suggestion...:)Thanks ,theodoreps: SELECT SERVERPROPERTY('productversion') --> 9.0.3077.00 SELECT SERVERPROPERTY ('productlevel') --> SP2 SELECT SERVERPROPERTY ('edition') --> Developer Edition |
|
hey001us
Posting Yak Master
185 Posts |
Posted - 2009-02-22 : 15:24:24
|
try this. telnet <servername> <port no. default 1433> firewall issue if timeouthey |
|
|
dev45
Yak Posting Veteran
54 Posts |
Posted - 2009-02-23 : 07:11:27
|
Hi, thx for the help, i will try it out when back at home.In the meanwhile, yesterday night,i found out that i could connect using the IP and port instead of the server name so, if the connection string is : "Provider=SQLOledb.1;Initial Catalog=myDB; UserId=sa;Password=sa;Data Source=192.168.1.1,1433" it connects ok in remote mode. That means that the dns name (?) is not resolved ? Thx again |
|
|
hey001us
Posting Yak Master
185 Posts |
Posted - 2009-02-23 : 15:28:10
|
Go to C:\WINDOWS\system32\drivers\etc\host file and add your <IP address> and <host name>. then it will resolve the dns name.hey |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
hey001us
Posting Yak Master
185 Posts |
Posted - 2009-02-23 : 18:43:24
|
Yes we do use alias in SQL Server.We need to add into the host file if we don’t have SQL instance on the client PC or Application server.hey |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
hey001us
Posting Yak Master
185 Posts |
Posted - 2009-02-23 : 19:41:03
|
Sounds good, I never experienced that.can you explain me about regedit, under where to add?Thank youhey |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
hey001us
Posting Yak Master
185 Posts |
Posted - 2009-02-23 : 20:57:10
|
Cheershey |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|