I would like to clarify once again that the InterSystems JDBC driver itself returns its current limits on the maximum size of certain types of data that can be viewed by any JDBC client (DbVisualizer, SQuirreL, etc.).
Let's check together in practice the maximum size of LONGVARCHAR in the InterSystems JDBC driver.
Class dc.test Extends %Persistent
{
Property Note As %Stream.GlobalCharacter;
}import java.io.*;
import java.sql.*;
class IRISDemo
{
public static void main(String[] args)
{
Connection db = null;
try
{
File file = new File("C:\\big.iso");
FileInputStream fis = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
BufferedReader br = new BufferedReader(isr);
Class.forName("com.intersystems.jdbc.IRISDriver");
DriverManager.setLoginTimeout(3);
db = DriverManager.getConnection("jdbc:IRIS://localhost:1972/USER", "_SYSTEM", "SYS");
PreparedStatement ps = db.prepareStatement("update dc.test set Note=? where id=1");
ps.setCharacterStream(1, br, file.length());
System.out.printf("Result = %s", ps.executeUpdate()).println();
ps.close();
db.close();
System.out.println("OK!");
} catch (Exception e)
{
e.printStackTrace();
}
}
}If the file size exceeds 2147483647 characters, the following error occurs:
java.sql.SQLException: Stream too long: 2895740928 at com.intersystems.jdbc.IRISPreparedStatement.setCharacterStream(IRISPreparedStatement.java:889)
- Log in to post comments