/** * */ package testsuite.simple; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.sql.Connection; import java.sql.Statement; import java.util.Properties; import testsuite.BaseTestCase; /** * @author Administrator * */ public class TestBug51527_1 extends BaseTestCase { /** * @param name */ public TestBug51527_1(String name) { super(name); // TODO Auto-generated constructor stub } public void testBug51527_1() throws Exception { System.out.println("java.vm.version : " + System.getProperty("java.vm.version")); System.out.println("java.vm.vendor : " + System.getProperty("java.vm.vendor")); System.out.println("java.runtime.version : " + System.getProperty("java.runtime.version")); System.out.println("os.name : " + System.getProperty("os.name")); System.out.println("os.version : " + System.getProperty("os.version ")); System.out.println("sun.management.compiler : " + System.getProperty("sun.management.compiler")); if (versionMeetsMinimum(5, 0, 7)) { Properties props = new Properties(); //&useUnicode=true&characterSetResults=utf8&traceProtocol=true props.put("useUnicode", "true"); props.put("characterEncoding", "MS932"); Connection conn1 = null; try { conn1 = getConnectionWithProps(props); File testBlobFile = new File("E:\\mysql.gif"); Statement stmt1 = conn1.createStatement(); createTable("BLOBTEST", "(pos int PRIMARY KEY auto_increment, blobdata LONGBLOB) DEFAULT CHARSET=CP932"); BufferedInputStream bIn = new BufferedInputStream(new FileInputStream(testBlobFile)); this.pstmt = conn1.prepareStatement("INSERT INTO BLOBTEST(blobdata) VALUES (?)"); this.pstmt.setBinaryStream(1, bIn, (int) testBlobFile.length()); this.pstmt.execute(); this.pstmt.clearParameters(); this.rs = stmt1.executeQuery("SELECT blobdata from BLOBTEST LIMIT 1"); this.rs.next(); if (bIn != null) { bIn.close(); } } finally { closeMemberJDBCResources(); } } } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub junit.textui.TestRunner.run(TestBug51527_1.class); } }