[JDBC] complementarity for my JDBC Problem
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
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
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