SSMS Change Connection for Query Editor Window - sql-server-2008

Normally when I want to change the connection for a Query Editor Window in SQL Server Management Studio, I can select a new connection from the menus at the top - Query > Connection > Change Connection.
However, when I am working on cubes with an analysis services connection - and then open a saved SQL script (such as the underlying SQL view) the Available Databases combobox is blank, and the "Change Connection" and other 3 options in that menu (Connect, Disconnect, Disconnect all queries) are all greyed out.
The only workaround I have found to be able to run the saved SQL script, is to open a "New Query" from the SQL Database I want to access in the Object Explorer, and either copy my script into it, or reopen the script - which now opens as normal, with the new query's database.
It seems to be taking the last Query Editor Window's database connection as the default connection for any new queries - and when your last "query" is browsing a cube then it breaks? Does anyone have a fix to un-grey out the "Change Connection" option properly?
I am using SQL Server 2008 R2, and opening the saved SQL script by the File > Open > File menu

Luckily in SSMS 2008-R2, 2012 There is a change connection function. Placed just before the DB dropdown.
Or via menu Query>Connection>Change Connection.

Well, SSMS does not allow to manage connections easily (particulary, when you want to switch connections between servers). I have developed add-in for SSMS: SSMSBoost - it adds additional combobox to the toolbar with your favorite connections (you have to define them). In your case, after opening the script you will have to pick the right connection from this new combobox and it will be established. Addin is currently free.

Related

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

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

How to connect IntelliJ with local MySQL?

I have been struggling to learn how the localhost MySQL and IntelliJ to connect and program a database related task. Is that Possible? If yes, how to achieve it?
Connecting to a local instance is essentially the same as connecting to a remote instance of MySQL. Just substitute either localhost, or 127.0.0.1 in place of the IP address you would use normally.
To add a new database connection (called a data source in IntelliJ), open the Database window View -> Tool Windows -> Databases, then click the + sign and select Data Source and then MySQL from the sub-menu. The defaults for the MySQL connection should for a local install of MySQL.
To open a connection, right click on your new data source and select Open Console.
Official IntelliJ Documentation - Managing Data Sources
As of Community version 2017.2, the DB Browser does not come bundled with the IDE (at least not on my last two installations). In order to activate it, you should navigate in the IDE in **File->Settings->Plugins->Browse repositories and select "Database" from the dropdown menu. From there you can install the Database Navigator. After the installation has been successful, you should restart the IDE. Then you can select **View->Tool windows->DB Browser.
In recent versions of Idea Community (about 2017.3, but I am not sure) there is no Database tool available anymore, only in Idea Ultimate [1]. Yet worse, the plugin Database Navigator that would fit here to solve this problem is not compatible anymore, at least not with 2018.3 [2].
Uninstalling Idea right now, unfortunately.
[1] https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000411990-Database-option-not-available-under-View-Tool-Windows-in-Intellij-v2018-1-Community-Edition-
[2] https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001759260-Dan-Cioacas-Database-Navigator-plugin-v3-0-8222-0-is-incompatible-with-latest-IntelliJ-IDEA-2018-3
To add a new database connection (called a data source in IntelliJ), open the Database window View -> Tool Windows -> Databases, then click the + sign and select Data Source and then MySQL from the sub-menu. The defaults for the MySQL connection should for a local install of MySQL.
To open a connection, right click on your new data source and select Open Console.
to download Drivers click on "Download missing Drivers" in bottom of the window.
if you want to add JDBC and connect other database vendor like workbench projects (instead of using intelliJ Consol) just follow the steps bellow :
Using JDBC drivers #
Create a connection to a database with a JDBC driver #
If you cannot find a name of a database vendor in the list of data sources, download a JDBC driver for the database management system (DBMS), and create a connection in IntelliJ IDEA. With the JDBC driver, you can connect to DBMS and start working.
In the Database tool window (View | Tool Windows | Database), click the Data Source Properties icon.
In the Data Sources and Drivers dialog, click the Add icon (+) and select Driver and Data Source.
Click the User Driver link.
In the Driver files pane, click the Add icon and select Custom JARs.
Navigate to the JAR file of the JDBC driver, select it, and click
OK.
In the Class field, specify the value that you want to use for the
driver.
Click Apply.
Return to the created data source connection.
Specify database connection details. Alternatively, paste the JDBC URL in the URL field.
To set an empty password, right-click the Password field and select Set empty.
To ensure that the connection to the data source is successful,
click Test Connection.
For more information read the official answer of Jetbrains in following link :
Configuring database connections
https://www.jetbrains.com/help/idea/configuring-database-connections.html#Configuring_database_connections.xml
For anyone who is having trouble connecting IntelliJ Community Edition with MySQL in 2021.
(In IntelliJ Ultimate Database connectivity is supported by default and you can follow the steps shown in the previous answers. However IntelliJ Community Edition does not support it by Default).
Here is what you have to do:
Install "Database Navigator" Plugin. (Settings->Plugins->Marketplace->Search Database
Navigator and install)
Open DB Browser Tab (next to the button that opens/closes Project Window) -> Click Options logo
-> '+' -> Fill the Database fields (Name, host, Port, DB Name, User and Password).
Download the MySQL Java Connector
by searching google for 'java connector mysql'.
Go to File->
Project Structure -> Modules-> Dependencies. Click the '+' on the right side and select 'JARs or directories'.
Navigate and find the Java connector you just downloaded (the file
looks like this: mysql-connector-java-8.0.26.jar). Click apply
and in the project window, under External Libraries, you will see
the .jar file.
For WebStorm you need plugin "database-navigator"
https://plugins.jetbrains.com/plugin/1800-database-navigator

How to set datasource for MySQL database in Microsoft SQL Report Builder 3.0?

I am using Microsoft SQL Server Report Builder 3.0. And I have remote Linux Server(with certain IP) that have MySQL database. I want connect this MySQL database from Report Builder (in my PC), So that I can create some reports about it. How can i do that? Please help and Thanks.
First, you need to download and install (32-bit or 64-bit) appropriate MySQL connector.
MySQL ODBC connector
After installation, you need to create ODBC Data Source Name (DSN) on this way:
Open Control Panel -> Administrative Tools -> ODBC Data Sources (32-bit or 64-bit, depending of installed connector)
Choose System DSN tab and click on Add
In dialog window, choose installed connector for MySQL
In new dialog window populate Data source name field with descriptive name, fill MySQL server address and port (IP address or server network name) and fill credentials that have enough permissions to MySQL server. Catalog field is optional field. Test the connection.
Open Microsoft Report Builder 3.0, and create new report. While creating dataset, you need to choose data source. Click New Data Source (or just New) and in the dialog window for Connection type, choose ODBC and in the Connection string choose Build option.
In new dialog window, in Data source specification section choose your DSN that you created in stages 2, 3 and 4 and test connection.
Voila :)

I get "Open SQL Script" upon MySQL startup (in Workbench)

I have 3 connections configured in the MySQL Workbench and lately as soon as I run the workbench I get this "Open SQL Script" dialog.
Steps:
1) Right click MySQL Notifier (1.1.4)
2) Click on "SQL Editor..."
3) Expected: Workbench Home (1 tab open)
Actual result: the tab for the 3rd connection is automatically open and on top of that I get this "Open SQL Script" dialog.
Additionally I would love to be able to change the default connection that opens, but I could not find any of this anywhere.
Help is appreciated! Thanks,
Simon
Take a closer look where you are clicking in MySQL Notifier. For each instance MySQL Workbench (and hence MySQL Notifier) found there's a separate menu entry which you can use to open the application for. The notifier is just trying to help you to get quicker to some standard work. If you just want to open MySQL Workbench then don't use the notifier. Create a shortcut for it and put in a good place instead.
Update
In order to clarify look at this image:
As you can see there's more than one "SQL Editor..." entry (one for each connection in MySQL Workbench). But even if you only have one connection, the menu entry "SQL Editor..." is meant to open ... well... the SQL editor. In addition it asks for an SQL file you may want to open. That's just how it is designed. If you don't want that click Cancel. There's no dedicated menu entry to just open MySQL Workbench with the home screen. If you want that better place a shortcut to the application on your desktop.
Regarding a "default connection": there's no such thing as a default connection. You can pass in a connection name on the command line if you want to open a specific connection. You can use the shortcut you can create and add the parameter "-query " to it.

Visio 2010 DataSources not showing in reverse engineer wizard

Hi I am trying to do a database diagram in visio 2010 to existing database. I am using the reverse engineer wizard. When I push new button on datasource field. I follow the steps to add new datasource. It looks like everything worked no errors, tested connection and it passes. But after finishing the process it should add it to the datasource box so I can select and proceed on. But it does not show up. DataSource is still blank.
Specifics: It is a 2008 R2 Express db trying to connect to using visio 2010. OS is Window 7 64bit.
Can anyone help.
I had a similiar problem when creating the datasource as "file data source". Once I created it as user or system datasource it showed up. (Using Visio 2010 on WinXp connecting to SQL-server 2008)
It's really odd but it seems that using Generic OLE DB driver works for this issue.
I had the same issue, here is how I resolved it:
Beside Installed Visio drivers selected, MS SQL Server, at the bottom of the list, checked SQL Server Native 10.0
Under Data Sources, clicked on new, (I used User Data Source), then on the Create New Data Source Screen, used SQL Server Native 10.0
Upon completing the wizard, my data source did appear.
The main thing is to have SQL Server 10.0 checked beside on the Microsoft SQL Server option (not checked by default)