I have built a
java (not
jsp or
servlet) using a database(character set to latin5) built in mysql with esclipse.When I query the database all the characters appear correct.But when the method below is called its meant to display the sample
string (bh� m�) but displays as (bh� m�) inthe java front end.
try
{
Class.forName( JDBC_DRIVER ); // load database driver class
// specify properties of JdbcRowSet
JdbcRowSet rowSet = new JdbcRowSetImpl();
rowSet.setUrl( DATABASE_URL ); // set database URL
rowSet.setCommand("SELECT positive FROM verbTable7 " +
"WHERE
word = '" + verbList.getSelectedItem
().toString()+ "'"
+"AND tense = 'past'" ); // set query
rowSet.execute(); // execute query
// process query results
ResultSetMetaData metaData = rowSet.getMetaData();
int numberOfColumns = metaData.getColumnCount();
area3.setText("");
area3.append("Past/Aimsir Chaite\n");
// display each row
while ( rowSet.next() )
{
for ( int i = 1; i <= numberOfColumns; i++ )
{
area3.append( "\n"+ rowSet.getString( i ) + "\t");
}
System.out.println();
} // end while
} // end try
catch ( SQLException sqlException )
{
sqlException.printStackTrace();
System.exit( 1 );
} // end catch
catch ( ClassNotFoundException classNotFound )
{
classNotFound.printStackTrace();
System.exit( 1 );
} // end catch