vb.net connect to MDF file without SQL Server installation - sql-server

can vb.net connect to MDF file without SQL Server installation
I want to install this application to client machine without installing sql server

I am fairly certain that the closest you can get to what are asking for is to use LocalDB -- which is available as an install option with SQL Server Express installation media.
LocalDB by itself should be sufficient to allow your app to connect to and query the MDF file.
LocalDB represents the lightest, most-minimal install that you could choose for your scenario.
The docs describe what I am talking about in this way:
LocalDB installation copies a minimal set of files necessary to start
the SQL Server Database Engine. Once LocalDB is installed, you can
initiate a connection using a special connection string.
When connecting, the necessary SQL Server infrastructure is automatically
created and started, enabling the application to use the database
without complex configuration tasks. Developer Tools can provide
developers with a SQL Server Database Engine that lets them write and
test Transact-SQL code without having to manage a full server instance
of SQL Server.

Related

How to connect to a local database in SQL Server Management Studio?

I have downloaded the SQL Server Management Studio (SSMS) 2016 to recover a huge .bak file which is an old backup of a database. But first of all I need to connect to a DB Server.
After install, I execute SSMS and it asks me to connect to a DB Server. I don't have any and I saw that it is possible to create a "local" db by typing only a dot '.' for Server Name and use Windows authentication.
It is not working; how to do it?
Open SSMS -> Connect
Server name: (LocalDb)\MSSQLLocalDB,
Choose Windows Authentication.
For a reference:
You need to download and install SQL LocalDB. It is a special edition of SQL Server that does not allow remote connection and supports windows integrated authentication only. It is a simple one click MSI install so it is easy to deploy.
To download and install SQL Server 2016 Express, go to SQL Server
downloads. LocalDB is a feature you select during installation, and is
available when you download the media. If you download the media,
either choose Express Advanced or the LocalDB package.
The above means that now you have to download and run a small downloader (cca 5 MB), select LocalDB (44 MB) and the Microsoft downloader will download MSI package to the folder you select. Then just run MSI package and LocalDB gets installed.
To recover your Dump, you need one server where your dump will get uploaded.
For this you need one MS server. you can connect to server using username and password. After connection to server you can create a DB in which you want the dump to get imported.
If your SQL dump contains create Database statement, then you don't need to create one.
If its possible to open SQL dump in text file, you can see Database name required to create or its already have statement to create DB.
In my case, solution was using my notebook name and SQLEXPRESS like DESKTOPXPTO\SQLEXPRESS
I was able to connect to local host in ssms ,after downloading SQL server developer.
As mentioned in - https://learn.microsoft.com/en-us/sql/ssms/quickstarts/ssms-connect-query-sql-server?view=sql-server-ver16
Prerequisites
To complete this quickstart, you need the following prerequisites:
Install SQL Server Management Studio.
Install and configure a SQL Server instance
https://www.microsoft.com/en-in/sql-server/sql-server-downloads?rtc=1

How to completely uninstall SQL Server 2012

I Uninstalled SQL Server Express 2012 from my PC. But after that, I noticed that there were other things at Programs and Features, like "Microsoft SQL Server Native Client", "Microsoft SQL Server 2012 Native Client", "SQL Server Browser for SQL Server 2012" and another programs.
What can I uninstall from my PC to completely remove SQL Server 2012, without having problems with my Windows system?
Honestly, Microsoft software is a pain to uninstall.
None of those things will uninstall eachother.
What I personally use for such an occasion is the IOBit uninstaller portable
http://portableapps.com/apps/utilities/iobit_uninstaller_portable
It lets me remove all of them at once.
Note the following important scenarios before you uninstall SQL
Server:
Before you remove SQL Server components from a computer that has the minimum required amount of physical memory, make sure that the
page file size is sufficient. The page file size must be equal to two
times the amount of physical memory. Insufficient virtual memory can
cause an incomplete removal of SQL Server.
If you have multiple instances of SQL Server, the SQL Server Browser uninstalls automatically when the last instance of SQL Server
2016 is uninstalled.
If you want to uninstall all components of SQL Server 2016, you must
uninstall the SQL Server Browser component manually from Programs and
Features in Control Panel.
Also note that,
Before You Uninstall:
Delete the local security groups. Before you uninstall SQL Server, delete the local security groups for SQL Server components.
Stop all SQL Server services. We recommend that you stop all SQL Server services before you uninstall SQL Server components. Active
connections can prevent successful uninstallation.
Use an account that has the appropriate permissions. Log on to the server by using the SQL Server service account or by using an account
that has equivalent permissions. For example, you can log on to the
server by using an account that is a member of the local
Administrators group.
Documentation: MSDN - Uninstall an Existing Instance of SQL Server

confusion about SQL Server Express and localdb

I need to deploy a WCF service with a database on client machines. I am confused about SQL Server Express. I need to verify all of the following.
When attaching database files in the App_Data folder, do I still need to install SQL Server Express engine (Windows service) on client machines?
There is a flavor called SQL Server Express LocalDb. That one does not need an engine (Windows service)? But I think it need a prerequisite installation of LocalDb.
Localdb is introduced with SQL Server 2012. There is NO localdb for SQL Server 2008. Correct? I could not find 2008 version on MS site.
Do I still need to install SQL Server Express engine (A win Service)
on client machines?
Yes, they need it installed for your application to query the database. Can't really get around it.
There is a flavor called SQL Express localDb. That one does not need
an engine (win service)? but I think it need a perquisite installation
of localdb.
Yes, you'd still need to install LocalDB on the client machine. It's pretty hassle-free to do, but I think it's overkill unless you really need the full features of a SQL Server instance for your webservice.
Instead of LocalDB I'd strongly recommend using SQL Server Compact Edition - it performs the role you're thinking of (your WCF Service can simply connect directly to the database file on your client machines without installing SQL Server, and is lightweight), but doesn't need to be installed (it's simply included as a DLL with your WCF application):
Unlike other editions of Microsoft SQL Server, SQL CE runs
in-process with the application which is hosting it.
In Microsoft's own words on the differences between LocalDB and SQLCE:
LocalDB and SQL Server Compact?
Small and simple database, lightweight installation, connecting to a
database file -- this will sound familiar to any developer using SQL
Server Compact. The similarities are not accidental, as our goal for
LocalDB was to be as easy to use as SQL Server Compact (while being as
powerful and compatible with full SQL Server as SQL Express).
There are significant differences between LocalDB and SQL Server
Compact:
Execution mode: SQL Server Compact is an in-proc DLL, while LocalDB runs as a separate process.
SQL Server CE is kind of like an updated version of MS Access, the file goes with the application which can "just connect" to the database file without involving any database server installation, and its syntax/features are very close to SQL Server standard.

SQL Server Express usage with Pentaho (or any non-microsoft product)

I'm trying to connect a local SQL Server database to an ETL utility called Pentaho. Pentaho very easily connects to full versions of SQL server without issue.
I've set mixed mode authentication and created a sql server account for the sql server express instance that can be used to login through SSMS.
When I try to log in via Pentaho, I get errors about it not knowing what the server is, or the server not responding. I've tried {localhost, myip, localhost\SQLEXPRESS, myip\SQLEXPRESS, just SQLEXPRESS} as the server name (and SQLEXPRESS is the instance name).
I know I've had trouble connecting other programs to SQLEXPRESS databases in the past. Can someone tell me why it acts different than when using a full install of SQL Server and how I can get around these differences?
If SQL Server Express is on a different server, have you enabled TCP/IP protocol?

Difference between different datasources

Him
Please explain what is the difference between different datasources for SQL (shown in the pic.)
I mean difference between Microsoft SQL Server and Microsoft SQL Server Database File
Connecting to Microsoft SQL Server means that you are establishing a network connection to a SQL Server -- the database engine is running either on your machine or remotely and you are using the SQL Server as a service and are connecting to it. That server has the data and you just use a protocol to request operations to be performed.
Connecting using a Microsoft SQL Server database file (MDF) means that you want to use a database file and have a running SQL Server engine running locally use that MDF file. So, if you have SQL Express on your machine, when you create a connection to a MDF file, you're essentially using the SQLExpress engine on your machine to serve up that MDF file (and the database contents) to you.
I admit I almost always connect to a SQL Server, as I'm not guaranteed to have the MDF file available in all environments. Plus, I usually don't install SQL Express.
That's how I understand the difference. Hope this helps!
Maybe the "Microsoft SQL Server Database File" option refers to manually using SQL Server's files (*.MDF), whereas the Microsoft SQL Server refers to connecting to a full-blown SQL Server ?

Resources