I am trying to make a connection to a SQL Server database with SdeWorkspaceFactory. This is from my Windows 7 x64 Desktop to a Network database.
If I use this:
SDEWorkspace = NewObj(esriDataSourcesGDB.SdeWorkspaceFactory, esriGeodatabase.IWorkspaceFactory2) connectionString = "server=SQLServer;" + \ "instance=hbffcacqsql01;" + \ "database=ACQ_HBED_PROD;" + \ "authentication_mode=OSA" result = SDEWorkspace.OpenFromString(connectionString, 0)
connectionProperties = NewObj(esriSystem.PropertySet, esriSystem.IPropertySet) connectionProperties.SetProperty("SERVER", "SQLServer") connectionProperties.SetProperty("INSTANCE", "hbffcacqsql01") connectionProperties.SetProperty("DATABASE", "ACQ_HBED_PROD") connectionProperties.SetProperty("AUTHENTICATION_MODE", "OSA") SDEWorkspace = NewObj(esriDataSourcesGDB.SdeWorkspaceFactory, esriGeodatabase.IWorkspaceFactory2) result = SDEWorkspace.Open(connectionProperties, 0)
I get this error:
Traceback (most recent call last): File "C:/Users/tstanley/Downloads/ArcMap_Python/FirstTry.py", line 88, in <module> result = SDEWorkspace.OpenFromString(connectionString, 0) _ctypes.COMError: (-2147216021, None, (u'Entry for SDE instance not found in services file', u'esriDataSourcesGDB.SqlWorkspace.1', u'esri_csGeoDatabase.hlp', 0, None))
If I leave out the instance parameter, the connection window pops up and if I put the same value into the window, I get a connection.
Can someone tell me what I'm missing?
I have read a bunch of other posts of people with this error and they mention replacing the instance with a service number, 5151. It seems that they are trying to connect to an SDE database, which this isn't. I'm really new to ArcObjects so I have just about everything still to learn.