How to connect a SQL Express data source on my local PC?

Hi,

I want to use Datagrip but couldn't connect to my SQL Express which is on my local PC. I can connect to my database with Rider as follows: 

Data Source=IN0011019710199\SQLEXPRESS;Initial Catalog=InventoryManagement;Integrated Security=True

I can also connect SQL Express with Windows authentication using MS SQL Management Studio.

Thank you.

0
12 comments
Hi,

To investigate this issue, please upload the following logs onto our FTP server https://uploads.jetbrains.com/

• idea log from Help - Show Log in Files

Please provide the upload id in your reply

We'll have a look and get back to you
0

Upload ID: 2024_10_14_RCF3MXziYggX3g9KyEBAg2 

0
I am assuming you're connecting to the SQL Express Local DB and judging by the log, you have added a regular MSSQL data source attempting to establish a connection to this database. If that's the case, may I ask you to create a Microsoft SQL Server LocalDB data source as per this article:

https://www.jetbrains.com/help/datagrip/connecting-to-sql-server-express-localdb.html 

and see if the connection works.
0

I added SQL Server Local BD but I can't see all the databases in datagrip. Have a look at the screenshots;

0
Thanks for the update.

If you create a new data source where you specify one of the missing database in the Database field, does it allow to authenticate to the server and list this database? Anything specific in the way these 2 databases are configured in your SQL Express instance.
0

Getting this error with no auth and windows credentials.

0
This issue is likely related to the user account not having privileges to log in and view the database. I am therefore assuming this is also the reason why the 2 databases in question were not listed. Please see these threads for more details on what to check  

https://stackoverflow.com/a/2577854/20186218

https://stackoverflow.com/a/36019077/20186218

https://learn.microsoft.com/en-us/previous-versions/troubleshoot/dynamics/crm/cannot-open-database-requested-by-the-login-error-when-signing-in
0

I appreciate your help. I tried to create the user like in the threads but it says the user is already there. I can't manage to connect all of the databases in the MS Management Studio with DataGrip.

0

Judging by the outcome, it seems like a permission-related issue. To double-check this, please go to your main SQL Express data source and run this query from the query console, and provide a screenshot of the databases you're getting in the output  

select database_id as id, name, cast(databasepropertyex(name,'collation') as char) as collation_name, state

from sys.databases 

That's pretty much the same query we are using when retrieving the information about database objects 

If you don't see all the databases, please refer to this article to check your permissions  

https://learn.microsoft.com/en-us/sql/relational-databases/databases/view-a-list-of-databases-on-an-instance-of-sql-server?view=sql-server-ver16

0

When I run the query, it brings all the databases I use. In an SQL forum, experts say that “by default, all users have permission to see all the databases. It seems that here you are connected to LocalDB, and not your Express instance. Those are two different things." How can I connect to my local SQL Express instance .\SQLEXPRESS in DataGrip?

1    master    Turkish_CI_AS                     0
2    tempdb    Turkish_CI_AS                     0
3    model    Turkish_CI_AS                     0
4    msdb    Turkish_CI_AS                     0
5    InventoryManagement_local    Turkish_CI_AS                     0
6    GameAPI    NULL    0
7    DbDapperRealEstate    Turkish_CI_AS                     0
8    InventoryManagement    Turkish_CI_AS                     0
9    ECommerce    NULL    0

0

Thanks for the update. 

Judging by the previous screenshot taken from SSMS, your SQL instance is SQLEXPRESS, which is the default instance name 


You need to specify that instance in the Instance field of your data source properties. In this case, SQL Express instance connection is established the same way as with a standard SQL Server. In this case, you need to create a Microsoft SQL Server data source and connect via localhost as your host + port number + your instance. See these steps for more detail

https://www.jetbrains.com/help/datagrip/microsoft-sql-server.html#required_settings  

0

Please sign in to leave a comment.