i have application .net 4.0 , ef6 working ok sql server, , now, need use oracle bd in same way. have model in proyect 5 tables , when connect proyect db migrations add news tables in it.
now, put reference oracle.
oracle.dataaccess.dll oracle.dataaccess.entityframework oracle.manageddataaccess.entityframework and put in web.config
<section name="oracle.manageddataaccess.client" type="oracleinternal.common.odpmsectionhandler, oracle.manageddataaccess, version=4.121.2.0, culture=neutral, publickeytoken=89b483f429c47342"/> i using conn string
<add name="chatcontext" connectionstring="data source=serversql; initial catalog=database;uid=user;password=pass;" providername="system.data.sqlclient"/> now i'm trying with
<add name="chatcontext" connectionstring="data source=(description=(address=(protocol=tcp)(host=oracleserver)(port=1521))(connect_data=service_name=oracledb)));user id=user;password=pass;" providername = "oracle.manageddataaccess.client"/> i had "chatcontext" db in documents , delete migrations generate new context file.
when try ejecute code in have error:
an error occurred accessing database. means connection database failed. check connection string correct , appropriate dbcontext constructor being used specify or find in application's config file. i generate new mvc proyect check if conn string ok, , connect db, , is.
<add name="entities" connectionstring="metadata=res://*/model1.csdl|res://*/model1.ssdl|res://*/model1.msl;provider=oracle.manageddataaccess.client;provider connection string="data source=oracledb;password=pass;persist security info=true;user id=user"" providername="system.data.entityclient" /></connectionstrings>
i think need change connection string this:
"data source=(description=(address=(protocol=tcp)(host=oracleserver)(port=1521))(connect_data=service_name=oracledb)));user id=user;password=pass;" ... instead:
"data source=oracledb;user id=user;password=pass;" the data source needs set service name.
Comments
Post a Comment