You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if it's (also) related with the jdbc driver but when requesting the geometry type as wkb blob with ST_AsWKB() it seems that a string is returned.
Observations:
A select query with ST_AsWKB() shows the geometry as readable output in the duckdb cli and dbeaver, e.g. "MULTIPOLYGON((...))". I would expect to see some binary representation.
Using jdbc to retrieve the result from the same query in Java. The result object seems to be also a string.
Java code:
public class JdbcDuck {
public static void main(String... args) throws SQLException {
String dburl = "jdbc:duckdb:mytest.duckdb";
// Database connection parameters
String url = "jdbc:duckdb:mytest.duckdb";
String user = null;
String password = null;
// SQL statements
String loadSpatialSQL = "LOAD SPATIAL";
String selectSQL = "SELECT ST_AsWKB(mpoly) FROM afu_abbaustellen_pub_v1.abbaustelle_abbaustelle";
try (Connection connection = DriverManager.getConnection(url, user, password);
Statement statement = connection.createStatement()) {
// Execute LOAD SPATIAL
out.println("Executing: " + loadSpatialSQL);
statement.execute(loadSpatialSQL);
out.println("LOAD SPATIAL executed successfully.");
// Execute SELECT query
out.println("Executing: " + selectSQL);
ResultSet resultSet = statement.executeQuery(selectSQL);
// Process the result set
while (resultSet.next()) {
int columnCount = resultSet.getMetaData().getColumnCount();
for (int i = 1; i <= columnCount; i++) {
Object obj = resultSet.getObject(i);
System.out.println(obj.getClass());
}
out.println();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Hello! This is currently expected, because "WKB_BLOB" is a "custom type" it gets automatically cast to string in clients that dont know how to handle it natively. Internally, its still binary though. You can cast the result to blob explicitly to get the binary representation.
Not sure if it's (also) related with the jdbc driver but when requesting the geometry type as wkb blob with ST_AsWKB() it seems that a string is returned.
Observations:
A select query with ST_AsWKB() shows the geometry as readable output in the duckdb cli and dbeaver, e.g. "MULTIPOLYGON((...))". I would expect to see some binary representation.
Using jdbc to retrieve the result from the same query in Java. The result object seems to be also a string.
Java code:
mytest.duckdb.zip
The text was updated successfully, but these errors were encountered: