Chinese 1. The first way: take Java applet-> socket-> Java application-> database for example:
byte[] buff = new byte[512]; You are happy with the buffer size.
Socket sock =//here do the initialization of the socket work.
ResultSet rs =//Here do the initialization work of the ResultSet.
DataOutputStream dataout =
New DataOutputStream (New Bufferedoutputstream (Sock.getoutputstream ()));
InputStream in = Rs.getasciistream (Column_index); Column_index = Column number.
for (;;) {
int size = In.read (buff);
if (size = = 1) break;
Dataout.write (buff, 0, size);
}
Dataout.flush ();
So that we can send Chinese to the past.
2. The second method: Change the sixth line to
InputStream in = Runtime.getruntime (). Getlocalizedinputstream (Rs.getasciistream (column_index)) try.
3. Because Getlocalizedinputstream () has become the deprecated method in JDK1.1, it may no longer be applicable to the new JDK version. It is suggested that BufferedReader be substituted instead.
For example: BufferedReader br = new BufferedReader (New InputStreamReader (Rs.getasciistream (Column_index)));
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.