VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.
Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig
by nolasco » Mon Apr 06, 2009 12:41 pm
I am trying to read double byte character strings (DBCS) from a table in an Oracle database (via Oracle ODBC driver). I can't seem to get instances of DBString from the DBCS fields, only instances of String. Below is the sample code I am using:
| connectionSpec conn querySpec resultTable row |
connectionSpec := AbtDatabaseConnectionSpec new
dbmClass: AbtOdbcDatabaseManager;
dsn: 'FINANCE';
promptEnabled: true;
yourself.
conn := connectionSpec connectUsingAlias: 'alias'.
querySpec := AbtQuerySpec new statement: 'select * from ps_vendor where setid = ''USA'' and vendor_id = ''0000046820'''.
resultTable := conn resultTableFromQuerySpec: querySpec.
row := resultTable first.
row at: #NAME2
Inspecting the code gives me '¿¿¿¿¿¿ ¿¿¿¿¿ ¿¿¿¿¿¿¿¿¿¿' for field #NAME2 instead of the expected Cyrillic result "Клевец Лилия Николаевна".
Is there something I need to do/set to get the right field value?
-
nolasco
-
- Posts: 6
- Joined: Tue Feb 20, 2007 2:02 pm
by tc » Tue Apr 07, 2009 8:59 am
Hello,
After the string is read from the DB, can you send the message 'asByteArray' to the string and post the byte array here?
Thanks.
--tc
-
tc
- Moderator
-
- Posts: 304
- Joined: Tue Oct 17, 2006 7:40 am
- Location: Raleigh, NC
by nolasco » Fri Apr 24, 2009 6:09 am
Oops! I forgot that I have left a post on this site about a problem that still has me stumped ...
***********
tc,
The byte array is [191 191 191 191 191 191 32 191 191 191 191 191 32 191 191 191 191 191 191 191 191 191 191]. As you can see, all the Cyrillic characters are being converted to "¿" (i.e. character 191).
Thanks.
-
nolasco
-
- Posts: 6
- Joined: Tue Feb 20, 2007 2:02 pm
by tc » Sat Apr 25, 2009 3:46 pm
Hello,
It seems the first issue is you will have to determine what language you are dealing with and add that code page to your abt.ini file.
I am also wondering if there is a DB issue. Even if a string does not display correctly, the bytes should be the same. The bytes would not be changed to 191 by ST for any reason I can think of. You need to make sure the DB connection has the proper NLS support. Read a string back using sql*plus to check this and/or get it working.
--tc
-
tc
- Moderator
-
- Posts: 304
- Joined: Tue Oct 17, 2006 7:40 am
- Location: Raleigh, NC
by nolasco » Fri May 01, 2009 11:21 am
WinSQL (using same ODBC driver as VS) returns the correct Cyrillic characters. As such, I am guessing the issue is on the VS side. Time to find the correct NLS setting.
-
nolasco
-
- Posts: 6
- Joined: Tue Feb 20, 2007 2:02 pm
by tc » Sat May 02, 2009 12:59 pm
Hello,
From Oracle.com:
- Code: Select all
select * from nls_database_parameters;
PARAMETER VALUE
------------------------------ ----------------------------------------
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET US7ASCII
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZH:TZM
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_NCHAR_CHARACTERSET US7ASCII
NLS_RDBMS_VERSION 8.1.7.0.0
. . . the NCHAR characterset in the database should be something that supports your other
characterset.
--tc
-
tc
- Moderator
-
- Posts: 304
- Joined: Tue Oct 17, 2006 7:40 am
- Location: Raleigh, NC
by nolasco » Fri May 22, 2009 6:39 am
We have it set as AL16UTF16, which should cover Cyrillic.
WinSQL returns the correct characters. But, Oracle's own SQLPlus, whether in Windows or Solaris, seems to return the same '¿¿¿¿¿¿ ¿¿¿¿¿ ¿¿¿¿¿¿¿¿¿¿' result as VA Smalltalk. As such, I am now even more confused.
The search for a solution continues ...
-
nolasco
-
- Posts: 6
- Joined: Tue Feb 20, 2007 2:02 pm
by benvandijk » Mon May 25, 2009 12:16 am
Hi,
I guess you are running sqlplus on a client machine, not on the database server.
In that case you should check the NLS_LANG settings on the ciient in the windows registry.
For more information on charactersets you can look at the oracle dosumentation: "Oracle9i Database Globalization Support Guide"
I am not familiar with solaris, but i assume there will be some client settings too.
Greetz, Ben.
-
benvandijk
-
- Posts: 45
- Joined: Sun Feb 25, 2007 7:14 am
- Location: Arnhem, Netherlands
Return to VA Smalltalk 7.0, 7.5 & 8.0
Who is online
Users browsing this forum: Yahoo [Bot] and 1 guest