RSS Forums RSS

Writing Unicode to Oracle

Please support our Oracle advertiser: Programming Forums
Reply
Posts: 1
Reputation: dcoorey is an unknown quantity at this point 
Solved Threads: 0
dcoorey's Avatar
dcoorey dcoorey is offline Offline
Newbie Poster

Writing Unicode to Oracle

  #1  
Nov 2nd, 2008
Hi All,

I am having problems trying to write unicode characters to a version 10 Oracle database, using C++ and OLE DB (the same code works with MS SQL). If I insert a unicode string directly from PL SQL it works, otherwise I get nonsense when trying from my code. I have set ORA_NCHAR_LITERAL_REPLACE to true in the registry on the Oracle server, which I believe is a requirement. I would really appreciate any suggestions or help here. The code I am using is as follows.

void CAGROracleTestHarness::Connect()
{
 CoInitialize(NULL);

 m_dsDBSource = new CDataSource();
 m_csConnection = new CSession();
 m_pcmdStatement = new CCommand<CDynamicAccessor>;

 CDBPropSet ConnectionProperties(DBPROPSET_DBINIT);

 ConnectionProperties.AddProperty(DBPROP_INIT_DATASOURCE, m_sServer);

 ConnectionProperties.AddProperty(DBPROP_AUTH_USERID, m_sUserID);

 ConnectionProperties.AddProperty(DBPROP_AUTH_PASSWORD, m_sPassword);

 ConnectionProperties.AddProperty(DBPROP_INIT_CATALOG, m_sDatabase);

 ConnectionProperties.AddProperty(DBPROP_INIT_PROMPT, (short)DBPROMPT_NOPROMPT);

 m_dsDBSource->OpenWithServiceComponents(m_sProvider, &ConnectionProperties));

 // Open the connection.
 m_csConnection->Open(*m_dsDBSource);
}

void CAGROracleTestHarness::Execute()
{
 Connect();

 CDBPropSet ConnectionProperties(ORAPROPSET_COMMANDS);
 ConnectionProperties.AddProperty(ORAPROP_NDatatype, true);

 HRESULT hResult = m_pcmdStatement->Open(*m_csConnection, _T("UPDATE client SET  
                                      comments = N'文本的' WHERE id = 2"), &ConnectionProperties);
}

Thanks in advance.

David Coorey.
Last edited by peter_budo : Nov 3rd, 2008 at 1:36 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Views: 718 | Replies: 0 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 10:07 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC