|
|
Question : Java query from Mysql longtext field
|
|
I have a mysqld database with a 'longtext' field. The long text contains paragraphs and multiple strings of data.
When I call ResultSet.getString() I only get the first line of data not the whole paragraph.
How do i get all the data from my longtext field?
|
Answer : Java query from Mysql longtext field
|
|
StringBuilder sb = new StringBuilder(); Reader in = rs.getCharacterStream("textCol"); int buf = -1; while((buf = in.read()) > -1) { sb.append((char)buf); } in.close(); String text = sb.toString();
|
|
|
|