Why am I getting a Connection Error When Trying to Create a New SQL Server Database? - mysql

In Visual Studio's Server Explorer, I right-clicked Data Connections and selected Create New SQL Server Database.
In the same-named dialog that is then invoked, I entered a ServerName, a New Database Name, accepted the default of Windows authorization, but get this:
I'm pretty sure I installed MS SQL Server when I installed VS (2019). What is causing this error and what do I need to do to fix it?
Am I not allowed to create a Server Name and must use a specific one? If so, what?
UPDATE
I'm also getting problems now with MySql. I recently created MySql Databases (they are displaying on the left -- "movies" and "statesdb" and I've got connections to them, as indicated by the green connector icon), but now trying to create a new Database also fails (after I hit the "Test Connection" button):
UPDATE 2
I still get the same exact err msg after installing SQL Server Express.
And that's even though I do have a bunch of SQLExpress services running now (the only non-new one is the last one):
Do I need to use SQL Server Authentication instead of Windows?

To see if you have sql server installed and it’s running, you can open services.msc and look for SQL Server. The name in between the brackets is the instance name, I.e.: SQLEXPRESS.
To connect to a localhost instance you simply do .\instancename or for SQLEXPRESS: .\SQLEXPRESS

Related

Unable to connect to any of the specified MySQL hosts in NHibernate, MySql

One of the client is reporting this issue happening in our application. NHibernate throws Unable to connect to any of the specified MySQL hosts in the middle of the app running, so it is not a mistake in the configuration. It happens randomly, but always when the transaction is opened.
I saw this:
NHibernate, MySQL, Windows Server 2003 -- connection problems
But the server in my case is Windows 2008. And app opens only single connection simultaneously. MySQL version is 5.5.28. Server is on the remove machine
Unfortunately the app requires the HW I do not have, and I cannot reproduce it locally.
Any ideas or directions I need to dig in?
Try connecting using the full directory name, e.g. instead of Server=SRV use
Server=SRV.yournetwork.com
It might be that is has trouble resolving the server name.

SQL Server 2008 Express server information

I installed a company specific program which can connect to a SQL Server. I installed SQL Server 2008 Express with mixed authentication. I called the instance SQLExpress.
What I want to do is to create a new database via the program. (see image). In point 5 I tried many logins like sa-login, MyComputerName\User-Password, User-Pass, but nothing works. In point 6 I used for the server name SQLExpress or MyComputerName\SQLExpress and for the (new) database name I used MyDB, but same thing here. Can't connect.
It keeps saying:
cannot create database master.MyDB. SQL Server doesn't exist or access denied.
Can anyone help me please?
Image: http://imageshack.us/photo/my-images/248/sqlserverinfo.png/
Thx
I figured it out.
I've created a user in SQL Server and added him to the "sysadmin"
role and gave him access to the "master" database.
After that I added an inbound rule (allow port 1433) to my Windows Firewall to allow remote connections to the SQL Server.
See http://msdn.microsoft.com/en-us/library/ms175043.aspx

ASP can't connect to SQL Server database

I'm trying to get a classic ASP application to connect to a local SQL Server 2008 database. The app and database were built by someone else. I'm just trying to get them installed and running on my machine (Windows 7).
I'm getting the following error when when the ASP app tries to connect to the database:
Could not connect to database:
Error Number: -2147467259
Error Message: [ConnectionOpen (Connect()).] does not exist or access denied.
I don't see any messages in the Windows Event Viewer. I'm looking at: Event Viewer->Windows Logs->Application.
It's a fresh database install using a simple restore. The SQL Server install uses the default instance. SQL Server and Windows authentication are both allowed. I left the existing connection string (in the ASP code) in tact and just tried adding that to my SQL Server installation. Here's the connection string:
strConn = "PROVIDER=SQLOLEDB;SERVER=localhost;UID=TheUser;PWD=ThePassword;DATABASE=TheDatabase;"
To add that user to SQL Server, I went to Security/Logins in SSMS and added the user and the password. I selected the database in question as the Default database. I thought that might do the trick, but it didn't. Then, I went into TheDatabase, then went into Security there. I added a new user there, referencing the new user I had already added in server Security. Under Owned Schemas, I clicked db_owner and under Role Members I checked db_accessadmin and db_owner. None of this gave the ASP application access to the database. The sid values match in sys.database_principals and sys.server_principals for the login in question. I am able to login to SSMS using this login.
The app needs to execute selects against the database like this:
oConn.Execute('select * from someTable')
I'm not a DBA and am sort of grasping at straws here. How do I get this thing connected?
Thanks,
Jay
It occurred to me that SQL Server or the website in IIS might be running as users with the wrong permissions. Based on what I read, it's okay for SQL Server to be running as Local System, so I left that alone.
In IIS, my website was using "Application user (pass-through authentication)". This is set in the Basic Settings->Connect As ("Edit Site" dialog box). When I clicked "Test Settings...", next to Authorization it said "Cannot verify access to path (c:\mywebsitepath)." I increased access permissions on that directory, but that didn't help. In the "Connect As" dialog box, I then changed "Path credentials" to use "Specific user" instead of "Application user (pass-through authentication)". I set it to use the user that I log in to my machine as. After that, when I click the "Test Settings..." button, next to "Authorization" it says "Path is accessible (c:\mywebsitepath)." After that, the ASP website is able to connect to SQL Server just fine.
Since the connection string was using a specific SQL Server username and password, I'm not exactly sure why this fixed the problem, but it seems to have.

Trying to create a new linked server in SSMS: Can't find table 0

All of my Linked Servers stopped working and I have no idea why.\
When I try to create a new linked server in SSMS I get the following error:
Can't find table
Suggestions?
I'm on 2008 R2.
Update: I was able to connect to SQL, or least it looks liked I was connected in the Object Explorer, but when I try to open a Query Window:
Login failed. The login is from an untrusted domain and cannot be used
with Windows authentication. (Microsoft SQL Server, Error: 18452)
I seem to have no problem signing onto the domain when rebooting my PC..
Bizarre. Rebooting didn't help, but restating the SQL ServerService seemed to corerct the issue.
Update:
Now I am getting
OLE DB provider "SQLNCLI10" for linked server "servername" returned message "Not enough storage is available to complete this operation.".
Final Update:
Total corruption, error message after error message within SSMS whenever I touch teh Link Server functionality.
Solution: Delete ALL the linked servers and re add. This stabalized everything.
Update:
Something about hitting a DB2 linked serevr that just trashes my whole SQL environment.It happened when I recreated the DB2 linked server.

Migrate Data and Schema from MySQL to SQL Server

Are there any free solutions for automatically migrating a database from MySQL to SQL Server Server that "just works"?
I've been attempting this simple (at least I thought so) task all day now. I've tried:
SQL Server Management Studio's Import Data feature
Create an empty database
Tasks -> Import Data...
.NET Framework Data Provider for Odbc
Valid DSN (verified it connects)
Copy data from one or more tables or views
Check 1 VERY simple table
Click Preview
Get Error:
The preview data could not be
retrieved. ADDITIONAL INFORMATION:
ERROR [42000] [MySQL][ODBC 5.1
Driver][mysqld-5.1.45-community]You
have an error in your SQL syntax;
check the manual that corresponds to
your MySQL server version for the
right syntax to use near
'"table_name"' at line 1 (myodbc5.dll)
A similar error occurs if I go through the rest of the wizard and perform the operation. The failed step is "Setting Source Connection" the error refers to retrieving column information and then lists the above error. It can retrieve column information just fine when I modify column mappings so I really don't know what the issue is.
I've also tried getting various MySql tools to output ddl statements that SQL Server understand but haven't succeeded.
I've tried with MySQL v5.1.11 to SQL Server 2005 and with MySQL v5.1.45 to SQL Server 2008 (with ODBC drivers 3.51.27.00 and 5.01.06.00 respectively)
There are two free toolkits provided by Microsoft.
Microsoft SQL Server Migration Assistant for MySQL v1.0
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=14280
Microsoft SQL Server Migration Assistant for MySQL v5.1
http://www.microsoft.com/download/en/details.aspx?id=26712
I have used only the second one and it worked for me without any glitch.
It required registration with Microsoft for downloading a license file.
But it is free to use for everyone.
This is really old now, but if you use MySQL Connector NET and set SQL Server Mode = true in the connection string, this will resolve your error.
Recently, I have successfully migrated the MySQL database to MSSQL database. Below are detailed steps:
Operating System: AWS Microsoft Windows Server 2012 R2 with SQL Server Standard
Tools Used:
SQL Server 2014 Management Studio SQL Developer,
Microsoft SQL Server Migration Assistant v6.0.1 for MySQL,
Remote Desktop Client, and
Third Party MySql ODBC Driver 5.1.13
1. Setup AWS Windows Server
2. From the AWS console ec2 instance list, right click on the windows server and select connect. You would see the similar screen below.
3. Click on the Get Password button which will be required for Remote Desktop connection[#4] and follow the instructions.
4. Connect to that EC2[#1] instance with the Remote Desktop Client by default available in your Ubuntu local machine. Use the credentials from #2.
5. Once you get connected using the remote client, you should be able to access the remote MSSQL server. Install the following tools.
Install Chrome : Since internet explorer has some security, install chrome.
Install Microsoft SQL Server Migration Assistant v6.0.1 for MySQL
https://www.microsoft.com/en-us/download/details.aspx?id=51218
Install Third Party MySql ODBC Driver 5.1.13
https://dev.mysql.com/downloads/connector/odbc/5.1.html
6. Configure ODBC Data Sources(64-bit) :
Open Administrative tools → click on ODBC Data Sources(64-bit) and
follow the steps to connect to MySQL database.
7. Open SQL Server 2014 Management Studio SQL Developer and connect using windows authentication.
Create destination MSSql database for MySql migration.
8. Open Microsoft SQL Server Migration Assistant : For detail visit this link: https://blogs.msdn.microsoft.com/ssma/2011/02/07/mysql-to-sql-server-migration-how-to-use-ssma/
Create new project
Connect to MySql
Connect to MSSql
Convert Schema
Migrate Data
8. You might have some problem listed here. Please read in detail where I have written the detail resolution.
MySql 5.6 to MSSql server 2014 migration : ExecuteReader requires an open and available Connection
I am afraid there is no simple solution. SQL used in MySQL and T-SQL used in SQL Server 200X are different dialects of SQL. It is not only simple changing say "auto_increment" to "identity", but reserved words that creates a problem.
For example
CREATE TABLE test (
user varchar(50)
)
will work in MySQL and fail in SQL Server 2008.
To cut long story short - unfortunately, you will need to do it by hand.
Export the file from MySQL to a CSV file.
Export the create statements for the tables from MySQL
Cry.
3a. Disable foreign key checks in SQL server
Tune the create statements in SQLserver until they work.
Import the CSV files in to MySQL.
5a. Enable foreign key checks in SQL server.
Also see these answers:
migrate-from-mysql-to-sql-server-2008
Had similiar issue about this error 42000, and for me I figured out that setting the MySQL global mode to ansi_quotes would solve it:
set global sql_mode=ansi_quotes;
There are commercial solutions, but not free solutions. Depending on complexity of your database, rewriting SQL for target dialect can be trivial task - or a very hard one.
Rewriting CREATE TABLE statements is never hard, it can be done by hand with no surprises. Procedures, functions and triggers are problematic.