This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 and Relational Databases
Bookmark "mysql and java application:characters not displaying right " Watch "mysql and java application:characters not displaying right " New topic

mysql and java application:characters not displaying right

Paul Cullen

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.
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.append("Past/Aimsir Chaite\n");

// display each row
while ( )
for ( int i = 1; i <= numberOfColumns; i++ )
area3.append( "\n"+ rowSet.getString( i ) + "\t");
} // end while
} // end try
catch ( SQLException sqlException )
System.exit( 1 );
} // end catch
catch ( ClassNotFoundException classNotFound )
System.exit( 1 );
} // end catch
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: mysql and java application:characters not displaying right
It's not a secret anymore!