1

i am writing to a oracle table using python script in spotfire. i am picking value from spotfire and inserting it to db using following part of script.

from Spotfire.Dxp.Data.Import import DatabaseDataSource, DatabaseDataSourceSettings, DataTableDataSource
objID = Document.Properties["OBJID"]
objectname = Document.Properties["ObjName"]
sqlIns = sqlIns + "insert into mytablename (OBJ_ID,OBJ_NAME) VALUES ('" + objID + "','" + objectname + "')" 
print sqlIns
dbsettings = DatabaseDataSourceSettings( "System.Data.OracleClient","Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xxxx.com)(PORT=1530))(CONNECT_DATA=(SID=xxx)));User Id=xxxx;Password=xxx",sqlIns)
ds = DatabaseDataSource(dbsettings)
newDataTable = Document.Data.Tables.Add("temp",ds)
Document.Data.Tables.Remove(newDataTable)  

This is working fine when values in OBJ_NAME is in English,when i am inserting OBJ_NAME in other languages such as korean data base is showing values like "¿¿¿¿¿¿ ¿¿¿ ¿ MD -¿¿¿". But when i printed above python code i can see that it displayed correct korean character. please see the image below.

enter image description here

But In oracle its not showing correctly. See screenshot of oracle table below enter image description here

As data type of OBJ_NAME in oracle is Nvarchar ,if i insert this Korean value from oracle itself ,it will insert correct Korean character.

J K
  • 165
  • 2
  • 14

1 Answers1

0

Can you try encoding to utf-8 in python script.

Leo
  • 868
  • 1
  • 13
  • 32
  • Hi Leo thanks for replying. Appreciate your help. Even though its not a direct method, i tried writing to db by encoding to utf-8 ( .encode('utf-8') ) in python script and then reading it back in spotfire by decoding back . But that work around also didn't work as expected. I am getting unsupported characters. – J K Mar 08 '17 at 09:25