PGAdmin - Why is DB Restriction (and Advanced Properties) Disabled? - database

I'm hoping to restrict the number of databases I see in the browser tree/heirachy since it's an AWS server with hundreds of DBs. Based on this answer I found how to do that. But I can't edit this field (DB Restriction). Click, double click, right click, etc no luck.
I found that it says
Note: you must ensure that the pg_hba.conf file of the server from
which you are connecting allows connections from the host of the
client.
In the documentation. Is this the glaring, obvious answer? If so is there a way for me interact with the pg_hba.conf of a remote server that I am not an admin on? Or is there some other reason why I can't edit this field?

Please disconnect to the server first.
Now once the server is disconnected then right click on that server open the Server -> Properties dialog and you should be able to see it editable.

Related

Labview - SSMS database communication... How to communicate between Labview and Microsoft SQL Server on separate devices?

I am attempting to set up a communication between Labview and Microsoft SQL Server, on two separate devices, in order to send and receive information about the database from both labview to SQL Server and SQL Server to labview. However, when I reach the "Data Link Properties" menu, I get the same "unable to log in" error upon attempting to log into the server. The server name comes up, however, an error occurs once I move on to select the database on that server. Is there any solution or tutorial to this problem that can allow me to successfully communicate back and forth from labview and smss on separate devices?
I've opened up various ports to allow a connection, even disabled the firewalls on both devices. The devices are connected via an Ethernet cable and I AM able to ping the devices to each other. However, in regards to being unable to log into the server in ssms, I have created new users, adjusted the login properties, tried changing permissions, but anything I try doesn't seem to solve my issue.
Can't really help much without seeing the error or some of the code of what you are trying to do.
That being said, if you go to the menu and select Help>Find Examples... and search for database, you should see a bunch of different things related to database connections. You may find the Database Connection.vi one helpful.
More info on the Database Connectivity Toolkit in LabVIEW can be found here
I see there can be one of the 2 issues
1) Inbound/Outbound port rules not set, Remote connection to server is not allowed.
2) If the server has multiple instances then you need to provide full host name of the instance you are trying to connect.
*Please refer to the below link to configure firewall rules.
https://learn.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-2017

Can't access AWS RDS database even though CIDR/IP added in security group

I have created a db instance (sql server ex) in my AWS account and now trying to access it via MS SQL Server Management Studio or via Visual Studio Server Explorer, but i can't, i get the errors like below:
I have added my ip address in inbound under security group as well:
I Tried all the above steps but didn't work. Even though, i have selected 'Publicly Accessible' while using visual studio, it didnt reflect in the aws console. So, the below steps worked for me. Please try this.
Note:- this is only for my testing/learning purposes. So, i made it publicly accessible. You might not enable publicly accessible if there is a security issue. If you are testing/using for learning purposes, you can follow the below approach.
Make sure your port is publicly accessible .Else you will not be able to connect.
To enable the public accesss, please follow the below steps.
Select the db instance --> click Modify
Scroll to connectivity Section, expand 'Additional configuration' section --> select 'Publicly Accessible'--> Scroll to bottom --> select update. (as shown below).
Your db instance will be in modifying state and after 2-3 minutes it will be available. Now, give it a try to connect again and you will be able to connect now.

Prompt for SQL Server to connect to in Visual Basic 2010

I have a project that current uses a hard coded SQL connection string. I want to make this more flexible so that when I move it to another environment the user can browse for the SQL server to connect to since it will have a different than my test server. I have tried countless ways to Google for a solution and I am just not getting any hit. I am looking for something similar to the open file dialog in VB, except for SQL servers, where it will list all the servers available on the network and let the users select one, then enter credentials.
Does such a thing exist?
Thanks!
It should be easy to develop a dialog box similar to one SQL Server Management Studio uses. Be aware that all instances on the network cannot be enumerated because broadcast packets are not typically routed and due to firewalls so you'll need to allow the user to enter a server name in the combobox. Here's a code snippet to return a DataTable of the found instances (http://msdn.microsoft.com/en-us/library/a6t1z9x2(v=vs.110).aspx):
Dim dt As DataTable = System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources
Below is a screenshot of the login dialog from SSMS. Just populate the server name combobox with the server and instance names from the data table, and add the other needed controls.

Connect to a heroku database with pgadmin

I would like to manage my Heroku database with pgadmin client. By now, I've been doing this with psql.
When I use data from heroku pg:credentials to connect de DB using pgadmin, I obtain:
An error has occurred:
Error connecting to the server: FATAL: permission denied for database
"postgres" DETAIL: User does not have CONNECT privilege.
How to achieve the connection?
Open the "Properties" of the Heroku server in pgAdminIII and change the "Maintenance DB" value to be the name of the database you want to connect to.
The default setup is suitable for DBAs et al who can connect to any database on the server, but apparently that isn't true in your case.
After you change the Maintenance DB name as suggested by araqnid's answer above, you should also add your database to the DB restrictions field because without this you will see thousands of databases and you may not be able to find yours in the list if the list is too long.
More details here - How to hide databases that I am not allowed to access
This is for pgAdmin 4
In order to connect pgAdmin to your database (postgres instance in Heroku), do the following:
Login to Heroku, and select the application in which you have the database
Select the Resources tab and then click on "Heroku Postgres Ad-on" (see below). This will open up a new tab.
Select the Settings tab and then click on "View Credentials..." (see below)
You will get the following information that you will use in pgAdmin:
Go to pgAdmin, and create a new server
In the General tab, give a useful name
In the Connection tab, fill the info you got at Heroku
In order to avoid seeing thousands of databases, you need to add your database name to DB restriction in the Advanced tab (see below)
We require SSL for connections outside Heroku. Please verify whether you're forcing SSL in your client.
Answered more thoroughly here: Connecting pgAdmin3 to Postgres on Heroku
We don't allow connections to the postgres database, so be sure to set Maintenance DB to your database name, and be sure to use SSL.
Change the Maintenance Database to the name of your Database, e.g. dva70000p0090. This should work.
the db password local isnt the same db password heroku. please check the heroku ip postgtres address and extrac

Mirroring in SQL Server 2008

I'm trying to set up mirroring between two sql 2008 databases on different servers in my internal network, as a test run before doing the same thing with two live servers in different locations.
When I actually try and switch the mirroring on the target DB (with
ALTER DATABASE testdb SET PARTNER = N'TCP://myNetworkAddress:5022') I'm getting an error telling me that the server network address can not be reached or does not exist. A little research suggests this is a fairly unhelpful message that pops up due to a number of possible causes, some of which are not directly related to the server existing or otherwise.
So far I've checked and tried the following to solve this problem:
On the target server, I've verified that in SQL Configuration Manager that "Protocols for SQLEXPRESS" (my local installation is labelled SQLEXPRESS for some reason, even though querying SERVERPROPERTY('Edition') reveals that it's 64-bit Enterprise), and Client Protocols for SQL Native Client 10 all have TCP/IP enabled
I'm using a utility program called CurrPorts to verify that there is a TCP/IP port with the same number specified by the mirroring setup (5022) is open and listening on my machine. Netstat verifies that both machines are listening on this port.
I've run SELECT type_desc, port FROM sys.tcp_endpoints; and
SELECT state_desc, role FROM sys.database_mirroring_endpoints to ensure that everything is set up as it should be. The only thing that confused me was the "role" returns 1 .. not entirely sure what that means.
I've tried to prepare the DB correctly. I've taken backups of the database and the log file from the master DB and restored them on the target database with NORESTORE. I've tried turning mirroring on both while leaving them in the NORESTORE state and running an empty RESTORE ... neither seems to make much difference. Just as a test I also tried to mirror an inactive, nearly empty database that I created but that didn't work either.
I've verified that neither server is behind a firewall (they're both on the same network, although on different machines)
I've no idea where to turn next. I've seen these two troubleshooting help pages:
http://msdn.microsoft.com/en-us/library/ms189127.aspx
http://msdn.microsoft.com/en-us/library/aa337361.aspx
And as far as I can tell I've run through all the points to no avail.
One other thing I'm unsure of is the service accounts box in the wizard. For both databases I've been putting in our high-level access account name which should have full admin permissions on the database - I assumed this was the right thing to do.
I'm not sure where to turn next to try and troubleshoot this problem. Suggestions gratefully received.
Cheers,
Matt
I think that SQL Express can only act as a witness server with this SQL feature, you might get better mileage on ServerFault though.
Mike.
Your network settings might be OK. We got quite non-informative error messages in MS SQL - the problem might be an authorization issue and the server still will be saying "network address can not be reached".
By the way, how the authentication is performed? A MSSQL service (on server1) itself must be runned as a valid db user (on server2, and vice versa) in order to make the mirroring work.

Resources