ThinkGeo.com    |     Documentation    |     Premium Support

ORA-00936: missing expression error

 Hi,


   I am trying to connect to Oracle dataset (10G) to see a layer using the sample "LoadAnOracleFeatureLayer.aspx" file provided. While doing so, I get a message "ORA-00936: missing expression".


    What am I missing?!


The code-behind code is:


using System;

using System.Web.UI;

using ThinkGeo.MapSuite.Core;

using ThinkGeo.MapSuite.WebEdition;



namespace CSSamples.Samples.DataProviders

{

    public partial class LoadAnOracleSpatialFeatureLayer : System.Web.UI.Page

    {

        protected void Page_Load(object sender, EventArgs e)

        {

            if (!Page.IsPostBack)

            {

                Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"));

                Map1.CurrentExtent = new RectangleShape(-140, 60, 140, -60);

                Map1.MapUnit = GeographyUnit.DecimalDegree;



                // The following two lines of code enable the client and server caching.

                // If you enable these features it will greatly increase the scalability of your

                // mapping application however there some side effects that may be counter intuitive.

                // Please read the white paper on web caching or the documentation regarding these methods.



                // Map1.StaticOverlay.ClientCache.CacheId = "WorldOverlay";

                // Map1.StaticOverlay.ServerCache.CacheDirectory = MapPath("~/ImageCache/" + Request.Path);



                // Please modify the visible property of the map in .aspx file if you load the map from MsSQL2008

                // using following code.

                Map1.Visible = true;

                 LoadAnOracleVectorLyer();

            }

        }



        private void LoadAnOracleVectorLyer()

        {

            //string connectString = "User ID=userid;Password=password;Data Source=192.168.0.178/orcl;";

            //OracleFeatureLayer oracleLayer = new OracleFeatureLayer(connectString, "states", "recid");

            string connectString = "User ID=spatialdat;Password=spatialdat;Data Source=ora102w;";

            OracleFeatureLayer oracleLayer = new OracleFeatureLayer(connectString, "SP_PARCEL", "GID");

            oracleLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;

            oracleLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            Map1.StaticOverlay.Layers.Add(oracleLayer);

        }

    }

}

 


"SP_PARCEL" table has a geometry column and "GID" is the unique identified within that table. No changes done to the *.aspx markup code.


Any suggestions would be appreciated.


Regards,


Praveen



Praveen,


Welcome to the community. Hope you enjoy sharing and learning here.


Here are some places you need to make sure.


1, The comment “// Please modify the visible property of the map in .aspx file if you load the map from MsSQL2008 using following code.” doesn't mean you need the statement “Map1.Visible=true”, instead it means you need to go to the aspx file and change it like this. That's because as we can't involve an Oracle Server along with the sample, we attached a picture here to just show the result. So when we start to make it work, we should comment out the static image and change the Visible property to “true”(it's false by default)


2, Make sure your database has the geometries column and it is polygon based, not line based or point based.


If you still have the problem, could you send us the script or some data for the database so we can recreate it here? You can send it to support@thinkgeo.com and ask to forward to Ben if you want.


Thanks,


Ben



494-NewScript.txt (613 Bytes)

Thanks for your response Ben.


Did not make any difference on the changes you had suggested. Just to make sure something not system specific, I am tried to connect from Windows Server 2003 box(ThinkGeo MapSuite Evaluation Edition is installed in the box), instead of my Windows XP one. Here, I could see a blank screen instead of the "ORA" message. I believe the application is not getting connected to the Oracle database - as I could not see any session at the database end.


Tried the below different connect strings:


string connectString = "User ID=bwgis;Password=bwgis;Data Source=ora102w;";

string connectString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.49)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORA102W)));User Id=BWGIS;Password=BWGIS;";



string connectString = "Data Source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = OSTDEMO)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ORA102W)));User Id=BWGIS;Password=BWGIS;";


Gave a wrong user id./password, still blank screen. 


Any logging is done at the MapSuite back-end?!


Appreciate your thoughts, as we are evaluating the product and would n't like to let go for something silly from my side. If you have a mini-dataset you would like us try, along with sample code, please kindly pass it on.


Regards,


Praveen

 



We are setting up our new Oracle Server, we will work on this post right after we figure that out. 
  
 Ben

Praveen, 
  
 We tested your issue on 11g, we are now still downloading  the 10g one and if this didn’t solve your problem, we will have another try. 
  
 In a connection string,  I think we need both server name and service name for a data source,  such as “Data Source=192.168.0.178/orcl” (“orcl” is the service name).  I didn’t see the server name in your connection string though, maybe that’s why you cannot get connected. 
  
 In the test, we also met the blank screen before we set the index of the table. Maybe that’s also the cause of your problem. Here are 3 commands I need to run before it is working fine. I think it should also work for you 
  
 'Insert info to the metadata 
 INSERT INTO USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)  
   VALUES (‘TABLENAME’, ‘GEOMETRYCOLUMN’,  
     MDSYS.SDO_DIM_ARRAY  
       (MDSYS.SDO_DIM_ELEMENT(‘X’, minX, maxX, 0.000000050),  
        MDSYS.SDO_DIM_ELEMENT(‘Y’, minY, maxY, 0.000000050)   
      ),  
      SRID);  
 COMMIT; 
  
 ’ I’m not very sure what is the procedure for, but we need it anyway 
 EXECUTE SDO_MIGRATE.TO_CURRENT(‘TABLENAME’,‘GEOMETRYCOLUMN’); 
  
 'Create Index 
 CREATE INDEX INDEX_NAME ON TABLENAME(GEOMETRYCOLUMN) INDEXTYPE IS MDSYS.SPATIAL_INDEX; 
  
 Thanks, 
  
 Ben