Tips and Tricks in a world of Mix

Archive for the ‘Oracle’ Category

Encrypt–Decrypt connectionString

public static void Encrypt(){

           Configuration objConfiguration = null;

           if(HttpContext.Current!=null)        //if we are in web application of some sort

               objConfiguration = WebConfigurationManager.OpenWebConfiguration (“~”);

           else       ///if not web

                objConfiguration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

           ConfigurationSection objSection = “connectionStrings”;

           //if encrypted already don’t do it again

           if(objSection!=null && !objSection.SectionInformation.IsProtected){

                           objSection.SectionInformation.ProtectionSection(string.Empty);

                           objSection.SectionInformation.ForseSave = true;

                          objConfiguration.Save(ConfigurationSaveMode.Full);

           }     

}

 

public static void Encrypt(){

                     Configuration objConfiguration = null;

                       if(HttpContext.Current!=null) //if we are in web application of some sort

                                   objConfiguration = WebConfigurationManager.OpenWebConfiguration (“~”);

                       else ///if not web

                                    objConfiguration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

                      ConfigurationSection objSection = “connectionStrings”;

                           //if encrypted then decrypt

                            if(objSection!=null && !objSection.SectionInformation.IsProtected){

         objSection.SectionInformation.UnprotectSection();

  //objConfiguration.Save();  – you can save the change but it will reset all the global data of your application in iis (relevant to comment it for web applications,can stay on in others)

}

}

Advertisements

Synonym of Oracle is missing– Is the Oracle False messiah ?!

After installing the ODT and updating it after to work with VS2012 to ODAC 11.2.0.3.20 with Oracle Developer Tools for Visual Studio on the same Oracle Client Home

I was able to create the EDMX model , but the synonyms stayed hidden to me on the wizard of the VS (by the way at VS 2010 also) .

The connection works perfect and gets me the regular tables , views and stored procedures .

The trouble is with the rest .

ScreenShot631

ScreenShot629

 

From my approach to Oracle I’ve got a couple of links and a statement that it’s Microsoft’s product that doesn’t support the import at the initialization wizard.

The links provided –

1) Make Entity Framework Designer support Synonyms  – we are not Code First – the schema exists and running

2)A problem to view synonym of Oracle in the Entity Data Model Designer – can’t see the synonyms , not with dba not with any user ..

 

Any ideas will be appreciated!

What ODP.NET version in ODAC 11.2.0.2.1 ?

station name

odp.net

oracle

os

Terminal1 tk

2.111.7.20

11g

Win 7 64bit

Server 1 tw

2.112.1.0

11g

Win Server 2008 R2  64 bit

Server 2 tt

1.111.7.0

11g

Win Server 2008  32 bit
 

2.111.7.0

   

Terminal 2 aa

1.111.6.20

11g

Win Xp Professional 32 bit
 

2.111.6.20

   

 

We are starting using TFS build templates  , so that we need to install the ODP.NET on the tfs server . So the most updated version for now to install is 2.112.2.0 I think.

I’ve found

32-bit ODAC 11.2 Release 3 (11.2.0.2.1) Installation Instructions, Setup, and Notes

December 2010

at your site .

What version of ODP.NET does it contain ?
What versions of the OS does it support?

What previous versions of ODP.NET does it support ?

 

Answer of Oracle team :

Best choice if OS Range is from XP to W2008R2 / W7 and both 32bit and 64bit software is used,ODP.NET 2.112.2 or higher should be used – since ODAC 11.2.0.2.1 exists for 32bit and 64bit Platformsand it supports .NET 2.x and 4.X this underlines the recommendation.

The only limitation is the used database – 11.2.0.X cannot access DB 9.2.0.4 and less and DB 10.2.0.1 – but since 9.2 is desupported since years and 10.2 will be in extends support in July 2011 this should not play a role.
Future Version of ODAC maybe 11.2.0.3 (maybe end of 2011) – or 12.1 (no target date) –
depending if there is a need for 11.2.0.3 ODP or not.

The ODP.NET nomenclature is
Oracle 9.2.0.X: ODP.NET 9.2.0.7
Oracle 10.1 / .NET 1.X : ODP.NET 1.101.X.Y
Oracle 10.1 / .NET 2.X : ODP.NET 2.101.X.Y
Oracle 10.2 / .NET 1.X : ODP.NET 1.102.X.Y
Oracle 10.2 / .NET 2.X : ODP.NET 2.102.X.Y
Oracle 11.1 / .NET 1.X : ODP.NET 1.111.X.Y
Oracle 11.1 / .NET 2.X : ODP.NET 2.111.X.Y
Oracle 11.2 / .NET 2.X : ODP.NET 2.112.X.Y
Oracle 11.2 / .NET 4.X : ODP.NET 4.112.X.Y

The X describe the patch set level – for example for 11.1.0.7 X=Y
And the Y describes a internal revision – ODAC and Full Client sometimes differed – for example Full Client Y=0 and ODAC = 20 etc..
Next, if there are 9.2 DB on the system I would suggest you lift the DB to 9.2.0.8 – or upgrade it to 10.2.0.5 since 9.2 is desupported since years
Installation of two ODP.NET can be done – but in that case you have to ensure that ORACLE_HOME and PATH is set correctly
before a specific app is started using a special ODP.NET

Oracle installation–tutorial , problems & solutions 11g ODT , ODAC 11.1.0.7.20 with Toad 10.6.1.3 on Windows 7

Installed ODTwithODAC1110720

image

 

Installed client with it : Log of it

 

Inventory contents of (Tzvi-PC/169.254.82.172):

Oracle Homes
OraClient11g_home1
Oracle Data Access Components for Oracle Client 11.1.0.7.20
Oracle Data Provider for .NET 2.0 11.1.0.7.20
Oracle Data Provider for .NET Documentation 11.1.0.7.20
Oracle Providers for ASP.NET 11.1.0.7.20
Oracle Data Provider for .NET 2.0 11.1.0.7.20
Oracle Data Provider for .NET Documentation 11.1.0.7.20
Oracle Providers for ASP.NET Documentation 11.1.0.7.20
Oracle Developer Tools for Visual Studio 11.1.0.7.20
Oracle Data Provider for .NET 2.0 11.1.0.7.20
Oracle Data Provider for .NET Documentation 11.1.0.7.20
Oracle Developer Tools for Visual Studio .NET Documentation 11.1.0.7.20
Oracle Provider for OLE DB 11.1.0.7.20
Oracle Objects for OLE 11.1.0.7.20
Oracle Services For Microsoft Transaction Server 11.1.0.7.20
Oracle Universal Installer 11.1.0.7.0
Installer SDK Component 11.1.0.7.0
Oracle One-Off Patch Installer 11.1.0.7.0
Installer SDK Component 11.1.0.7.0
Java Runtime Environment 1.5.0.11.0
Oracle Instant Client 11.1.0.7.0
Oracle ODBC Driverfor Instant Client 11.1.0.7.0
Oracle JDBC/OCI Instant Client 11.1.0.7.0
Oracle Globalization Support 11.1.0.7.0
SSL Required Support Files for InstantClient 11.1.0.7.0
RDBMS Required Support Files for Instant Client 11.1.0.7.0
SQL*Plus Files for Instant Client 11.1.0.7.0
——————————————————————————–
HOME SELECTION
——————————————————————————–
Central Inventory Location: “C:\Program Files (x86)\Oracle\Inventory”
——————————————————————————–
Oracle Home           Status
——————————————————————————–
OraClient11g_home1    Selected

——————————————————————————–
PATH = C:\app\Tzvi\product\11.1.0\db_1\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\app\Tzvi\product\11.1.0\client_1;C:\app\Tzvi\product\11.1.0\client_1\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Windows Live\Shared
——————————————————————————–

 

Installed DB – WindowsServer_x64_11g :

image

Problem :

“Oracle Database 11g is not certified on the current operating system.”

Solution : (more…)

Fluent NHibernate Sequence Strategy with Oracle

The environment :
Working with Oracle 10g.
At the mapping files of the FNH on the ID column define the sequence to work with.
This is a relevant sequence used by the relevant trigger used for the current table.
The db is a legacy db – using triggers to increment the records on the insert.
The problem :
When I save the record I’m getting back the record number. Well I’m getting the expected number +1 , every time . The record is being inserted and the record number jumps two times instead of one.
The solution:
In the trigger you must enter check to see if the new value is null , and only then increment the trigger . If it’s not null it means it was incremented by FNH already and there is no need to activate the increment in the trigger.

CREATE OR REPLACE TRIGGER DOAR_DEV.CUSTOMER_TRG1
BEFORE INSERT
ON DOAR_DEV.CUSTOMER REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
WHEN (
NEW.CST_RECID IS NULL
)

DECLARE
tmpVar NUMBER;
BEGIN
tmpVar := 0;

SELECT Customer_SEQ.NEXTVAL INTO tmpVar FROM dual;
:NEW.Cst_RecID := tmpVar;

EXCEPTION
WHEN OTHERS THEN
— Consider logging the error and then re-raise
RAISE;
END ;
/

Tag Cloud

%d bloggers like this: