aspnetdb.mdf and Microsoft.ACE.OLEDB.12.0 - asp.net-mvc-2

I'm trying to run my asp.net application on a windows machine (XP SP3, Vista, 7) which has only Microsoft.ACE.OLEDB.12.0 as the database engine installed and need to connect to the standard aspnetdb.mdf user database.
Does any one know it is possible to use a connection string that works with mdf files in such a condition? I used connection strings like this but no success yet:
connectionString = "provider=Microsoft.ACE.OLEDB.12.0;Data Source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true";
Thanks

Try one like this:
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\aspnetdb.accdb;Persist Security Info=False;
For more connectionstrings, go to http://www.connectionstrings.com/access-2007
EDIT: It's not possible to connect to a Sql Server database using OleDB. Install SQL Server (Express) instead.

Related

Entity Framework - I want the database to be created on a different SQL Server

My EF tutorial project works fine on a machine with SQL Server installed, but when I move the project to a machine with no SQL Server installed, the code below fails:
Database.SetInitializer(new DropCreateDatabaseAlways<EmployeeDb>());
I'd like to get the project working on a machine which has only the SQL Server client not the server. I've experimented with connection strings in app.config without success. Help much appreciated.
you have install SQL server in separate machine and configure to connect from other systems and put that machine name(or IP address) in connection string.
Configure the Windows Firewall to Allow SQL Server Access
how-to-enable-remote-connections-in-sql-server-2008

Access oracle database from another system?

Is it possible to access my oracle database from a separate system, other than the one on which the database is stored?
If yes, then how?
You can access the tables of a distant database by using your_table#your_database if you configured it properly.
Yes you can access your database which is on one machine( SERVER) from other machine (CLIENT). You need to install oracle client software on the CLIENT machine and then you can establish a connection to the server database through network . You have to use sqlplus to connect or if you are using windows then you can use tools like toad which will establish a connection between your client machine and database server machine .

How to connect a Windows forms application to a SQL Server database through a lan network?

I have written a Windows forms application in vb.Net (Visual Studio 2010) and my form is completely connected to a SQL Server 2008 database. All things are true when using my program in my machine but when I try to run it by other systems in the network the following error occur:
A network -related or instance -specific error occurred while establishing a connection to SQL
server. the server was not found or was not accessible......
I have installed framework.net3.5 and Microsoft SQL Native Client
But do not any special settings .
Please help me I need some basic helps because its my first time to do some things like this.
thanks
Connection string is:
<add name="Mosalasbandi.My.MySettings.Contorol_FaniConnectionString"
connectionString="Data Source=Ehsan-PC;Initial Catalog="Contorol Fani";Integrated Security=True"
providerName="System.Data.SqlClient" />
connection string as follows
String connstr=#"Data Source=tcp:196.211.164.122\ABC\SUTSVR,1433;Initial Catalog=pubs;User ID=sa;Password=OOPS";
note:
196.211.164.122 remote machine and 1433 port number
ABC is name of the server/workstation that your sql instance live.
SUTSVR is name of the sql instance
in addition to above make it sure that the your Sql instance configure to access remote computer.
good luck!!!!

How to check remote Oracle server is up and running

I have my Oracle server installed in a remote machine and I want a script at my local machine which will check whether Oracle server is up and running or not. I know this can be check by creating a connection through sqlplus or JDBC. But in this case oracle client won't be present and I am saving JDBC approach as my last option. So is there any other simpler way to check this, which can be easily implemented in a shell script???
Thanks
Not really. The only way to be certain that the database is responding to queries is to run a query on it, such as the venerable:
select dummy from dual

Unable to run my app again after opening my database with the Server Explorer

I successfully use EF4 to build my database from scratch. My database is an SQL EXPRESS database file. I can manage this one with Sql Server Management Studio. So far so good.
I noticed that if I open my database with the Server Explorer in Visual Studio, the next time I run the application I got errors.
I also noticed that a new log file has been created. So now I have 2 log files.
Below is my connectionstring:
<add name="DocumentManagerEntities"
connectionString="data source=.\SQLEXPRESS2008;Initial Catalog=DocumentManagerDB;AttachDBFilename=|DataDirectory|DocumentManagerDB.mdf;Integrated Security=SSPI;MultipleActiveResultSets=True"
providerName="System.Data.SqlClient" />
What's wrong?
Thank you very much.
That maybe because multiple applications are trying to use your database at once. You need to close one connection to open another.
This article notes that
SQL Server Express Edition allows only a single connection to an .mdf
file when you connect with a connection string that has User Instance
set to true.
Further more
When you connect to a local database project, Visual Web Developer
connects to the SQL Server Express Edition database with user
instances enabled, by default. For example, the following code example
shows a typical connection string used by Visual Web Developer to
connect to a SQL Server Express Edition database.