Opened 18 years ago

Last modified 14 years ago

#1846 closed defect

Empty Oracle environmental variables cause failure without error message — at Initial Version

Reported by: maris.gis@… Owned by: fsimon@…
Priority: high Milestone: 6.0 release
Component: Input - Native Oracle Spatial Support Version: 4.6
Severity: normal Keywords:
Cc: fsimon, dmorissette

Description

If Oracle environmental variables are undefined, then OCIErrorGet() does not
return any error message thus last_oci_call_ms_error variable is empty and no
error message is returned to user. 

Empty last_oci_call_ms_error is returnet by TRY() (maporaclespatial.c:282) to
msOracleSpatialLayerOpen() (maporaclespatial.c:1577).

Solution: check required environmental variables before trying to connet to
Oracle database.

like:
*** maporaclespatial.c.orig	Fri Apr 29 01:19:41 2005
--- maporaclespatial.c	Wed Jul 26 01:08:16 2006
***************
*** 1560,1565 ****
--- 1560,1594 ----
      }

      last_oci_call_ms_status = MS_SUCCESS;
+
+     if (getenv("ORACLE_HOME") == NULL)
+     {
+         msSetError( MS_ORACLESPATIALERR, "Missing ORACLE_HOME environmental
variable!", "msOracleSpatialLayerOpen()");
+
+         msOCICloseDataHandlers( dthand );
+         msOCIClearLayerInfo( layerinfo );
+
+         return MS_FAILURE;
+     }
+     if (getenv("ORACLE_BASE") == NULL)
+     {
+         msSetError( MS_ORACLESPATIALERR, "Missing ORACLE_BASE environmental
variable!", "msOracleSpatialLayerOpen()");
+
+         msOCICloseDataHandlers( dthand );
+         msOCIClearLayerInfo( layerinfo );
+
+         return MS_FAILURE;
+     }
+     if (getenv("ORACLE_SID") == NULL)
+     {
+         msSetError( MS_ORACLESPATIALERR, "Missing ORACLE_SID environmental
variable!", "msOracleSpatialLayerOpen()");
+
+         msOCICloseDataHandlers( dthand );
+         msOCIClearLayerInfo( layerinfo );
+
+         return MS_FAILURE;
+     }
+
      msSplitLogin( layer->connection, username, password, dblink );

      hand = (msOracleSpatialHandler *) msConnPoolRequest( layer );

Change History (0)

Note: See TracTickets for help on using tickets.