IntelliJ cannot visualize Database - intellij-idea

I have a database I connect to using the IntelliJ Built in tool, and it connects properly to the test database and displays it, however, it doesn't display the tables with another database. I then tried connecting with the open source tool SQL Workbench, with the same information and it does properly connect to the database and displays the tables.
test database:
other database:
other database in SQL Workbench:
When I click "Test Connection" In IntelliJ it connects properly for both the test and the other database, however one isn't actually displaying the tables.
How can I fix this?

Figured out what was wrong:
In the Database configuration file if you go to "Schemas & Tables" you can tick and untick what to show.
While I had never unticked anything, ticking the proper schema and adding it allowed me to visualize my database properly.

Related

Associate SQL Script with Database

I have been using DBeaver as a replacement for SQL Server Management Studio, and I am loving it. The only thing I cannot figure out is how to associate a script with a database. For example, in SSMS I can right click a database (let's call it A) in the object explorer and click "New Query" (or ctrl+n) to open a script that is active within database A. If I open another script in a different database (B), that script is associated with the database B. When I switch back to the original script, I am back to working with database A without having to manually select from the database list or executing a USE statement. Obviously, switching back to the second script will make database B active again.
Unfortunately, in DBeaver, there appears to be only one active database for all scripts. Is there a way to set this up in DBeaver to act like SSMS in this manner?
Edit: DBeaver refers to individual databases as catalog/schema. That is what I am trying to associate with individual scripts.
I am using DBeaver community and i have using with multiple DB's. You have to just select Data base from drop down to change DB, it is for current script that open .
i current not have my company system connected , find one sample image from internet .
I don't know that DBeaver has this capability, but you could always Preface your scripts with the USE DBNAME statement...
UPDATE
Version 6.3.1 (2019-12-22) now supports this by default! Here is the first note of the description for 6.3.1:
SQL editor:
Active database/schema change now affects current editor only
Note: This does seem to have changed some behavior such as "Set active" from the database navigator as well as the "Auto-sync xx with navigator." These two used to take affect to the active database/schema. Now they are tied to the current connection.
Original Answer
For anyone who finds this in the future, I did find a work around that provides the desired behavior. The answer is to use projects. Unfortunately, this means creating a duplicate connection to the server.
There is also another catch here. If you want to set a schema for a specific script, you should avoid setting the schema via the "Database Navigator." This will, however, work if you want to change the schema for a script that is already in the active project. If the script is not in the active project, and you set an active schema through the Database Navigator, it will change the active schema for all open scripts associated with that server. To keep it simple, I try to avoid the Database Navigator all together.
All is not lost by avoiding the Database Navigator. By default, the "Projects" window is a tab right next to the Database Navigator. If you expand (click the + next to the name) [Project Name] -> Connections -> [Connection Name], you will have your list of databases/schema right there. Use this as your new Database Navigator and you are all set.

Microsoft SQL Server connection error with Visual Studio.net (Windows forms)

I've been trying for a while to connect the database to visualstudio.net and it just doesn't work.
First I made the database and made everything I needed there and when I tried connecting it in visual.net through datagridview (trying to get it displayed there) it only gives me access to the "System databases" in which I can't make a database.
After that I decided to make the tables under the "master" database to see if that worked and yeah I can select the database and everything but it says it's empty when I know it's not. It says it has no tables when I've checked multiple times and saw the tables I've created there.
I would appreciate some help to either be able to get for visual to accept a database I make (to be able to automatically detect it once I enter the server name) or to see how can I use the master one properly.
You can add a data source to your project and it will be able to connect to the user databases. Also, it is highly inadvisable to create any user objects in the master database.
master database is a system database and you should not create user objects in the system database. In the connection string, provide the user database name explicitly. If you dont provide the database name, it defaults to master database.
Refer to connection strings for Sql Server for providing the right connection string for SQL Server in .net.

Oracle SQL Developer 3.0.04 Freezes when viewing table data

I'm using Oracle SQL Developer 3.0.04. Trying to connect to a remote DB. Don't have any issues with database connection, it connects.
But when trying to view a selected tables rows a small progress bar within a small dialog box titled "Display Results" appears saying "Waiting for Checking if Object is Editable" and the progress is stuck. Cannot see any data of the selected table.
I tried to export the schema and data, but it freezed at once. So I closed SQL Developer.
Tried to attempt that again but now cannot even view the tables details.
Used TOAD in another machine and connected using that, no issue then the table listed all the data. Checked on the remote machine using putty and "sqlplus" to connect and the data showed as expected.
So that tells me that something in my local machine is wrong. Cannot connect using SQL Developer. Has anyone out there faced similar issue? please any idea on this matter?
Thanks
Did you try connecting to any other database, remote and local ? Does this happen with every database or only one connection? Perhaps something is wrong with that installation folder of SQL Developer, perhaps something got corrupt while it was stuck. Perhaps try to download the latest version of SQL Developer from this link and try again.

Visual Basic using SQL Database

So this is a homework question but I'm probably missing something really simple. I am working on a project where I was given a database. I'm not in the programming part of the assignment but I have to write the test case scenerios for the project before starting the project. Because I am working with an SQL Database that was provided. I am supposed to write the expected output from the database. If the user chooses shampoo from the products menu then the different brands of shampoo should then populate in my datagrid.
Because they gave us a sample database. How do I view it? I am I supposed to be able to write the expected output if I don't know what has been pre-programmed into the database?
Thanks in advance. I have already designed my layout and I guess I'm just stuck because I have been taught to plan your output before you program that way you know the program is working correctly. I don't want to write the assignment to find my output in case I did it wrong I guess, if that makes sense.
Here is how to do it in Visual Studio 2010
To create a data connection to the Northwind database—SQL Server
database file (.mdf)
On the View menu, click Server Explorer/Database Explorer.
In Server Explorer/Database Explorer, right-click Data Connections and
click Add Connection.
After you click Add Connection, either the Add Connection dialog box
or the Choose Data Source dialog box will appear.
If the Choose Data Source dialog box appears, select Microsoft SQL
Server Database File, and then click OK.
If the Add Connection dialog box appears, verify that the Data source
is set to Microsoft SQL Server Database File (SqlClient). If it is not
set to Microsoft SQL Server Database File (SqlClient), click Change to
open the Change Data Source dialog box, click Microsoft SQL Server
Database File, and then click OK.
Click Browse to locate the .mdf file that contains the Northwind
database.
Depending on the requirements of your version of the Northwind
database, either click Use Windows Authentication or click SQL Server
Authentication and type a user name and password to log on to the
computer running SQL Server. For more information, see Add/Modify
Connection (Microsoft SQL Server Database File).
Click OK.
A data connection to the Northwind database is added to Server
Explorer/Database Explorer.
Okay, so this should be pretty straight forward then:
Download and install SQL Management Studio Express.
Attach the database.
I wouldn't normally just list links in an answer, but this one really calls for it. These are very foundational URL's and won't be moving.

extract raw SQL query from a Crystal Report .rpt file

I've got an .rpt file that I did not write and can find no documentation about. I want to be able to review the SQL that is generated from this report so that I can figure out, well, what data it was pulling and what WHERE clause parameters were used.
I can open it up and see the report layout. But when I select Database|Show SQL Query... the report tries to connect to the data source. The problem is, the data source being used is unknown to me, probably an ODBC connection used by whoever wrote the query. All I can do at that stage is 'Cancel' and I'm back to looking at the report designer.
Am I missing something? Can I get to the SQL query without connecting to the datasource? It seems like viewing the selection criteria shouldn't be dependent on a data connection.
Thanks.
version: Crystal Reports 2008
I know that this is an old thread, but I encountered this same problem. Effectively we used to have a database/application that has since been aquired by an external agency.
Although they now have the database/application they don't have access to crystal reports, so we can't just send them the old report that we used to run. Likewise we can't run it as we don't even have the database set up anywhere.... So instead our plan was just to extract the SQL code generated by the report and forward that on.
We experienced the same problem, but the solution is actually pretty simple.
If you don't have access to the original data source, just create a new 'blank' datasource (such as an ODBC connection). As long as the connection to the datasource works (i.e. it is some kind of valid datasource this it works fine). When running the 'Show SQL' option point the report to this datasource. As long as you don't try to actually run the report (and only show the SQL) the operation wont fail. This worked for our situation anyway. (Crystal Reports 2008)
(I can give more details if it helps in any way.)
It should be possible to find out some details about the existing datasource, by selecting Database > Set Datasource Location... .
As well as enabling you to change the datasource location, this should show you some information about the current datasource, such as which type of datasource is being used, and possibly (dependant on the type of driver) the name of the database. It is likely to be less helpful if (as you surmise) the datasource is ODBC, but if it uses a native driver there may be something useful.
Without the password, I'm not sure how much you can do. It seems "Show SQL Query" requires to report to run first, then generate the SQL plan.
It's not ideal, but you could go to Database > Visual Linking Expert to at least see the tables and how they are joined, and the go to the Record Selection Formula Editor and see what the custom WHERE statements are.
Viewing the SQL of a Command in a Crystal Report File
There are times you have just the report file, but not the associated database structure that the report uses.
This is common when dealing with example reports of functionality you wish to mimic.
This is a workaround ONLY to allow you to see the SQL of a Command that a Crystal Report is based on, when you don't have the underlying database connection that the report is based on.
In essence, the dialog box has to be satisfied before it will show the SQL, so we fool it with a legitimate Data Source, just not one that would work with the SQL that is actually in the SQL Command.
Why does a report use a command? Doesn't Crystal Reports have the ability to link tables?
When a Crystal Report is based on a record set that is too complex for the table linking functionality within Crystal Reports, the report can instead be based on a SQL Query, usually developed/tested in another editor tool and pasted into the command. This allows advanced SQL functions to be utilized.
If you don't already have a Data Source on your computer set up that you can connect to, you will need to build one first.
A simple Microsoft Access .mdb file saved in a simple location will suffice.
I placed mine with the path C:\A_test\test.mdb to make it easy to find.
If you don't have one, google for a sample mdb file and download it, saving it with a name and location you can remember. (You won't ever actually open this file, but just connect to it.)
Once you have the file saved, open the ODBC Administrator and create a New Data Source.
(you can get to the ODBC Administrator quickly from Start > type ODBC in the Search)
On the User DSN tab, click the Add button.
Scroll down the driver list to Microsoft Access Driver (*.mdb), select it and click the Finish button.
In the Data Source Name box, type a name (I used MyTest).
Click the Select Button and select the mdb file you saved from a previous step, click OK.
Click OK again. You will see your new Data Source listed by the name you gave it. Click OK.
You now have the data source you will need for the next steps.
Open the Crystal Report you want to see the SQL command for, and click on Database Expert button or Database>Database Expert Menu.
Under Selected Tables, right click on the Command and choose View Command
The Data Source Selection Box appears. Select the Data Source you created (or one you already use) and click the Finish button. The View Command box should open with the SQL in the left pane. Copy the SQL into your favorite text editor.
Whats happening is that the crystal reports needs a database to connect to regardless if its the original source DB or not.
Create a local database or use a database stored on a server, added it to your ODBC Datasources and use it when connecting. After a successful connection you should be able to view the SQL query without an error.