[mapserver-users] MS4W and Oracle

Jeff McKenna jmckenna at gatewaygeomatics.com
Wed May 18 16:14:40 PDT 2016


Hi Ricardo,

Can you test with a mapfile (not mapscript)?  Then use the shp2img 
commandline utility to test your mapfile.

In my Oracle instance, the default spatial column is named 
"ORA_GEOMETRY", so my DATA parameter in my mapfile layer looks like:

    DATA "ORA_GEOMETRY FROM (SELECT ORA_GEOMETRY FROM PARK)"

You can also see the full SQL used by MapServer, through your shp2img 
command such as:

    shp2img -m oracle.map -o ttt.png -all_debug 3

Look for the lines around "msOracleSpatialLayerWhichShapes.  Using this 
Sql to retrieve the data" in the response.

Another alternative, is to check how GDAL/OGR sees your Oracle table. 
Follow the steps to configure your MS4W (step 3 at 
http://ms4w.com/README_INSTALL.html#oracle-10g-11g-12c), then try to 
connect through ogrinfo:

   ogrinfo -ro OCI:jeff/pass at tnsname LAYERNAME -summary

I hope this gives you some ideas for your problem.


Thanks for using MS4W, and hello from the east coast of Canada! :)

-jeff


-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




On 2016-05-18 9:48 AM, Ricardo Queiroz wrote:
> This is my first mail to this list, and sorry about english (not my
> native language)
>
> I've a software with ms4w 1.3.4 and pgsql9.5 (and postgis 2.2.2) and
> works fine, so i need to convert all the app to use oracle (client
> request =/, i'm using oracle client 11.2.0.3.0). I follow the steps of
> the ms4w installation and when  write "mapserv -v" in console the
> oraclespatian appears, so the next step was test the connection layer,
> there's ok, when i change some parameters (to wrong) in the conn string
> the connect fail, but here's the problem, when i set a data in the layer
> (simple sql) allways return a error and i can't resolve this, don't know
> if is some mapserver config or else.
>
> Basic example of layer (trying draw a point):
>
>     $objLayer = ms_newLayerObj($objMap);
>     $objLayer ->set("name", "layer_oracle");
>     $objLayer ->setConnectionType(MS_ORACLESPATIAL);
>     $objLayer ->set("connection", "user/pass at tnsName");
>     $objLayer ->setProcessing("CLOSE_CONNECTION=DEFER");
>     $objLayer ->set("type", MS_LAYER_POINT);
>
>     $data = "THE_GEOM from (select PK_ID, NAME as LABELITEM, THE_GEOM
>     from user.TABLE_POINT) USING SRID 29193";
>     $objLayer ->set("data", $data); unset($data);
>
>     $objLayer ->set("labelitem", "LABELITEM");
>     $objLayer ->set("template", "layer.html");
>     $objLayer ->set("header", "layer.html");
>     $objLayer ->set("footer", "layer.html");
>
>     $objClass= ms_newClassObj($objLayer );
>     $objClass->set("name", "POINT");
>
>     $objStyle= ms_newStyleObj($objClass);
>     $objStyle->set("symbolname", "dot_purple");
>
>     $objLabel= new labelObj();
>     $objLabel->color->setRGB(217, 242, 230);
>     $objLabel->outlinecolor->setRGB(0, 0, 0);
>     $objLabel->set("font", "luxi-bold");
>     $objLabel->set("size", 9);
>     $objLabel->set("position", MS_UC);
>     $objLabel->set("partials", MS_TRUE);
>     $objLabel->set("mindistance",100);
>     $objLabel->set("buffer",4);
>
>     $objClass->addLabel($objLabel);
>     $objLayer ->set("status", MS_ON);
>
>     $objLayer ->free(); $objClass->free(); $objStyle->free();
>     $objLabel->free();
>     unset($objLayer); unset($objClass); unset($objStyle); unset($objLabel);
>
>
> I get the error message:
>
>     Warning: mapObj::draw(): [MapServer Error]: msDrawMap(): Failed to
>     draw layer named 'layer_oracle'. in...
>     Warning: mapObj::draw(): [MapServer Error]:
>     msOracleSpatialLayerWhichShapes(): Check your data statement and
>     server logs in...
>
>
> When i change some var on set("connection") i get the error conn msg, so
> i can connect, just can't draw the point
>
>     Warning: mapObj::draw(): [MapServer Error]:
>     msOracleSpatialLayerOpen(): Cannot create OCI Handlers. Connection
>     failure. Check your logs and the connection string. in
>
>
>
> The same example works fine when i change to postgis (using the same
> table "structure").
> Oracle table and the record:
>
>     CREATE TABLE TABLE_POINT
>     (
>     PK_ID NUMBER,
>     NAME VARCHAR2(30 BYTE),
>     THE_GEOM  SDO_GEOMETRY,
>     PRIMARY KEY (PK_ID)
>     )
>
>     insert into TABLE_POINT(PK_ID, NAME, THE_GEOM) values(1, 'Point
>     1', MDSYS.SDO_GEOMETRY(2001,29193,MDSYS.SDO_POINT_TYPE(798062.7655190326,7459237.923282569,null),null,null));
>
>
>
> Thanks,
>
> Ricardo Queiroz
>
>






More information about the MapServer-users mailing list