[Pgcluster-general] about PGCluster deal with detail report of chinese question (still JDBC Driver question)
Sun.betty
alanxzq at yahoo.com.cn
Wed Jan 24 08:08:34 UTC 2007
PGCluster Team:
How are you !
assume have two machine:
cluster1 (only Cluster DB Server)
and
cluster2 (Cluster DB Server and Replication Server)
createdb -E EUC_CN tc1
createlang -d tc1 plpgsql
$ psql -l
List of databases
Name | Owner | Encoding
-----------+---------+-----------
postgres | test | SQL_ASCII
tc1 | test | EUC_CN
template0 | test | SQL_ASCII
template1 | test | SQL_ASCII
(4 rows)
for testing chinese process question :
test instance 1). use pure C program pgbench , ODBC Driver
cd pgcluster-1.5.0rc13/contrib/pgbench
modify file : pgbench.c
vi pgbench.c
about 656 rows
modify from
snprintf(sql, 256, "insert into tellers(tid,bid,tbalance) values (%d,%d,0)"
to
snprintf(sql, 256, "insert into tellers(tid,bid,tbalance,filler) values (%d,%d,0,'壹贰叁肆伍陆柒捌玖拾')"
save change to file. then:
make clean
make
make install
pgbench -i tc1
see data :
psql tc1
select * from tellers ;
deal with chinese haven't question. all is OK!
((1). at cluster1 db exec , data is sync to cluster2
(2). at cluster2 db exec , data is sync to cluster1)
test instance 2)test command line process:
psql tc1
CREATE SEQUENCE seq_tid1
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 100000
CACHE 1;
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹');
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹贰');
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹贰叁');
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹贰叁肆');
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹贰叁肆伍');
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹贰叁肆伍陆');
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹贰叁肆伍陆柒');
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹贰叁肆伍陆柒捌');
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹贰叁肆伍陆柒捌玖');
insert into tellers(tid,bid,tbalance,filler) values (nextval('seq_tid1'),nextval('seq_tid1'),0,'壹贰叁肆伍陆柒捌玖拾');
select * from tellers ;
deal with chinese haven't question. all is OK!
((1). at cluster1 db insert data is sync to cluster2
(2). at cluster2 db insert data is sync to cluster1)
test instance 3) use java program JDBCBench.java , JDBC Driver
because JDBCBench.java only insert data in table tellers at init ,so we create a new database use:
createdb -E EUC_CN tc2
createlang -d tc2 plpgsql
modify file JDBCBench.java :
about 240 rows
modify from :
Query = "INSERT INTO tellers(Tid,Bid,Tbalance) VALUES (" + i + "," + i / ntellers + ",0)";
to
Query = "INSERT INTO tellers(Tid,Bid,Tbalance,filler) VALUES (" + i + "," + i / ntellers + ",0,'壹贰叁肆伍陆柒捌玖拾')";
save change to file,then compile with:
javac -encoding gb2312 JDBCBench.java
then, on cluster1 db side , exec with:
java -classpath .:./postgresql-8.1-407.jdbc2.jar JDBCBench -driver org.postgresql.Driver -url jdbc:postgresql://127.0.0.1:5432/tc2?user=test -v -init -tpc 1 -clients 1
(1). chinese data was inserted into tc2 of cluster1 db side.
but data isn't sync to tc2 of cluster2 db side.
(2).if that java program JDBCBench.java exec at cluster2 db side.
then data was inserted into tc2 of cluster2 db side,
but data isn't sync to tc2 of cluster1 db side.
and at cluster2 db side : report error:
ERROR: invalid byte sequence for encoding "EUC_CN": 0xe58f
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
ERROR: invalid byte sequence for encoding "EUC_CN": 0xe58f
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
A:
I have modifyed parameter : client_encoding = euc_cn (both of cluster1 and cluster2) question also like above.
Hope can resolve that question, deal with chinese , can't exec correctly.
It's badly to perfect of PGCluster. Please care this question.
Sincerely regards
-------------------------
Betty
---------------------------------
雅虎免费邮箱-3.5G容量,20M附件
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://pgfoundry.org/pipermail/pgcluster-general/attachments/20070124/0f0a6f7e/attachment.html
More information about the Pgcluster-general
mailing list