I have created a windows forms application using Visual C# and ms acces 2007. The connection string to the database from the application looks like this.
<connectionStrings>
<add name="CRMS.Properties.Settings.CRMSConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\CRMS.accdb"
providerName="System.Data.OleDb" />
</connectionStrings>
I have devloped both the database and windows forms development on a single pc.
I need to deploy this application on LAN with 8 pc's. The database will reside on the central pc with ip address 192.168.1.10. The windowsforms application will be installed on all the pcs including the pc on which the database file resides on. What are the steps i need to complete for a smooth and efficient deployment?
You'll need to set up a network share that is hosting the access database. Then you'll have to point to either the UNC path of that shared file:
<connectionStrings>
<add name="CRMS.Properties.Settings.CRMSConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\192.168.1.10\ShareName\CRMS.accdb"
providerName="System.Data.OleDb" />
</connectionStrings>
or using mapped drives "Z:\CRMS.accdb".
You might consider using the DNS name of the computer instead of the IP address so you don't have to change the connection string on each of the client computers if / when the IP address changes.
Of course, I would be remiss in my duties if I didn't point out that running Access over the network is painful from a performance and maintenance standpoint. I would consider importing your database into an actual network database such as SQL Server Express or MySQL (both free) for better performance and reliability.
Related
There are dozens of questions like this but none of them resolve this issue.
I have created WinForm application using entityFramework modelFirst approach. I have deployed it using InstallShield and it works perfectly fine.
I have been using VisualStudio server explorer for all database related work, not SQL server Management studio.
Questions
What I simply want is how can I make its database centralised
through out the LAN network?
One computer will act as server and
will contain that application too, others will just have application
and use database from server. Do I have to make two builds? or what
do I do?
In-case of change in IP address of server of location of
database at server? Shall it require new deployment or just some
changes in connection string?
Shall it require some changes in code
as well to handle exceptions in case of server no-response or
anything?
Kindly elabore with steps and process, whatever you are suggesting as I am very new to this.
The general way to do this is to have a ConnectionString that points to the machine running the server. The machine name is used, not the IP address.
I have a WPF application where I use Entity Framework for interacting with the database that is on SQL Server Express on my machine. I'm reasoning on small projects where data will not be huge and then I don't want to install SQL Server Express on client's machine for two reasons:
installation takes a long time
these projects must be executable on computers with low hardware specs (installation of SQL Server takes too much time)
I tried installing LocalDB on client machine, created default instance and started
The problems are two:
how to reconfigure app.config file making Entity Framework connecting to database? (in development environment connection string is SQL Server style)
where to put database files? (user's profile root?)
Am I following the correct way? I know only two way to do this, installing SQL Server Express or using LocalDB the may be a third way?
You can set up your app.config file as follows (just replace "C:\Database.mdf" with the full path to your database):
<connectionStrings>
<add name="NameOfConnectionString" connectionString="data source=(LocalDB)\v11.0;attachdbfilename=C:\Database.mdf;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
</connectionStrings>
But with this you will end up having always the same static connection string.
Perhaps you want to store you database rather in some user folder.
This will get a sub folder of the users documents folder at runtime:
string folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "MyAppsFolder");
If you want to deploy the local db to the users machine, you might want to create a installer project for this. See here
The alternative would be to install some version of SQL-Server on the client machine.
If it is possible that one the client site you will have more than one concurrent user you will have no other choice.
Difference between local db and SQL-Server express
If you need more information on the usage scenarios of local db and SQL-Server express, check out this question and answers.
This MSDN Site has also a bunch of information on LocalDB.
I have a web site app running on IIS 7.5 that access a LocalDb, all installed on same server.
Using SSMS, I can see the app db folder in the object explorer but when I try to expand it, I get an error saying that the database is not accessible. If I stop the web site in IIS then I can access it.
Is there a way that I can work on the database in SSMS simultaneously while the clients are accessing the web app ?
I log in the SSMS as administrator using Windows authentication. The web app log in as "IIS AppPool\AutoParkDemo" using the ApplicationPoolIdentity.
<connectionStrings>
<clear />
<add name="AutoPark" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=AutoParkDemo;AttachDbFilename=C:\AutoPark\Demo\Data\AutoParkDemo.mdf;Integrated Security=true" providerName="System.Data.SqlClient" />
</connectionStrings>
IIS server needs to have exclusive access to local db file, that is the main reason you can't access to database using SSMS.
In theory you could have read-only access to local db while IIS is running on background. I use often Visual Studio and IIS, and I can access local db while web server is running.
I believe SSMS needs write access to works with local db. This could be the reason why VS can read and SSMS not.
What I have found out is that each application that access LocalDB simultaneously, must have its own shared instance. There is a good tutorial about it on MS site, but the problem is that if there is no activity the shared instance stops and, although I read on Microsoft website that it will restart automatically, it didn't happen to me. After struggling for couple weeks, I decided to use the suggestion from other post on this site: When deploying to a web site with IIS, use SQLExpress instead. It now works perfectly.
Does anyone know if there's a tool out there which allows you to run queries against a SQL Server database through a web browser (e.g. SSMS functionality available through the browser)?
I ask as we have a large support team who rely heavily on running database queries when investigating issues. As our data center (where the DBs are hosted) is based remotely from our offices, and many of our support staff are working offshore over VPN it's helpful to allow them to access a client hosted at the data center. One solution would be to host SSMS on a terminal server, but having a web front end would be more straight forward, should one exist.
You may like sqlpad.
It's a Node.js web app for writing and running SQL queries and visualizing the results. Supports Postgres, MySQL, SQL Server, Crate and Vertica.
It has many contributors and it's being kept up-to-date.
IIS / iisnode specifics
You may be using IIS with iisnode. That's working too. You only need to alter the port config in /lib/config.js line 12 to use process.env.PORT.
When you want to use Google Authentication. You need to have this in your web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="GOOGLE_CLIENT_ID" value="..." />
<add key="GOOGLE_CLIENT_SECRET" value="..." />
<add key="PUBLIC_URL" value="https://example.com" />
<add key="DISABLE_USERPASS_AUTH" value="true" />
</appSettings>
</configuration>
PS: The last key is optional for when you want to only allow google logins
None from Microsoft but there are 3rd party tools available, such as myLittleAdmin.
You are wanting something like SQL Web Data Admin.
It does not provide all the features of SSMS but it does enough to be able to support/manage the sql server remotely.
There are other tools that are based of this project on codeplex that add additional functionality.
I have my ASP.NET MVC 3 project with a local database stored in /App_Data directory. This db is SQLExpress file (*-mdf).
I have my connection string working perfectly in my development CPU, the Connection String is:
data source=.\SQLEXPRESS;initial catalog=CFCBBSecurity;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\MYFILE.mdf;User instance=true" providerName="System.Data.SqlClient"
When I upload it to Azure, using VS 2010, all files are in the server, but the application cannot access the Database.
What should I do, change or update?
Thanks in advance.
The problem is that you're referencing a local SQL instance (.\SQLEXPRESS, the 'dot' stands for localhost). I'm assuming you are running SQL Server 2005/2008/2012 Express on your machine and that's why this works locally.
But when you deploy your application to Windows Azure, there's no SQL Server installed on that Web Role/Worker Role/Web Site (this would be a bad idea anyways because Web/Worker Roles are not persistent!).
What you'll need to do is sign up for a 'cloud database' like SQL Azure and use that. Or you could host it yourself in a Windows Azure Virtual Machine (which is IaaS, but this involves more work).
If you're building an MVC 3 application I would suggest you simply start with SQL Azure. Here is a tutorial: Running ASP.NET MVC 3 Applications on Azure (note that this tutorial contains screenshots of the old portal).