I'm a starter in Oracle, I want to use Entity Framework to connect to my Oracle database.
I first installed Oracle 11g R2 and get this and then I install NetManager and create new Service Name
Then, I go to Visual Studio and create a new model but wWhen I want to create a connection it gives me an error message.
Please help me. thanks all
It had happened me once. In your Oracle home directory there must be two folder in directory C or D:\app\user\product\11.2.0:
Names of folder must be smth like that:
client_1 and dbhome_1
There must be tnsnames.ora in \client_1\Network\Admin\Sample. If not, create one. Then first of all delete all texts in this file and copy this to that file:
orcl=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.77.31)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))
Instead orcl you will write your data Source. Also for host and port number. And Service name.
It must work. If not copy tnsnames.ora and listener.ora to \client_1\Network\Admin.
And test it again.
Related
We are working on an MVC application, I added the connection string and generated the data models. When I update the model from database in the .edmx file it updates the web.config file and I check it in TFS. When other other people get latest version from TFS, they see the connection but when they go to the .edmx file it has update the model from database grayed out? is there any way to fix this?
First, make sure your colleagues are opening the project which in source control in VS, not the local one.
Another thing is going into the workspace and change the local path not containing '#' character. More detail info about this, please take a look at this thread: Entity Framework Unable to refresh database tables under TFS 2010
My Visual studio, on opening a certain project, builds so fast but takes forever to start running. I searched and found it is saying something like: "Adding a synonym to the database project" is the root cause.
I tried to re-add the data connection from Server Explorer. However, there used to be a long dropdown list to select the Data Source Name, but now only (local Database).....
Could anyone help please....
There are 3 oracles installed on my VM.... and the one I am using, it actually maps to a version which does not have C:\oracle\product\11.2.0\client_1\network\admin/tnsnames.ora and another file.
I got a new VM machine, and it's solved.
I am building a C# windows application using sql server 2005 and visual studio 2008.
To deploy the application on clients computer. I do this this in this order
I install the sql server 2005 with the same user/pass (ie sa/pass) i made in my app.
I run my windows application msi file. It install my databasae in sql server 2005.
when I try to run the application I fail due to different machine name and sql server instance name on my clients computer. i am getting error in connection string. i need a way to extract the target computername and sql server instance and save the same in my application setting during deployment (using in my c# code so that i can make a connection string at runtime.)
To resolve the problem what i am doing is I am installing visual studio on my client's computer and editing the source code to change the machine name and sql server instance. Then my windows application runs. I don't want to resolve my problem this way but rather need a way where i can set my parameters at deployment time or leave it up to you to suggest a better way.
I would request you to help me.
Google will give you lot of options. Have you followed the right steps while copying a database.
Follow these links http://blogs.msdn.com/b/sreekarm/archive/2009/09/11/move-a-database-from-one-server-to-another-server-in-sql-server-2008.aspx
and this will answer yours DBA Stack Exchange
Also post the Exact error message you get.It ll be useful to figure out the issue
Using SQL CE will require a lot of rework.
The full install order is:
Install Windows Installer 3.1 (if its not installed)
Install .Net 2.0 (if its not installed)
Check if SQL is NOT already installed:
HKLM "SOFTWARE\Microsoft\Microsoft SQL
Server\${instance_name}\MSSQLServer\CurrentVersion" "CurrentVersion"
Then you need to install SQL Server:
${installer_path}\SQLEXPR.exe -q /norebootchk /qn
reboot=ReallySuppress addlocal=all INSTANCENAME=${instance_name}
SAPWD=${password} SECURITYMODE=SQL SQLBROWSERAUTOSTART=1
SQLAUTOSTART=1 AGTAUTOSTART=1 ASAUTOSTART=0 RSAUTOSTART=0
DISABLENETWORKPROTOCOLS=0 ERRORREPORTING=1 SQMREPORTING=0 ENABLERANU=0
ADDUSERASADMIN=1
To connect to the SQL Server instance use your data link properties dialog. You will need to give clear instruction to your users how to connect to the instance. eg
If you use the .\Instance_Name syntax where the "." dot represents the client PCs name that should solve the problem. Also use this in your connection string.
So, if I understand you correctly, you have hardcoded your connection string inside your source code. And of course, you have discovered at your expense how this is really a bad idea.
You need to have that connection string saved in your app.config file. In this way, when you install your application to your customer, you need only to change the config file and your code is ready to go.
To insert your connection string in your app.config:
right click on your project and select Properties, then go to the
Settings page. This will create a settings.settings file for your
project and will open a GUI editor for your properties.
Now insert a string in the column name (for example
testConnection)
Select from the Type column the ConnectionString type
Insert, in the value column, a connection string valid for your
development machine
Now if you open the app.config you will notice a new section called ConnectionStrings that will look like this:
<connectionStrings>
<add name="ProjectName.Properties.Settings.testConnection" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\temp\mytemp.mdb;User Id=admin;Password=;" />
</connectionStrings>
Now it is time to fix your code once and forever.
In every place where you have an hardcoded connection string replace that code with something like this
string constring = ConfigurationManager.ConnectionStrings["ProjectName.Properties.Settings.testConnection].ConnectionString;
And while we are here, check if the LocalDB version of SqlServer Express 2012 could be used to remove also the need to install SqlServer.
What is the easiest way to setup a test environment on my local machine using Visual Studio 2008 with a website that that has a mssql database, which is hosted through a webhost?
I am web designer and I am re-skinning a live website that is built in .NET C#. I have access to the files and when I run it in Visual Studio (localhost) only the static files are obviously pulling up , which is problematic for testing. I need to be able to run the entire website on my local. I am not going to be messing with the database at all, but I know that I am going to need it to be able to have a local copy that works. I am not extremely savvy on these types of things. I was hoping that someone could either point me in the right direction (ie. search terms, keywords) or give me some instructions on how to make this work. Any help is appreciated.
Thanks.
You should set up MSSQL server first. You can take backup from your production database using
RMC on DB -> Tasks -> Backup..
Then you use the generated .bak file on your local server to insert the copy of the database into your SQL Server instance like this:
RMC on Databases -> Restore Database -> Path to your backup..
At this step your instance should contain the database with all the tables and data. Next thing to do would be to change your web.config file connection string (or any place else, where the "Connection string" is set pointing the website to the database) accordingly to your instance. If it's MSSQLSERVER instance name, you can just use following connection string:
Data Source=(local);Initial Catalog=<database name>;Integrated Security=True;
After this compiling and running your source codes should be returning you the site in its fullest.
I'm building a web application that uses the Entity Framework. The files are located on a remote machine, the same is for the database and the web server.
In visual studio (2k8sp1), the path to the project is: \\Server\Web\XXXX
Now, I've generated the EF entities from the database, and later I've updated the database and added there a stored procedure.
When I wanted to update my model after that in visual studio, I was getting an error message that says:
An exception of type Systen.ArgumentException occured while attepting to update from the database. The exception message is: 'A relative path is not possible for files on different devices'.
Any ideas on how to update my model?
ps. I also cannot change my connection string in the EF model designer.
I think you might be using the Entity Framework incorrectly. The edmx files are source code, and should be treated as such. They should be added to your project, checked into source control, and edited locally on the development machine.
Try importing your model from your database into a local edmx and see if that works better for you.
You can also use EDMTools2 tool for update your EDM Schema like that. Also you can use this tools routines in your code it's open source. Just copy inside of your project and call some functions like create model, create code from model..
I hope this will be help to you