Re: Informix JDBC: inserting/retrieving TEXT columns?
Posted in 1998
We use this for BLOB's. I think it also works for TEXT's. Reading: /** * Returns a binary object * resultSet is a resultSet returned by a statement */ public byte[] getBytes(String fieldName) { byte[] wbytes = null; InputStream wbin = null; try { ByteArrayOutputStream wbout = new ByteArrayOutputStream(); wbin = resultSet.getBinaryStream(fieldName); int wbyte; while ((wbyte = wbin.read()) != -1) { wbout.write(wbyte); } wbytes = wbout.toByteArray(); } finally { if (wbin != null) { try { wbin.close(); } catch (IOException e) { e.printStackTrace(); } } } //System.out.println("getBytes " + fieldName + " - " + new String(wbytes)); return wbytes; } Writing: /** * sets a binary parameter in a PreparedStatement */ public void setPreparedParameter(int wpar, byte[] wvalue) { System.out.println("setBinaryStream " + wpar + " - " + new String(wvalue)); preparedStatement.setBinaryStream(wpar,new ByteArrayInputStream(wvalue), wvalue.length); } Bruce Fausey wrote in message <717jem$6df$1@newshost.cyberramp.net>... >I think for text and jdbc you need to define text pluse the informix side >needs to be able to retrieve text the book jdbc by taylor touches on text >but I have never been able to make it work either. >Bruce(GO PSU) > >Blake Buzzini wrote in message <7105vl$1gv2@r02n01.cac.psu.edu>... >>I'm using Informix's JDBC driver 1.22.JC1. Can someone explain to me in >>detail exactly how to insert and then retrieve TEXT columns from the >>database? The documentation is unclear and, in the case of querying, seems >>incorrect. >> >>Thank you. >> >>Blake Buzzini, PSU >> >> >