"No CRS for srid.."
-------------------

         Key: GEOT-802
         URL: http://jira.codehaus.org/browse/GEOT-802
     Project: GeoTools
        Type: Bug

  Components: oraclespatial  
    Versions: 2.2.M1, 2.2.M2    
 Environment: jdk1.5.0_05, WinXP
    Reporter: Vitaliy
 Assigned to: Sean Geoghegan 


The method below inside OracleDataStore.java makes query like:  "select wktext 
from cs_srs ...."

as cs_srs table is an object of MDSYS scheme, an exception occurs -  "No CRS 
for srid ...." as you can see in the code.
/////////////////original method:

protected CoordinateReferenceSystem determineCRS(int srid ) throws IOException {
        Connection conn = getConnection(Transaction.AUTO_COMMIT);;
        String wkt=null;
        try {
                Statement st = conn.createStatement();
                st.execute("select wktext from cs_srs where srid = "+srid );   
////// the line needs to be changed
                
                ResultSet set = st.getResultSet();
                if( !set.next() ) return null;
                wkt = set.getString(1);         
                return CRS.parseWKT( wkt );
        }
        catch( FactoryException parse){
                throw (IOException) new IOException( "Unabled to parse WKTEXT 
into a CRS:"+wkt ).initCause( parse );
        }       
        catch( SQLException sql ){
                throw (IOException) new IOException( "No CRS for srid "+srid 
).initCause( sql );
        }
    }


I've replaced the query with  "select wktext from mdsys.cs_srs ...." , 
recompiled the OracleDataStore.java file put it into oracle-spatial.jar and now 
it works fine for me.


/////////////////modified method:
protected CoordinateReferenceSystem determineCRS(int srid ) throws IOException {
        Connection conn = getConnection(Transaction.AUTO_COMMIT);;
        String wkt=null;
        try {
                Statement st = conn.createStatement();
                st.execute("select wktext from mdsys.cs_srs where srid = "+srid 
); ///// changed line
                
                ResultSet set = st.getResultSet();
                if( !set.next() ) return null;
                wkt = set.getString(1);         
                return CRS.parseWKT( wkt );
        }
        catch( FactoryException parse){
                throw (IOException) new IOException( "Unabled to parse WKTEXT 
into a CRS:"+wkt ).initCause( parse );
        }       
        catch( SQLException sql ){
                throw (IOException) new IOException( "No CRS for srid "+srid 
).initCause( sql );
        }
    }

i don't exactly know if im right about it being a bug...cause in uDig project i 
connected to Oracle without any problems like this, may be they changed that or 
maybe im making a mistake.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to