Hi,
We need to establish Session Parameters to Oracle databases for example:
ALTER SESSION SET NLS_COMP=ANSI
ALTER SESSION SET NLS_SORT=SPANISH
How could this be done?
In addition, we need to deal with SQL Server databases, so we need to establish also SET Options like:
SET LANGUAGE SPANISH
Must we need to build a factory pattern in this case or can EF establish Session Parameters or SET Options?
Thanks in advance,
Dominik.
Session Parameters
Thank you very much.
But I must deal with SQL Server databases also, so with this solution I should create a factory or some other solution.
Do you think I could be able to set these vaules using Language keyword in my connection strings? They are different for SQL Server and Oracle...
Thanks again,
Dominik.
But I must deal with SQL Server databases also, so with this solution I should create a factory or some other solution.
Do you think I could be able to set these vaules using Language keyword in my connection strings? They are different for SQL Server and Oracle...
Thanks again,
Dominik.
Ok,
At the moment I try to add "Current Language=us_english" to my Sql connection string and it sets the language option at Login.
But how can I set this Session Parameters for Oracle?
ALTER SESSION SET NLS_COMP=ANSI
ALTER SESSION SET NLS_SORT=SPANISH
I don't know what keyword values I must use in the connection string...
Thanks in advance,
Dominik.
At the moment I try to add "Current Language=us_english" to my Sql connection string and it sets the language option at Login.
But how can I set this Session Parameters for Oracle?
ALTER SESSION SET NLS_COMP=ANSI
ALTER SESSION SET NLS_SORT=SPANISH
I don't know what keyword values I must use in the connection string...
Thanks in advance,
Dominik.
I recommend you to execute the following code in the OnContextCreated method:
This code guarantees that the same StoreConnection will be used during context lifetime.
Code: Select all
DbConnection conn = (Connection as EntityConnection).StoreConnection;
if(conn.GetType().Name == "OracleConnection") {
conn.Open();
ExecuteStoreCommand("ALTER SESSION SET NLS_COMP=ANSI");
ExecuteStoreCommand("ALTER SESSION SET NLS_SORT=SPANISH");
}