Jump to content
JasperReports Library 7.0 is now available ×

retrieving string from database


Recommended Posts

By: beng leong - blng

retrieving string from database

2003-07-15 04:56

i have a column in my database's table that contains japanese characters.

 

i do:

ResultSet rs = stmt.executeQuery("SELECT * FROM table");

 

JRResultSetDataSource rsds = new JRResultSetDataSource(rs);

 

byte[] bArr = rs.getBytes("jap_column");

 

String jap = new String(bArr, "SJIS");

 

parameters.put("japfield", jap);

 

print = JasperFillManager.fillReport(report, parameters, rsds);

 

i carry on to execute the exporting to pdf format etc.

the String jap would be displayed correctly (ie. the pdf file will display japanese chars) when using iReports-0.1.0.

 

however, from the above method, i can only "encode" one record in the table.

 

what do i have to do so that i can encode all the jap chars in the column and parse them into a JasperPrint object?

 

thanks

bl

 

 

 

 

By: Ryan Johnson - delscovich

RE: retrieving string from database

2003-07-17 13:15

Will a java ResultSet map "jap_column" to a String? If so, this should work:

 

<field name="jap_column" class="java.lang.String"/>

.

.

.

<textFieldExpression>

new String($F{jap_column}.getBytes(), "SJIS")

</textFieldExpression>

 

Hope that helps,

Ryan

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...