1 21 22 package org.apache.derbyTesting.functionTests.tests.largedata; 23 24 import java.sql.Connection ; 25 import java.sql.PreparedStatement ; 26 import java.sql.Statement ; 27 import java.sql.SQLException ; 28 29 import java.io.ByteArrayInputStream ; 30 31 import org.apache.derby.tools.ij; 32 import org.apache.derby.tools.JDBCDisplayUtil; 33 34 52 53 public class lobLengthTests { 54 55 58 public static void main(String [] args) 59 { 60 new lobLengthTests().go(args); 61 } 62 63 69 public void go(String [] args) 70 { 71 try { 72 73 ij.getPropertyArg(args); 76 Connection conn = ij.startJBMS(); 77 78 derby_121Test(conn); 80 81 } catch (Exception e) { 82 83 System.out.println("FAIL -- Unexpected exception:"); 84 e.printStackTrace(System.out); 85 86 } 87 } 88 89 96 private static void derby_121Test(Connection conn) 97 throws SQLException 98 { 99 System.out.println("Testing server read of lob length > 2^24 bytes."); 100 101 boolean autoc = conn.getAutoCommit(); 102 conn.setAutoCommit(false); 103 104 Statement st = conn.createStatement(); 106 st.execute("create table lobTable100M(bl blob(100M))"); 107 108 PreparedStatement pSt = conn.prepareStatement( 109 "insert into lobTable100M(bl) values (?)"); 110 111 byte [] bA = new byte[16800000]; 121 pSt.setBinaryStream(1, 122 new java.io.ByteArrayInputStream (bA), bA.length); 123 124 try { 127 pSt.execute(); 128 System.out.println("PASS."); 129 } catch (Exception e) { 130 System.out.println("FAIL -- unexpected exception:"); 131 e.printStackTrace(System.out); 132 } 133 134 try { 136 st.execute("drop table lobTable100M"); 137 } catch (SQLException se) {} 138 139 conn.setAutoCommit(autoc); 140 return; 141 142 } 143 } 144 | Popular Tags |