See if you can solve this problem..

See if you can solve this problem..

Post by Wojciech T. Gromczynsk » Thu, 06 Apr 2000 04:00:00



I posted description of my question with the code on the web:
http://members.home.net/wgromczynski/wgromczynski/question.htm
 
 
 

1. Problem solved, yet another problem

Hello again,

your advises really did help me, thanks to all. But now there is another
problem:

We tried to implement an "Object in area"- Range Query with the help of
the functions of the DB2 spatial extender. To get a better performance,
we decided to do these queries as prepared statements. But if we execute
our queries we get the following error:

 COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC-Treiber] CLI0612E  Ungltige
Parameterazahl. SQLSTATE=S1093

Our prepared statement goes like this:

Connection con;

objInArea = con.prepareStatement("select oid from HAESSLER.LINFO where
"+
      "db2gse.ST_Contains(db2gse.ST_PolyFromText('polygon(("+
      "CAST(? AS double) CAST(? AS double),"+
      "CAST(? AS double) CAST(? AS double),"+
      "CAST(? AS double) CAST(? AS double),"+
      "CAST(? AS double) CAST(? AS double),"+
      "CAST(? AS double) CAST(? AS double)))',"+
      "db2gse.coordref()..srid(50)) , p) = 1");

These are 10 parameter markers in total.

Our prepared statement objInArea is executed with the following lines of
code:

        objInArea.setDouble(1, nowe.getX());
        objInArea.setDouble(2, nowe.getY());
        objInArea.setDouble(3, noes.getX());
        objInArea.setDouble(4, noes.getY());
        objInArea.setDouble(5, soes.getX());
        objInArea.setDouble(6, soes.getY());
        objInArea.setDouble(7, sowe.getX());
        objInArea.setDouble(8, sowe.getY());
        objInArea.setDouble(9, nowe.getX());
        objInArea.setDouble(10, nowe.getY());

        ResultSet rs = objInArea.executeQuery();

          while (rs.next()) {
             ObjectId oid = ObjectId.valueOf(rs.getString(1));
             vec.addElement(oid);
          }
          rs.close();
          return vec;

(As you may have noticed this method returns the Ids of all Points that
are residing in a rectangle in a vector).
To fit on the prepared statement, 10 values for the parameter markers of
the objInArea prepared statement are given.

So we wonder, what causes the error given above?

Many thanks in advance and many greets,

Achim.

2. DYNAMICS'97 Call for Participation

3. bcp canned app

4. ORACLE APPLICATION SERVER

5. Cans access2.0 engine access btrieve files?

6. Need help designing database

7. Anyone know of some canned (cheap or free) DB performance testing software

8. Access ADP and SS7: Identical tables, db owner role, can insert on one, not other.

9. Canned PARADOX scripts?

10. canned code to get db on web quickly via perl or

11. Switching from inhouse to canned package.

12. MDX : Canned Report or OLAP

13. if you will promise Allahdad's swamp against cans, it will angrily depart the unit