diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
index 3ad85fd9d..367acb46f 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
@@ -16,21 +16,27 @@
*/
package org.apache.openjpa.jdbc.sql;
+import java.io.InputStream;
+import java.io.Reader;
+import java.sql.Blob;
+import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Set;
+import org.apache.openjpa.jdbc.kernel.JDBCStore;
import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
-import org.apache.openjpa.kernel.Filters;
import org.apache.openjpa.jdbc.schema.Column;
+import org.apache.openjpa.kernel.Filters;
import org.apache.openjpa.lib.util.Localizer;
import org.apache.openjpa.meta.JavaTypes;
import org.apache.openjpa.util.StoreException;
/**
- * Dictionary for MS SQLServer.
+ * Dictionary for Microsoft SQL Server.
*/
public class SQLServerDictionary extends AbstractSQLServerDictionary {
@@ -277,4 +283,38 @@ public class SQLServerDictionary extends AbstractSQLServerDictionary {
}
return recoverable;
}
+
+ /**
+ * Obtain an {@link InputStream} by using {@link ResultSet#getBlob(int)} and
+ * {@link Blob#getBinaryStream()}.
+ * Unfortunately this will load entire BLOB into memory.
+ * The alternative {@link ResultSet#getBinaryStream(int)} provides true streaming but
+ * the stream can be consumed only as long as {@link ResultSet} is open.
+ */
+ @Override
+ public InputStream getLOBStream(JDBCStore store, ResultSet rs, int column) throws SQLException {
+ Blob blob = rs.getBlob(column);
+ if (blob == null) {
+ return null;
+ }
+ return blob.getBinaryStream();
+ }
+
+ /**
+ * Obtain a {@link Reader} by using {@link ResultSet#getClob(int)} and
+ * {@link Clob#getCharacterStream()}.
+ * Unfortunately this will load entire CLOB into memory.
+ * The alternative {@link ResultSet#getCharacterStream(int)} provides true streaming but
+ * the stream can be consumed only as long as {@link ResultSet} is open.
+ */
+ @Override
+ public Reader getCharacterStream(ResultSet rs, int column) throws SQLException {
+ Clob clob = rs.getClob(column);
+ if (clob == null) {
+ return null;
+ }
+ return clob.getCharacterStream();
+ }
+
+
}
diff --git a/openjpa-project/src/doc/manual/ref_guide_mapping.xml b/openjpa-project/src/doc/manual/ref_guide_mapping.xml
index c0563d017..56919a79a 100644
--- a/openjpa-project/src/doc/manual/ref_guide_mapping.xml
+++ b/openjpa-project/src/doc/manual/ref_guide_mapping.xml
@@ -2501,7 +2501,7 @@ version is 8.3-603)
-SQLServer 2005
+SQL Server 2005
@@ -2825,6 +2825,11 @@ Oracle
PostgreSQL
+
+
+SQL Server
+
+
See for possible database-specific
diff --git a/openjpa-project/src/doc/manual/supported_databases.xml b/openjpa-project/src/doc/manual/supported_databases.xml
index f2d4c29bc..0f6896899 100644
--- a/openjpa-project/src/doc/manual/supported_databases.xml
+++ b/openjpa-project/src/doc/manual/supported_databases.xml
@@ -863,7 +863,7 @@ Using the Sun JDBC-ODBC bridge to connect is not supported.
- Example properties for Microsoft SQLServer
+ Example properties for Microsoft SQL Server
openjpa.ConnectionDriverName: com.microsoft.sqlserver.jdbc.SQLServerDriver
@@ -937,6 +937,13 @@ generated values with SQL Server you should use GenerationType.IDENTITY,
GenerationType.TABLE, or GenerationType.AUTO.
+
+
+The use of LOB streaming is limited.
+When reading LOB data from the database, the Microsoft SQL Server driver will
+actually load all the data into memory at the same time.
+
+
@@ -1062,7 +1069,7 @@ to any value greater than zero will enable streaming result sets.
The use of LOB streaming is limited.
When reading LOB data from the database, the MySQL JDBC driver will actually
-load all the data in memory at the same time.
+load all the data into memory at the same time.