aspose file tools*
The moose likes JDBC and the fly likes mysql and java application:characters not displaying right Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "mysql and java application:characters not displaying right " Watch "mysql and java application:characters not displaying right " New topic
Author

mysql and java application:characters not displaying right

Paul Cullen
Greenhorn

Joined: Sep 07, 2007
Posts: 11
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mysql and java application:characters not displaying right