RE: Asking again - ResultSet.getString() & unicode
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Mon, 12 Sep 2005 08:25:58 GMT
Hi Dave,
I still think the problem should be environment specific since on my local
environment, no matter I use
Statement stmt = conn.createStatement();
or
Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
I can get the unicode string correctly from sqlserver. Also, for inserting,
I can directly insert unicode in the following style:
"\u98a8";
What's your database's Collation setting? Though from my test , this
doesn't change the result, I think you can try set the collation to a
codepage which can correctly interpret the wide chars. In addition, in
T-SQL, when we inserting unicode string, it's recommended that we add "N"
Prefix for each string value, so you can try using the following insert
statement to see whether it can insert unicode correctly:
public static boolean InsertNewUser (String name, String email) throws
Exception{
Connection conn = getConnection();
String sql = "insert g_user values(N'" + name + "', N'" +
email + "')";
....................................
}
Hope helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Asking again - ResultSet.getString() & unicode
| thread-index: AcW1eMlyyC/Dmw/1QQyoC1z0+TfdCA==
| X-WBNR-Posting-Host: 199.45.247.98
| From: "=?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=" <thielen@xxxxxxxxxxxxx>
| References: <CEFAD23A-E1BA-479B-9923-511D6FDCE30A@xxxxxxxxxxxxx>
<7PGnYcEtFHA.1252@xxxxxxxxxxxxxxxxxxxxx>
<B25E4840-9D02-4372-A9FE-0DCD48456968@xxxxxxxxxxxxx>
<mrGDGPRtFHA.768@xxxxxxxxxxxxxxxxxxxxx>
<10F8AE17-DDB4-41B8-8D74-783D97E9E80F@xxxxxxxxxxxxx>
| Subject: RE: Asking again - ResultSet.getString() & unicode
| Date: Fri, 9 Sep 2005 12:58:03 -0700
| Lines: 10
| Message-ID: <181272BD-5477-4ECC-94C2-EF3D54A0C08F@xxxxxxxxxxxxx>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.sqlserver.odbc
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.sqlserver.odbc:2691
| X-Tomcat-NG: microsoft.public.sqlserver.odbc
|
| Sometimes a picture shows things a lot better so you can find your code
with
| some minor changes I made, and screen shots of the database at
| http://www.windward.net/jdbc2.zip
|
| Note that the first row I inserted by hand - it was not created by your
| program.
|
| --
| thanks - dave
|
|
.
- Follow-Ups:
- RE: Asking again - ResultSet.getString() & unicode
- From: David Thielen
- RE: Asking again - ResultSet.getString() & unicode
- References:
- Asking again - ResultSet.getString() & unicode
- From: David Thielen
- RE: Asking again - ResultSet.getString() & unicode
- From: Steven Cheng[MSFT]
- RE: Asking again - ResultSet.getString() & unicode
- From: David Thielen
- RE: Asking again - ResultSet.getString() & unicode
- From: Steven Cheng[MSFT]
- RE: Asking again - ResultSet.getString() & unicode
- From: David Thielen
- RE: Asking again - ResultSet.getString() & unicode
- From: David Thielen
- Asking again - ResultSet.getString() & unicode
- Prev by Date: Re: Problem with 64-bit ODBC code and SQLConnect and SQLWCHAR
- Next by Date: RE: Asking again - ResultSet.getString() & unicode
- Previous by thread: RE: Asking again - ResultSet.getString() & unicode
- Next by thread: RE: Asking again - ResultSet.getString() & unicode
- Index(es):
Relevant Pages
|