| | |
Writing Unicode to Oracle
Please support our Oracle advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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.
Thanks in advance.
David Coorey.
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.
Oracle Syntax (Toggle Plain Text)
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 2:36 am. Reason: Keep It Organized - please use [code] tags
![]() |
Other Threads in the Oracle Forum
| Thread Tools | Search this Thread |
2009predictions acquisition amazon.com bartz bernanke cia citrix cloudcomputing crm database dell economy editor enterprise enterprise2.0 enterprisesoftware federalreserve forbes hp ibm intellipedia internet larryellison layoffs linux loughridge mediawiki michaeljackson microsoft neverland nortel notebooks oil operatingsystem oracle palm rimm saas salesforce sap seagate socialcomputing sql sun sybase technologystocks virtualiron virtualization vmware wiki wikipedia xen yahoo zoho





