[JDBC] complementarity for my JDBC Problem

2001-10-18 Thread root

Hi,
I have forgoten, when use jdbc-7.0-1.1/1,2 it's ok for Chinese query.
Thanks

malix


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



[JDBC] problem with Chinese

2001-10-18 Thread root

Hi,
I have downloaded binary JDBC Driver from both postgresql.org and
jdbc.postgresql
it's version is jdbc7.1-1.2/jdbc7.1-1.1. It always give a message like this

Exception in thread "main" java.sql.SQLException: ERROR:ŸßUnterminated
quoted string

   ŸßŸßat org.postgresql.Connection.ExecSQL(Connection.java:533)
   ŸßŸßat org.postgresql.jdbc2.Statement.execute(Statement.java:294)
   ŸßŸßat org.postgresql.jdbc2.Statement.executeQuery(Statement.java:59)
   ŸßŸßat Test.main(Test.java:20)

I have also tride to rebuild the source code with
./configure --prefix=/opt --enable-locale --enable-multibyte=EUC_CN
--with-CXX -with-java -with-openssl=/usr
1)Ÿßfor JDBC it can complete compilation, but use JDBC with problem
2)Ÿßfor libpq--> input.c -->on_exit() :

gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations
-I../../../src/interfaces/libpq -I../../../src/include -I/usr/includeŸß-
c -o input.o input.c
input.c: In function `initializeInput':
input.c:157: warning: passing arg 1 of `on_exit' from incompatible
pointer type
input.c:157: too few arguments to function `on_exit'

3) my table customer is very simple : cno char(10),cname varchar(50)
my source code :

import java.sql.*;
import java.io.*;

class Test{
   ŸßŸßpublic static void main(String args[]) throws Exception {
   ŸßŸßŸßŸßŸßŸßSystem.out.println("input :");
   ŸßŸßŸßŸßŸßŸßBufferedReader in=new BufferedReader(
   ŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßnew InputStreamReader(
   ŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßSystem.in
   ŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸß)
   ŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸßŸß);
   ŸßŸßŸßŸßŸßŸßString t1=in.readLine(); //here i can enter some Chinese
string
   ŸßŸßŸßŸßŸßŸßSystem.out.println("your input are :"+t1);Ÿß
   ŸßŸßŸßŸßŸßŸßClass.forName("org.postgresql.Driver");
   ŸßŸßŸßŸßŸßŸßConnection dbconn=DriverManager.getConnection(
   ŸßŸßŸßŸßŸßŸßŸßŸßŸßŸß"jdbc:postgresql:redauto","postgres","");
   ŸßŸßŸßŸßŸßŸßStatement st = dbconn.createStatement();
   ŸßŸßŸßŸßŸßŸßString str_sql="SELECT * FROM customer where cname='"+t1+"'";
   ŸßŸßŸßŸßŸßŸßSystem.out.println(str_sql);
   ŸßŸßŸßŸßŸßŸßResultSet rs = st.executeQuery(str_sql);
   ŸßŸßŸßŸßŸßŸßwhile(rs.next()) {
   ŸßŸßŸßŸßŸßŸßŸßŸßSystem.out.println(rs.getString(1)+"\t"+rs.getString
(2)+"\n");
   ŸßŸßŸßŸßŸßŸß}
   ŸßŸßŸßŸßŸßŸßrs.close();
   ŸßŸßŸßŸßŸßŸßst.close();
   ŸßŸßŸßŸßŸßŸßdbconn.close();
   ŸßŸß}
}



I am shade to have disturbed you.
you are kind for me if you can give any sugestion.
Thanks very much.

malix
shanghai china


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Re: [JDBC] problem with Chinese

2001-10-19 Thread root

Hi all,
I am sorry , I have got the solution.
I should write it so:
   ŸßŸßŸßŸßŸßŸßClass.forName("org.postgresql.Driver");
   ŸßŸßŸßŸßŸßŸßProperties info=new Properties();
   ŸßŸßŸßŸßŸßŸßinfo.put("user","postgres");
   ŸßŸßŸßŸßŸßŸßinfo.put("password","");
   ŸßŸßŸßŸßŸßŸßinfo.put("charSet","GBK");
   ŸßŸßŸßŸßŸßŸßConnection dbconn=DriverManager.getConnection(
   ŸßŸßŸßŸßŸßŸßŸßŸßŸßŸß"jdbc:postgresql:redauto",info);
   ŸßŸßŸßŸßŸßŸßStatement st = dbconn.createStatement();
   ŸßŸßŸßŸßŸßŸßString str_sql="SELECT * FROM customer where cname='"+t1+"'";
   ŸßŸßŸßŸßŸßŸßSystem.out.println(str_sql);
   ŸßŸßŸßŸßŸßŸßResultSet rs = st.executeQuery(str_sql);

then all Chinese query critery is in order.

but the make error still harass me. if anyone can help me?

> 
> 
> 
> 
> I am shade to have disturbed you.
> you are kind for me if you can give any sugestion.
> Thanks very much.
> 
> malix
> shanghai china
> 



---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org