For Programmers: Free Programming Magazines  


Home > Archive > Smalltalk > March 2008 > Unicode via ODBC in VW









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Unicode via ODBC in VW
gargoyle47

2008-03-15, 8:16 am

Need help!

I am trying to write a unicode character to an ODBC table in MS Access
2003.
The table (called Table1) is defined in Access as:-
col1 datatype Text (size 255)
col2 datatype OLE Object (long binary data)
col3 datatype Number (Long Integer)
I have tried changing col2 to be defined as datatype Text and also as
datatype Memo (can store up to 65,535 characters).

To obatin the unicode character I am using:-

u := UnicodeCharacterEncoder new.
crypt := u decode: 260. "or can use any other number exceeding ASCII
255"
myWriteStream := WriteStream on: (ByteString new: 10). "have also
tried TwoByteString"
myWriteStream nextPut: crypt.

which works okay and produces the desired unicode character.

I then use a binding table input template:-
tempTable1 := Table1 new. "used for binding instance values to the
database"
tempTable1 col1: 'an inserted line 2'.
tempTable1 col2: myWriteStream contents.
tempTable1 col3: 9999.
myWriteStream close.

which works okay.

However, when I try to write out the data using...

connection := ODBCConnection new.
rowsAffected := nil.
connection environment: 'FILEDSN=GJDACCESSDB1;DBQ=C:\Program Files
\Cincom\vw7.5nc\image\db2.mdb;UID=NonSec;PWD=NonSec'.
connection connect.
session := connection getSession.
session prepare: 'INSERT INTO Table1 (col1, col2, col3) VALUES
(:col1, :col2, :col3)'.
session bindInput: tempTable1.
session execute.
rowsAffected := session rowCount.
session := nil.
connection disconnect.
connection := nil.
^rowsAffected

I receive the error: "Unhandled exception: No character available for
character value 260."
It is the "session execute" line that causes the error.

Obviously this cannot handle the code conversion, but I am lost as to
how this can be done.
Being new to VW I need help in resolving this error.
(I can write unicode data to a BOS file, so I know I'm doing something
wrong in the ODBC area;
I can also write non-unicode data to the database, so it's definitely
a unicode translation issue)


I am using:-
Access 2003
Windows XP Home
Cincom vw7.5nc

The File DSN ("GJDACCESSDB1.DSN") is as follows:-
[ODBC]
DRIVER=Microsoft Access Driver (*.mdb)
UID=ignore
UserCommitSync=Yes
Threads=3
SystemDB=G:\Garys Docs\Database\GJDSYSTEM.MDW
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=MS Access
DriverId=25
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com