SQL Server using SSH-tunnel from Visual Studio - sql-server

I recently contacted a web host regarding support for external database access to a Microsoft SQL Server database included in a package they offer. They replied saying that it is only possible with an SSH-tunnel.
Is it possible to connect to a SQL Server database in Visual Studio using an SSH-tunnel? It is important for me to be able to access the database from my local machine (for debugging, generating LINQ classes, editing tables, etc).
Or, how should I go about working with their database?

Accessing a database via an SSH tunnel works exactly the same as accessing any other database.
So, if you set up an SSH tunnel from the SQL Server machine to localhost:some_port, it's just about using that URL in Visual Studio.

Related

Deploying Windows application with SQL Server database

I have a WPF project and I will use SQL Server database. The instance of SQL Server IT created for me is SQL Server 13 (2016 standard version) on a remove server. When I’m deploying the application on a client’s computers, what version I need to install there as a prerequisite? Can I deploy SQL Server Express 2016 on a client’s computer and access the remove SQL Server Standard edition? I am looking for a simple solution and for a lighter version I need to install on the user’s computers. I cannot install a full SQL Server on each user.
I have searched the net and a similar question has been asked many times, but I didn’t find a clear answer before. Many people started their SQL Server experience using local type databases, like SQL Server CE or LocalDB. In this case specific DLLs and redistributables must be added with the installation program. It is hard to understand at the beginning, but when an instance of SQL Server is on a remote server, this is a different story. Everything is happening on this remote server. There is no need of any SQL Server instances on a client’s machine. Just a connection string must be added. The adapter or Entity Framework will take care of everything else.

What is the difference between DBMS and Database IDE?

I have been using Microsoft SQL Server 2017 for a while (just DDL and DML) and recently decided to install JetBrains DataGrip because I thought it was another DBMS but with dark theme.
When I try to create a new database it tells me to assign a host/user/password/port and I cannot do anything because it can't "connect to the database". I've been using Microsoft SQL Server Management Studio 2017 and never needed to assign a port/password/host or anything? I just created a new database and started adding/filling tables. How does JetBrains DataGrip work?
I noticed that on the JetBrains DataGrip page it doesn't say it's a DBMS, it says it's a "Database IDE". I cannot seem to find information about this on the web.
When considering a RDBMS such as SQL Server, the core component is a service/engine which acts as an interface between the database (files) and end users or applications allowing database functions to be carried out.
SSMS (SQL Server Management Studio) is just one of many possible end users of the SQL Server Database, and happens to have be part of the SQL Server software suite. It should not, however, be confused with the database itself as SQL Server operates perfectly happily without ever seeing SSMS.
Any form of user interface tool for a database needs to know how to connect to the database it is going to manage. In your case you most likely installed the entire software suite with default settings and as such didn't need to know what they were. JetBrains DataGrip however does need these settings.
You can find out what your specific settings are by running the SQL Server Configuration Manager.
JetBrains DataGrip is just a Database IDE to connect to different database engines via only one environment without needing to install management tools for every database that you want to work with.

How do I create an SQL Server?

I have a very fundamental and basic SQL question. Using Microsoft SQL Server Management Studio Express, how do I create my first Server? For that matter, how would I create it using any other required software tool?
I took a look at Sql Server Configuration Manager and I saw SQLEPRESS running as a SQL Server. But when I added that in to the start up widow for MSSM Studio Express, as the server name, it threw an error saying it cannot be found or does not exist. It seems that this is not the right kind of server.
To connect to the local instance of SQLEXPRESS, you will need localhost as the server name.
This is a fairly comprehensive guide on how to create a database once you have connected. All the steps won't apply to using SQL Express, but the gist of it is there.
In Object Explorer, connect to an instance of the SQL Server Database
Engine and then expand that instance.
Right-click Databases, and then
click New Database. In New Database, enter a database name.
To create
the database by accepting all default values, click OK; otherwise,
continue with the following optional steps.
Based on this comment:
Trying .\SQLEXPRESS in SQL Server Management Studio Express throws an error that says that "This version of Microsoft SQL Server Management Studio Express can only be used to connect to SQL Server 2005 servers". So this is the problem, I think.
.\SQLEXPRESS is the correct server name, but you have the wrong version of client tools (SQL Server Management Studio). To find out the version of SQL you are connecting to, there are a number of suggestions here: https://www.mssqltips.com/sqlservertip/1140/how-to-tell-what-sql-server-version-you-are-running/
But since you can't connect yet the easiest thing to do is go searching for sqlserver.exe, right click, properties, version. If you have multiple version you need take note of the folder that it's in and check the SQLExpress one. You can also check in services.
Once you've worked out the version, download and install just the management tools for that version.

Acessing Remote SQL Server from Visual FoxPro Application

Dear StackOverflow readers i would like your kind attention towards my one of the problem:
I have a Visual Foxpro application, in which i am accessing a remote SQL Server's Stored Procedure. Everything is working fine when I am installing the SQL Express 2008 in my Client Machine along with the FoxPro Application.
But when I am not installing the SQL Server On client Machine along with the visual FroxPro Application then I am getting a error " SQL Connect Error", Cannot Make Connection.
Is their any way that i don't have to install the whole SQL Express on client machine and i can only install the required libraries.
Regards
ProgChd
You should not have to install SQL Express itself, but at least ensure that you have the ODBC / OleDB providers for SQL Express. These can use SQL-Server connection which are somewhat common to already be on the machine.
As for your connection string, are you connecting via the fully qualified \server\database hosting information?
Just for grins, you could go through the machine's
Control Panel
Administrative Tools
Data Sources ODBC
and try to manually create an ODBC connection to the SQLExpress server you are trying to do via your VFP application. If you can't connect through that, then neither will VFP. Take the VFP app out of the equation and just test for the connection.

Asp.net MVC database connection setting in Visual studio 2008

I am trying to learn Asp.net MVC framework. I was looking at the video tutorial at the link below
http://www.asp.net/learn/mvc-videos/video-395.aspx
In this video the very first step is to add a new database to the example application.
I have visual studio installed on my development machine but the SqlServer Express is running on a different machine, so when I try and add a new database following the same steps as the video I get the following error
"Connections to SQL Server files(*.mdf) require SQL express 2005 to funciton properly. Please verify the installation of the component or download from the url"
I am assuming this is because Visual studio is looking for an instance of SQL express on my local machine and since it doesnt exist on the local machine,it errors out.
So how do i tell visual studio, to connect to a different machine and create the database there?
I am using Visual studio 2008 with .net 3.5 Sp1
Make sure that remote connections is enabled in your sql server express installation (http://www.linglom.com/2007/08/31/enable-remote-connection-to-sql-server-2005-express/). Then take a look at www.connectionstrings.com for the various ways to connect to the sql server as appropriate for your environment. Then configure the connectionstrings section in web.config and reference that configuration target when connecting to the db.
Alternatively you might try using LINQ to SQL which will streamline some of these tasks (still need to enable remote connections and get an appropriate connection string defined...LINQ to SQL wizard for the rest).
Open the Server Explorer and add a new Data connection. Same thing as adding a new .mdf. You can use it just the same.
create the database on the remote computer(edit: IIRC, you can also create it within visual studio when you add the connection)
ensure that it allow remote connections
add the connection in database explorer
I'm not sure what's happening in that video, but if you for instance are going to use linq2sql, visual studio will add the connectionstring to web.config when you drag the tables into the .dbml :)
What you'll have to do is attach the mdf to the database server you have running on your separate machine, and then open up your server explorer and navigate to that particular machine and select the database from there.
I am not going to see the video so I can't tell you what step to change. But it should be easy enough to write a connection string (or get it off the web) that connects to a database on the remote computer and not your PC.
I am so used to writing my own connection strings that I don't even know of any option in VS that automates this.
Instead of add a new database to a remote machine as you indicated on your local machine, you can try to create the database on the remote machine firstly, and then connect to that remote database within your visual studio.

Resources