Arcgis server:Connection To SDE ORACLE

• Top Print Reply Alert Moderator   
Subject Connection To SDE ORACLE 
Author Mourad AbuSall 
Date Jun 25, 2007 
Message i created this code to connect on geodatabase sde and this code not working i don't know why!!.

what i do for this ?
please help me ....
it was stoped on this code :
------------------------
pFact = New SdeWorkspaceFactory
pWorkspace = pFact.Open(pPropSet, Me.HWnd)
------------------------
and display this error :
"Page_Error
Exception from HRESULT: 0x80040228" 
 
Dim pPropSet As IPropertySet
            pPropSet = New ESRI.ArcGIS.esriSystem.PropertySet
            Dim pFact As IWorkspaceFactory
            Dim pWorkspace As ESRI.ArcGIS.Geodatabase.IWorkspace
            With pPropSet
            .SetProperty("Server", "isc-devsrv")
            .SetProperty("Instance", "5151")
            .SetProperty("Database", "")
            .SetProperty("User", "REGIS")
            .SetProperty("password", "REGIS")
            .SetProperty("version", "SDE.DEFAULT")
            End With
            pFact = New ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactory
            pWorkspace = pFact.Open(pPropSet, Me.HWnd)
            Dim pFeatureWorkspace As IFeatureWorkspace
            pFeatureWorkspace = pWorkspace
            Dim pFeatureClass As IFeatureClass
            pFeatureClass = pFeatureWorkspace.OpenFeatureClass("REIS_SDE.RPAR_Real_Estate_Parcels")
            Dim dsenum As IEnumDataset = pWorkspace.getDatasets(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTFeatureDataset)
            Dim ds As IDataset = dsenum.Next()
            While Not (ds Is Nothing)
            MsgBox(ds.Name)
            ds = dsenum.Next()
            End While
            
 
  Mourad AbuSall
GIS Developer

Ideal Solutions Co.

Ahmed Bin Ali Str., Wadi Al Sail West
PO Box 20851, Doha, Qatar
Tel: +974-4888450/2/3
Fax: +974-4888451
Mob: +974-5028350
Email: mabusall@isolc.com
Web: www.isolc.com
 
   
• Top Print Reply Alert Moderator   
Subject Re: Connection To SDE ORACLE 
Author Jeff Bourdier 
Date Jul 11, 2007 
Message I am having almost this same exact problem. (The only difference is that my error message doesn't say "Page_Error".)

What version of ArcGIS are you using? I'm using 9.2.

The 9.2 documentation on IWorkspaceFactory.Open says to specify an additional property, "AUTHENTICATION_MODE" as either "OSA" or "DBMS". I have specified it as "DBMS" and still get the same error.

Any help on this would be appreciated! 
 
Dim pPropSet As IPropertySet
            Dim pSdeFact As IWorkspaceFactory
            pPropSet = New PropertySet
            With pPropSet
            .SetProperty("SERVER", Server)
            .SetProperty("INSTANCE", Instance)
            .SetProperty("DATABASE", Database)
            .SetProperty("USER", User)
            .SetProperty("PASSWORD", Password)
            .SetProperty("AUTHENTICATION_MODE", "DBMS")
            .SetProperty("VERSION", version)
            End With
            Dim pSDEWorkspace As IWorkspace
            pSdeFact = New SdeWorkspaceFactory
            pSDEWorkspace = pSdeFact.Open(pPropSet, 0)
            
 
   
• Top Print Reply Alert Moderator   
Subject Re: Connection To SDE ORACLE 
Author Jim Wozniczka 
Date Jul 12, 2007 
Message I am having the exact same problem with 9.2, so you're not alone! 
   
• Top Print Reply Alert Moderator   
Subject Re: Connection To SDE ORACLE 
Author Matt McGuire 
Date Jul 12, 2007 
Message I am getting the same error and I'm guessing it is because hWnd is a windows programming construct. I don't think the web server can deal with it.

If that is true, it leaves us the question - how do I connect directly to an SDE database with DotNet and ArcObjects? Can it be done?
 
   
• Top Print Reply Alert Moderator   
Subject Re: Connection To SDE ORACLE 
Author Jim Wozniczka 
Date Jul 16, 2007 
Message fyi...I've got an incident open with ESRI technical support about this problem. I'll be sure to post if I get a response of some kind.

Jim 
   
• Top Print Reply Alert Moderator   
Subject Re: Connection To SDE ORACLE 
Author Andrew Hayden 
Date Jul 16, 2007 
Message Here is some code I cobbled together when I was working on examples of dynamically adding shapefiles and featureclasses (from a button click event). Some of it's commented and some is double commented (there is a shapefile example and my adaptation for an SDE example (vector and raster)). You should pretty much get the idea of what you need to uncomment to get it to work. The code works with SDE Oracle. 
 
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
            '********************************************************************************************************
            'Code for connecting to shapefiles on the server or connecting to SDE
            'Dim mapFunc As ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality = _
            'CType(Map1.GetFunctionality(0), ESRI.ArcGIS.ADF.Web.DataSources.IMS.MapFunctionality)
            'Dim mapView As MapView = mapFunc.MapView
            ''shapefile example
            ''Dim drainWkspc As New ShapeWorkspace("riversWorkspace", "D:\ArcIMS\data\NorthAmerica")
            ''sde example
            ''Dim drainWkspc As New SdeWorkspace("riversWorkspace", "servername", "port:XXXX", "user", "password")
            ''sde raster example
            'Dim drainWkspc As New SdeWorkspace("riversWorkspace", "servername", "port:XXXX", "user", "password")
            ''shapefile example
            ''Dim drainDataset As New FeatureDataset("Rivers", drainWkspc)
            ''sde example
            ''Dim drainDataset As New FeatureDataset("LAND.TFLANDS", drainWkspc)
            ''sde raster example
            'Dim drainDataset As New ImageDataset("SDE_RASTER.CIR2005.RASTER", drainWkspc)
            ''shapefile and sde example
            ''Dim drainLayer As New ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("riversDynamic", drainDataset)
            ''drainLayer.Type = FeatureType.Polygon
            ''sde raster example
            'Dim drainLayer As New ESRI.ArcGIS.ADF.IMS.Carto.Layer.ImageLayer(drainDataset)
            ''shapefile and sde example
            ''Dim drainSymbol As New SimpleLineSymbol(System.Drawing.Color.Blue, 2)
            ''Dim drainRenderer As New SimpleRenderer(drainSymbol)
            ''drainLayer.Renderer = drainRenderer
            ''drainLayer.Name = "TF Lands"
            ''sde raster example
            'drainLayer.Name = "2005 Color IR"
            '' ArcIMS map configuration file (axl) needs 'MAP dynamic="true"' to work
            'mapView.Layers.Add(drainLayer)
            'Map1.InitializeFunctionalities()
            'Map1.Refresh()
            'Toc1.Refresh()
 
   
• Top Print Reply Alert Moderator   
Subject Re: Connection To SDE ORACLE 
Author Knut Erik Hollund 
Date Jul 19, 2007 
Message Your code Andrew Hayden, might work ok - but I guess the other problems is not with ArcGIS Server (ADF's) but with the ArcObjects api. (Standalone)

I've got the same issue as well, trying to write a small console utilg and got the error. The same code works ok if i'm doing it within a command class. (A new menu item within ArcMap).

If anybody happens to resolve this, please reply :-)

Pasting my code as well. (c#)
Got Error "Exception from HRESULT: 0x80040228" 
 
//For example, server = "sde-server".
            // Database = "P100.mydomain.no"
            // Instance = "5151".
            // User = "vtest".
            // Password = "go".
            // Version = "SDE.DEFAULT".
            public IWorkspace OpenArcSDEWorkspace(string server, string instance, string user,
            string password, string database, string version)
            {
            ESRI.ArcGIS.esriSystem.IPropertySet propertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();
            propertySet.SetProperty("SERVER", server);
            propertySet.SetProperty("INSTANCE", instance);
            propertySet.SetProperty("DATABASE", database);
            propertySet.SetProperty("USER", user);
            propertySet.SetProperty("PASSWORD", password);
            propertySet.SetProperty("VERSION", version);
            IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
            return workspaceFactory.Open(propertySet,0);
            }
            IWorkspace pWorkspace = OpenArcSDEWorkspace("sde-server", "5151", "myadm", "myadmpassword", "P100.mydomain.com", "SDE.DEFAULT");
 
  --
Knut Erik Hollund
Statoil ASA, Norway 
   
• Top Print Reply Alert Moderator   
Subject Re: Connection To SDE ORACLE 
Author Knut Erik Hollund 
Date Jul 19, 2007 
Message OK - so this resolved the issue for me :-)

I had forgot to initialise the Arc - license ! :-/

Used the following code in C# - and whola ! - Connected. 
 
            ESRI.ArcGIS.esriSystem.IAoInitialize a = new ESRI.ArcGIS.esriSystem.AoInitialize();
            a.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcView);
            
 
  --
Knut Erik Hollund
Statoil ASA, Norway 
   
• Top Print Reply Alert Moderator   
Subject Re: Connection To SDE ORACLE 
Author Jeff Bourdier 
Date Jul 24, 2007 
Message As a matter of fact, I've just independently discovered that the same is true in my case. I had not yet initialized ArcObjects.

Funny, in the 9.1 version of this application, it worked without initializing ArcObjects. Apparently this changed in 9.2.

 
 
Private m_pAoInitialize As IAoInitialize
            Private Sub initializeArcObjects()
            m_pAoInitialize = New AoInitialize()
            m_pAoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcView)
            End Sub
posted @ 2007-11-12 17:14  四两  阅读(1718)  评论(0编辑  收藏  举报
加油,哥们,现在开始!