开发者

Can Oracle encoding be set in connection-string?

开发者 https://www.devze.com 2023-01-19 11:06 出处:网络
My test-database has a AL32UTF8 encoding, however the production database has a WE8ISO8859P1 encoding. My application is writen in .NET and I use the default System.Data.OracleClient.OracleConnection

My test-database has a AL32UTF8 encoding, however the production database has a WE8ISO8859P1 encoding. My application is writen in .NET and I use the default System.Data.OracleClient.OracleConnection class to make the connection.

I create a IDbCommand and I add IDbDataParameter objects when I want to INSERT some strings with non ASCII symbols.

On the test database everything works well, apperently converting .NET's internal string format to AL32UTF8 works fine. However on production I just doesn't work. The .NET internal string representation (which is utf16) can't be converted to WE8ISO8859P1 somehow.

My question: Can you specify the database's encoding in the connection-string? Or is there ano开发者_如何转开发ther method to tell the driver (System.Data.OracleClient.OracleConnection) that the database expects a specific encoding?


The conversion should happend automatically as long as you don't use characters that cannot be represented in WE8ISO8859P1. If you have such characters, you cannot store it in the database anyway.

If you try to store the Euro sign (€), you'll be out of luck. It's not part of WE8ISO8859P1.

0

精彩评论

暂无评论...
验证码 换一张
取 消