Spatial Data Types
Spatial Data Types
File: SpatialDataTypes.java
Summary: This Microsoft JDBC Driver for SQL Server Sample application
demonstrates how to use prepared statement setter methods to
set values for SQL Server Spatial Datatypes 'Geography' and
'Geometry'.
It also demonstrates how to use result set getter methods to read
and parse SQL Server Spatial data type values.
---------------------------------------------------------------------
This file is part of the Microsoft JDBC Driver for SQL Server Code Samples.
Copyright (C) Microsoft Corporation. All rights reserved.
THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
=====================================================================*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import com.microsoft.sqlserver.jdbc.Geography;
import com.microsoft.sqlserver.jdbc.Geometry;
import com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement;
import com.microsoft.sqlserver.jdbc.SQLServerResultSet;
stmt.executeUpdate(
"Create table " + tableName + " (c1 geometry, c2
geography)");
}
}