RE: Asking again - ResultSet.getString() & unicode
- From: "David Thielen" <thielen@xxxxxxxxxxxxx>
- Date: Mon, 19 Sep 2005 08:37:09 -0700
I can't find a way to attach but if you email me I'll email you back the
file. david@xxxxxxxxxxxx
--
thanks - dave
"Steven Cheng[MSFT]" wrote:
> Hi Dave,
>
> Since I haven't definitely reproduced the problem in my environment, it'll
> be hard for me to ask the dev guys or other SQL related support specialist
> to do some further research. Would you attach a simple test sqldatabase's
> mdf file to me so that I can test on my side to see whether I can reproduce
> the problem?
>
> 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: AcW5Raj0lD2dS+gDQRGxZ5H878wqiw==
> | 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>
> <181272BD-5477-4ECC-94C2-EF3D54A0C08F@xxxxxxxxxxxxx>
> <te8egO3tFHA.3160@xxxxxxxxxxxxxxxxxxxxx>
> <4EC5B775-37CA-4D32-8890-8F5DD6B0FFFD@xxxxxxxxxxxxx>
> <YXQ0hhPuFHA.768@xxxxxxxxxxxxxxxxxxxxx>
> | Subject: RE: Asking again - ResultSet.getString() & unicode
> | Date: Wed, 14 Sep 2005 09:02:08 -0700
> | Lines: 199
> | Message-ID: <D1BEA6E6-7BA6-46E1-ACFD-5A2712E40BFA@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:2709
> | X-Tomcat-NG: microsoft.public.sqlserver.odbc
> |
> | Hi;
> |
> | I stepped through the hibernate code. They call conn.createStatement()
> which
> | works for me too. The problem is when I call
> | conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
> | | ResultSet.CONCUR_UPDATABLE) - that then has the problem on calling
> | getString().
> |
> | If conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
> | | ResultSet.CONCUR_UPDATABLE) works for you then that is the difference
> | between our systems.
> |
> | Can you ask the JDBC team if they can reproduce this?
> |
> | --
> | thanks - dave
> |
> |
> | "Steven Cheng[MSFT]" wrote:
> |
> | > Hi Dave,
> | >
> | > I'm not sure what's the difference between our DB. But since you
> mentioned
> | > that the hibernate component can correctly process the Unicode data
> through
> | > the jdbc driver, I'd recommend you have a look at hibernate's code. Is
> it
> | > source available? If not, you can consider using some decompiler such
> as
> | > the Djava tool to decompile the related class file to see what's the
> | > difference between your code and hibernate's code.
> | >
> | > 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: AcW3lq1e/d65l1dpS2qrNVZsyl78fQ==
> | > | 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>
> | > <181272BD-5477-4ECC-94C2-EF3D54A0C08F@xxxxxxxxxxxxx>
> | > <te8egO3tFHA.3160@xxxxxxxxxxxxxxxxxxxxx>
> | > | Subject: RE: Asking again - ResultSet.getString() & unicode
> | > | Date: Mon, 12 Sep 2005 05:37:03 -0700
> | > | Lines: 116
> | > | Message-ID: <4EC5B775-37CA-4D32-8890-8F5DD6B0FFFD@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:2695
> | > | X-Tomcat-NG: microsoft.public.sqlserver.odbc
> | > |
> | > | Ok, here's some interesting results:
> | > |
> | > | First, please keep in mind that if I use hibernate
> (www.hibernate.org) I
> | > can
> | > | insert and select with no problems on my system. So I don't think
> it's a
> | > | configuration issue but instead some setting needed.
> | > |
> | > | If I add the N then it inserts fine. Obviously this doesn't help in
> the
> | > | select.
> | > |
> | > | If I create a database using BOPOMOFO for the collation, then if I
> insert
> | > | without the N, the chinese character inserts correctly, but the
> russian
> | > | character does not. The select still fails for both characters.
> | > |
> | > | So I think the answer for an insert is to use the N'unicode_string'
> as
> | > that
> | > | solves that problem. But to select, I still can't get it with
> | > | conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
> | > | ResultSet.CONCUR_UPDATABLE)
> | > |
> | > | Any further ideas?
> | > |
> | > | --
> | > | thanks - dave
> | > |
> | > |
> | > | "Steven Cheng[MSFT]" wrote:
> | > |
> | > | > 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: Steven Cheng[MSFT]
- 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
- 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: Steven Cheng[MSFT]
- Asking again - ResultSet.getString() & unicode
- Prev by Date: RE: Asking again - ResultSet.getString() & unicode
- Next by Date: Optimize Linked Server to Oracle
- Previous by thread: RE: Asking again - ResultSet.getString() & unicode
- Next by thread: RE: Asking again - ResultSet.getString() & unicode
- Index(es):
Relevant Pages
|