I'm using this code
try {
String connectionURL = "jdbc:mysql://localhost:3306/mydb";
Connection connection = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "root", "");
if(!connection.isClosed())
System.out.println("Successfully connected to " + "MySQL server using TCP/IP...");
ResultSet rs = null;
Statement statement = null;
statement = connection.createStatement();
// sql query to retrieve values from the secified table.
String QueryString = "SELECT `Text` FROM `card` WHERE `CardID`=1";
rs = statement.executeQuery(QueryString);
String arabictext ="";
while (rs.next()) {
System.out.println(rs.getString(1));
arabictext += rs.getString(1);
}
rs.close();
statement.close();
}
catch(Exception ex){
System.out.println("Unable to connect to database.");
}
Text
column in card
table is text
type and utf8_unicode_ci
Collation.
When I execute above query which fetch Arabic text then it didn't show in right format instead it show question marks like ?????
.
I print this on console and on jsp page, but it is showing ???
on both.