mercredi 1 avril 2015

How do I set my Oracle session's globalization to be the same as my current thread in .NET?

For example, it would be great if I could do the following:



private void SetSessionGlobalization(Oracle.DataAccess.Client.OracleConnection aConnection)
{
System.Globalization.CultureInfo lCultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
aConnection.SetSessionInfo(lCultureInfo);
}


But that does not work because SetSessionInfo takes a OracleGlobalization class as a parameter, not a CultureInfo!


And this does not work either:



private void SetSessionGlobalization(Oracle.DataAccess.Client.OracleConnection aConnection)
{
Oracle.DataAccess.Client.OracleGlobalization lClientGlobalization = Oracle.DataAccess.Client.OracleGlobalization.GetClientInfo());
aConnection.SetSessionInfo(lClientGlobalization);
}


Because GetClientInfo gets Oracle's version of the client globalization settings, not Windows.


What am I missing here? How do I set my database connection session to be the same as that used by my thread?


Aucun commentaire:

Enregistrer un commentaire