Menu

Input Stream Configuration

lenysoft

Input Stream Configuration

    ...

    Properties info=new Properties();

    info.put(TextJDBC.SOURCE, TextJDBC.SOURCE_STREAM);
    info.put(TextJDBC.TYPE, TextJDBC.TYPE_CSV);
    info.put(TextJDBC.COLUMN_NAMES, "name,last_name,amount");
    info.put(TextJDBC.COLUMN_TYPES, "String,String,Double");
    InputStream is=new ByteArrayInputStream
        (("\"name1\",\"last name1\",\"10.1\"\n\"name2\",
        \"last name2\",\"11.2\"\n\"name3\",\"last name3\",\"23\"").getBytes());    

    String sql="select last_name,name,amount from test 
        where (last_name starts with 'last name') 
        and ((amount==5) or (amount==12)) order by amount desc";    

    Class.forName(TextJDBCDriver.class.getCanonicalName());
    TextConnection con=(TextConnection)DriverManager.getConnection("", info);
    con.setInputStream(is);
    PreparedStatement p=con.prepareStatement(sql);

    ...

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.