chris,

a small test, using getAscaiiStream - seems to produce the right output.

this informix table has the JSON blob stored in a TEXT field


solr...@bogus.bogus.com ~ > ./dojdbctest.sh 
[{"name":"shipGuarantee","valHi":"Y"}]
[{"name":"Subscription","valHi":"Y"}]
[{"name":"shipGuarantee","valHi":"Y"}]
[{"name":"Length","valHi":"7.5"},{"name":"Width","valHi":"3"},{"name":"Height","valHi":"2.5"},{"name":"Weight","valHi":"0.61"}]



import java.sql.*;
import java.io.*;
public class JDBCTest {
        public static void main (String [] args){
                connectToAndQueryDatabase();
        }
        public static void connectToAndQueryDatabase() {
                String driver="com.informix.jdbc.IfxDriver";
                String url="foo"; 
                String user="boo"; 
                String password="baz";
                try {
                        Class.forName("com.informix.jdbc.IfxDriver");
                        Connection con = DriverManager.getConnection( url,
user, password);
                        Statement stmt = con.createStatement();
                                                ResultSet rs =
stmt.executeQuery("select attr_val from tmpxtpa_prt_attr where spp_id =
'464'");
                        while (rs.next()) {
                                java.io.InputStream s =
rs.getAsciiStream(1);
                               
System.out.println(getStringFromInputStream(s));
                        }
                }catch (Exception se){
                        se.printStackTrace();
                }
        }


private static String getStringFromInputStream(InputStream is) {
 
                BufferedReader br = null;
                StringBuilder sb = new StringBuilder();
 
                String line;
                try {
 
                        br = new BufferedReader(new InputStreamReader(is));
                        while ((line = br.readLine()) != null) {
                                sb.append(line);
                        }
 
                } catch (IOException e) {
                        e.printStackTrace();
                } finally {
                        if (br != null) {
                                try {
                                        br.close();
                                } catch (IOException e) {
                                        e.printStackTrace();
                                }
                        }
                }
 
                return sb.toString();
 
        }




}




--
View this message in context: 
http://lucene.472066.n3.nabble.com/have-developer-question-about-ClobTransformer-and-DIH-tp4064256p4064975.html
Sent from the Lucene - Java Developer mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to