In a program I wrote in Delphi, Chinese characters like '% Chinese %' never worked. Not the Qualified Data, but all the data, which was also mentioned in firebird.net.cn, FB does not support Chinese. My colleague used. Net to implement the perfect Chinese like. Today I use Java as well as the Chinese like. It is normal and there is no problem. It may be due to a problem with the Delphi driver, either the driver itself or the sequence set to be specified when the driver opens the database, or a problem with the string format of the data that I transmit. This is not a problem with Firebird.
The test code is as follows:
Package jfb;
Import java. Io. bufferedreader;
Import java. Io. ioexception;
Import java. Io. inputstreamreader;
Import java. SQL .*;
// Import org. firebirdsql. JDBC .*;
Public class jfb
{
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs) throws classnotfoundexception,
Sqlexception, ioexception
{
// Todo automatically generates method stubs
Class. forname ("org. firebirdsql. JDBC. fbdriver ");
Connection conn = drivermanager
. Getconnection (
"JDBC: firebirdsql: FIG/3050: D: // fb_test.fdb? Lc_ctype = unicode_fss ",
"Sysdba", "masterkey ");
Int select;
Bufferedreader CIN = new bufferedreader (New inputstreamreader (
System. In ));
Statement cmd = conn. createstatement ();
String Param = NULL;
Do {
System. Out. println ("0: Exit ");
System. Out. println ("1: Insert ");
System. Out. println ("2: select all ");
System. Out. println ("3: Select like ");
Param = cin. Readline ();
Select = integer. parseint (PARAM );
Switch (select ){
Case 0:
System. Out. println ("system exit ");
Break;
Case 1:
System. Out. println ("Enter the data to be inserted :");
Param = cin. Readline ();
Param = "insert into AA (bb) values ('" + Param
+ "')";
System. Out. println (PARAM );
If (cmd.exe cuteupdate (PARAM )! = 0 ){
System. Out. println ("executed successfully ");
} Else {
System. Out. println ("failed to execute ");
}
Break;
Case 2:
System. Out. println ("output all data :");
Resultset rs = cmd
. Executequery ("select * from AA ");
While (Rs. Next ()){
System. Out
. Println (RS
. Getstring ("BB "));
}
Break;
Case 3:
System. Out. println ("Enter the data to be queried :");
Param = cin. Readline ();
Param = "select * from AA where BB like '%"
+ Param. Trim () + "% '";
System. Out. println (PARAM );
Resultset RSA = cmd.exe cutequery (PARAM );
While (RSA. Next ()){
System. Out. println (RSA
. Getstring ("BB "));
}
}
System. Out. println ("======================== ");
} While (select! = 0 );
Conn. Close ();
}
}
Database creation statement:
Create Database 'd:/fb_test.fdb 'default Character Set utf8;
Create Table AA (BB varchar (255 ));