 |
|
 |
To find SQL-2005 and SQL-2008-servers one needs to use another driver specification. Later versions will find earlier versions.
SQL2008: Driver={SQL Server Native Client 10.0} SQL2005: Driver={SQL Native Client} -SQL2000: Driver={SQL Server}
NB. SQL2005 will find SQL2008-servers.
To find your drivers - HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Enumerate instances:
DataTable table = SqlClientFactory.Instance.CreateDataSourceEnumerator().GetDataSources();
Dump into XML:
table.WriteXml("sql-servers.xml");
Vasek
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
...but it would be interesting to for e.g. get all SPs from browsed databases and so on. Do you know how to get that?
_____________________________
...and justice for all
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, I would like to use some of your code from the SQLInfoEnumerator class, and am wondering what license you release this code under. I will be releasing it as an open source software, nothing commercial.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
feel free to use the code ( a mention of me would be nice ) anyway you wish but it is provided as is with no warranties/guarantees etc
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
this article helped me much ,great work, but it didnt returns existing databases in sqlservers,.
I am using windwows sever 2003, full permissions. also enable the Tcp/IP and piped connections.
Pls help.
kssk
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Thanks a lot for your great code. It's now used in a Open Source Microcredit software (www.octopusnetwork.org). This software is currently used in Afghanistan! (kabul, mazar, maymana and charikar)
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Dear fellows, Hi!
I am facing a problem in creating ODBC for SQL Server 2000. the scenerio is as: I have a SQL Server named DBServer (Machine Name=DBServer and SQL Instance Name=DBServer as well). I installed another instance name DBServer2 on same machine. Now the problem is, I made a Database named Accounts1 in second instance named DBServer2. In odbc creation I can see server as DBServer\DBServer2 and dtabase nameAccounts1 but on connectivity I receive error message
"General network error, please contact your network administrator."
on sql-server machine the odbc is created without error but on the other machines that dont have sqlserver raise the said error. I am unable to fine the solution. If some one know the solution or place where I am making mistake then please email me the solution at sirkaleem@hotmail.com or sirkaleem@yahoo.com.
Thanks,
Take Care,
-- Ch. Kaleem Ahmad --
Love For All Hate For None
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
Hi Murray Great arcticle. I have one doubt about fetching the list of running msde instances through c#. I have 3 instances of MSDE installed on my machine say for example MACHINE11\DBSTORAGE1 MACHINE11\DBSTORAGE2 MACHINE11\DBSTORAGE3
Now through c# using SMO or SQL DMO when I retreive the list of sql server instances, I get only the default instance. How can I get the list of named instances like above. Can you pls help me with this.
Rajesh
|
| Sign In·View Thread·PermaLink | 1.50/5 (2 votes) |
|
|
|
 |
|
 |
I have two instances installed on my computer (Win XP), one is "machinename\TEST1", and another is "machinename\TEST2". These instances are sometimes enumerated and sometimes not. Is there anybody who knows the reason?
Thanks.
Wenxiang Tao
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
 |
The code will return no instance of the server, i.e. it would display SERVER2000 instead of SERVER2002/Production. Furthuremore, it would also display (local) for the local SQL server, while the local SQL server has a full name, so trying to use (local) in a SQL connection string would not even work. Any thoughts on that?
Thanks.
Sarajevo, Bosnia
|
| Sign In·View Thread·PermaLink | 3.00/5 (2 votes) |
|
|
|
 |
|
 |
if you need (local) replaced by the name of the computer, then just replace it.
(local) works in SQL connection strings. In ADO for sure, I use it all the time. ODBC think so too.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Greatest article on enumerating sql servers i've read!!! Read many other's how-tos, but NONE was functioning for me for various reasons... MANY THANKS!!!
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
 |
Can you use the same procedure used with SQLBrowseConnect for other databases, such as Oracle? Thanks
Himmett
|
| Sign In·View Thread·PermaLink | 1.33/5 (6 votes) |
|
|
|
 |
|
|
 |
|
 |
Hi, I had the same problem. It's really simple to solve:
first you have to add the 'System.ServiceProcess' link to your project. Than you can use ServiceController[] services = ServiceController.GetServices(); and search the services for service.ServiceName == 'MSSQLSERVER'
If you have ound it, you can use Start(), Stop() ... (look at the help files for 'ServiceController' to see the possibilities)
that's it.
I'm not sure how the SqlServer service is named, when there are running multiple instances, but that should possible to find out.
Have a good work
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi Eamonn, Thanks for a terrific sample. I am trying to use your sample in my open source project. It works great and I've run into a couple of details. If I wanted to allow my users to use "Trusted Connection" (i.e. no username and password) how would I go about this. Also, if the username / password are incorrect the database list shows the available sql servers??? How can this be modified to simply raise an invalid login messagebox? You've done some great work here and I really do appreciate it.  Take care, Chris
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
I will look at the Trusted Connection and raising a messagebox if the username/password are incorrect give me a few days
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
Hi Eamonn, Thank you so much for your reply. I have used your code and it is working great. I worked around the logon issue and trusted connection part by handling those parts outside of the SqlInfoEnumerator.cs class. I use the servername and userid/password (or trusted) and attempt to logon onto the Master database. I retrieve the databases from the Master database with the select stmnt:SELECT CATALOG_NAME FROM INFORMATION_SCHEMA.SCHEMATA.
It would be a more elegant solution to handle these within the SqlInfoEnumerator class. I am not as familiar with SQLBrowseConnect calls as you are. I have some ideas, but, I am not sure how to implement them: 1) for trusted connections, I think we could omit the Uid and Pwd and substitute Driver={SQL Server};Server=;Database=;Trusted_Connection=yes; 2) when you call SQLBrowseConnect to get databases and you only get list of servers you could force outConnection to be null. The trick is knowing that you're only looking for databases and not servers. 3) In MSDN under SQLBrowseConnect there is a function called SQLGetDiagRec that returns SQLSTATE values. This might be useful for determining invalid logins.
I hope this is helpful. Your code has been very instrumental in my open source project.
Chris
|
| Sign In·View Thread·PermaLink | 3.50/5 (2 votes) |
|
|
|
 |