Revision 3207 trunk/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/testPostGis.java
testPostGis.java | ||
---|---|---|
75 | 75 |
String dbuser = "postgres"; |
76 | 76 |
String dbpass = "aquilina"; |
77 | 77 |
|
78 |
String dbtable = "vias";
|
|
78 |
String dbtable = "provin";
|
|
79 | 79 |
|
80 | 80 |
Connection conn = null; |
81 | 81 |
System.out.println("Creating JDBC connection..."); |
... | ... | |
135 | 135 |
/* |
136 | 136 |
* Create a statement and execute a select query. |
137 | 137 |
*/ |
138 |
// String strSQL = "select ASBINARY(the_geom) as geom, nom_provin from " + dbtable;
|
|
139 |
String strSQL = "select ASBINARY(the_geom) as geom from " + dbtable; |
|
138 |
String strSQL = "select AsBinary(the_geom) as geom, nom_provin from " + dbtable;
|
|
139 |
// String strSQL = "select ASBINARY(the_geom) as geom from " + dbtable;
|
|
140 | 140 |
// strSQL = "select ASTEXT(the_geom), nom_provin as geom from " + dbtable; |
141 | 141 |
/* String strSQL = "SELECT gid, rd_3, rd_5, rd_6, rd_10, rd_11, rd_12, rd_13, rd_14,"; |
142 | 142 |
strSQL = strSQL + " rd_15, rd_16, kilometers, cost, metros, AsText(force_2d(the_geom)) FROM vias"; |
... | ... | |
149 | 149 |
|
150 | 150 |
// Statement s = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); |
151 | 151 |
// s.setFetchSize(5); |
152 |
int fetchSize = 5000;
|
|
152 |
int fetchSize = 5; |
|
153 | 153 |
s.execute("declare wkb_cursor binary cursor for " + strSQL); |
154 | 154 |
ResultSet r = s.executeQuery("fetch forward " + fetchSize + " in wkb_cursor"); |
155 | 155 |
/// ResultSet r = s.executeQuery("fetch forward all in wkb_cursor"); |
... | ... | |
178 | 178 |
// Object obj = r.getObject(2); |
179 | 179 |
byte[] arrayByte = r.getBytes(1); |
180 | 180 |
IGeometry gp = parser.parse(arrayByte); |
181 |
// String strAux = r.getString(2);
|
|
181 |
String strAux = r.getString(2); |
|
182 | 182 |
// int id = r.getInt(2); |
183 | 183 |
// System.out.println("Fila " + id + ":" + obj.toString()); |
184 | 184 |
id++; |
... | ... | |
186 | 186 |
|
187 | 187 |
// PGgeometry geom = (PGgeometry)obj; |
188 | 188 |
// int id = r.getInt(2); |
189 |
// System.out.println("Row " + id + ":" + strAux);
|
|
189 |
System.out.println("Row " + id + ":" + strAux); |
|
190 | 190 |
// System.out.println(geom.toString()); |
191 | 191 |
// System.out.println("provin=" + r.getString(2)); |
192 | 192 |
if ((id % fetchSize) == 0) |
Also available in: Unified diff