Shiny - My Redshift Database Won't Connect Once Published - r

My Shiny application connects to my Redshift instance locally, but I get the following error when I try to run the application once I publish it to shinyapps.io
Warning: Error in connection_create: could not connect to server:
Connection timed out
Is the server running on host "redshift.bi.tmmp.io" (23.23.70.97)
and accepting TCP/IP connections on port 5439?
How would I allow connection to pass once published online?

A time-out normally indicates that the application could not connect to the server (as opposed to the server rejecting the connection).
You should start by checking the Security Group associated with the Redshift instance to confirm that it will accept incoming connections from the application.
The best configuration is:
A Security Group on your application instance (App-SG), which is associated with the application instance(s)
A Security Group on the Redshift instance (DB-SG) that permits inbound Redshift (port 5439) connections from App-SG, which is associated with the Redshift instance
That is, the Redshift security group refers to the application security group.

Related

GCloud - Connecting App Engine Flex to Cloud SQL in other project

I'm trying to connect my app engine flex service to the cloud sql database that is in a shared project.
I have added the app engine default and app engine flex user as SQL admin to the shared project.
Now I'm trying to connect the app engine container to the cloud sql instance with the following connection string:
"Server=cloudsql;Database=cliche;User Id=user;Password=password;"
However, the connection always fails with the given connection string.
[13:57:37 ERR] An error occurred using the connection to database 'cliche' on server 'cloudsql'.
[13:57:37 ERR] An exception occurred while iterating over the results of a query for context type 'IKL.Data.ApplicationDbContext'.
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
As requested I provide the app.yaml here:
runtime: aspnetcore
env: flex
service: platform
manual_scaling:
instances: 1
resources:
cpu: 2
memory_gb: 1.5
disk_size_gb: 10
beta_settings:
cloud_sql_instances: shared-resources-291914:europe-west3:edutec-mssql=tcp:1433
I found your issue! Your connexion string "Server=cloudsql;Database=cliche;User Id=user;Password=password;" isn't correct.
Cloud SQL proxy open a tunnel. one side of the tunnel is the Cloud SQL instance, the other is your local instance. Therefore you have to connect on the local host
"Server=127.0.0.1;Database=cliche;User Id=user;Password=password;"
If you are using VPC Peering between your App Engine Flex project and your Cloud SQL project, then I must inform you that this is not possible to do yet, when you use an internal IP on your Cloud SQL, it will automatically use a VPC peering (different from the one you are probably using), and traffic between 3 VPC peerings is not posible.
You can use a VM in your Cloud SQL project to serve as a NAT server to route traffic onto your Cloud SQL there in order to workaround this, or you can use a Cloud VPN between your App Engine and Cloud SQL project, if possible please make sure that the NAT VM is in the same region as your Cloud SQL server or that the VPN on your SQL project is on the same region as your SQL server.
Also, please keep in mind that you would need to have the appropriate GCP firewall rules on all the involved GCP projects.

AS/400 DDM service not running

I wanted to make a ODBC connection from Windows PC to AS/400 DB2 server and I wrote a VBA program. But I got the following error.
Remote port could not be resolved
Then, I checked the status of server with CWSPING and got the result below:
I - Verifying connection to system 192.168.1.2...
I - Successfully connected to server application: Central Client
I - Successfully connected to server application: Network File
I - Successfully connected to server application: Network Print
I - Successfully connected to server application: Data Access
I - Successfully connected to server application: Data Queues
I - Successfully connected to server application: Remote Command
I - Successfully connected to server application: Security
E - CWBCO1011 - Remote port could not be resolved
E - CWBCO1008 - Unable to connect to server application DDM, returned 8407
I - Successfully connected to server application: Telnet
W - CWBCO1015 - Connection verified to system 192.168.1.2, but there were warnings
This means DDM service is not working on the server. ODBC connection requires DRDA, which runs upon DDM service, so I think running DDM service is the key to make ODBC connection. So I tried STRTCPSVR *DDM command but got the result below
*DDM not valid for parameter SERVER
And also tried CHGDDMTCPA AUTOSTART(*YES) PWDRQD(*YES) command, but got an error and I got stuck.
Command CHGDDMTCPA in library *LIBL not found
Does anyone have an idea of enabling DDM server on AS400?
Server: IBM AS400
OS version: V4R1
Try STRHOSTSVR *DATABASE.
STRHOSTSVR is used to start servers associated with IBM i Access and i Access Client Solutions.
STRTCPSVR is used, in general, to start servers associated with TCP/IP like FTP, Telnet, etc. Except the HTTP Server which is started via the Web Administration site at http://<server>:2001.
Additionally to the answer from #jmarkmurphy:
You can easily check netstat *cnn for open ports.
There is actually a tcpsvr named *ddm but that isn't used with ODBC.
ODBC-Access only needs host server *database. There aren't any further requirements for host servers.
For checking which services are started at tcp startup time, use strfdu, option 5 with the file qusrsys/qatocstart. From there you can easily view and change what should be started and what not.
Finally, I got connected by using JDBC. The summary of what I found is as follows:
ODBC seems using DRDA(port 446) but the server does not have DRDA/DDM service
OLEDB seems connecting Data Access(port 8471) but issued unknown error
JDBC also connection Data Access(port 8471) and it worked!
The first error I encountered when using ODBC is "Remote port could not be resolved". What happened behind this seems as follows:
ODBC asked Server Mapper(port 449) to find DRDA port(it may change on a server)
Server Mapper could not find DRDA port because the server has no DRDA service
ODBC showed "port not resolved" error
Then, I tried OLEDB this time. It checked user/password correctly but issued unknown error. When I put incorrect password, it showed "password is incorrect", which means OLEDB successfully log on to the server but got some error after sign on.
The last, I used JDBC and successfully connected! Generally, the connection url is like "jdbc:as400://" but it showed error. Using trace of JDBC, it seems to have problem on sign on to the server. So I changed the url to "jdbc:as400://:8471", then I finally connected. Looking into trace, it directly access to port 8741 and send user/password and get connected. I don't know the detail, but it worked!
Appreciated for your help!

JDBC SQL Server Exception while setting up WSO2 API Manager 2.2 with SQL Server Express

I am configuring a SQL Server Express database as mentioned in the link
The master-datasources.xml file has been appropriately changed. However, when I try to start the WSO2 API-M 2.2 server (<*PRODUCT_HOME>/bin/wso2server.bat -Dsetup), I am getting the following exception -
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the host xxx.xx.xxx.xxx, named instance \new_instance_exp failed.
Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:191)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.getInstancePort(SQLServerConnection.java:5247)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.primaryPermissionCheck(SQLServerConnection.java:1871)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1608)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1168)
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:278)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:730)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:664)
at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:200)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)
at org.wso2.carbon.utils.dbcreator.DatabaseCreator.createRegistryDatabase(DatabaseCreator.java:58)
... 20 more
I have verified that the SQL Server Browser Service is running on the host.
Note: The APIM databases I am creating are not on the default instance (which use the the default port 1433). I have created a new instance in the same SQL Server with a custom port and I have configured the settings for TCP and Named Pipes (disabled) in the SQL Configuration Manager.
I am using the recommended SQL driver (sqljdbc4) as mentioned in this link - https://docs.wso2.com/display/ADMIN44x/Setting+up+Microsoft+SQL

Why I am not able to connect to remote SQL Server from asp.net website whereas it is connecting from SQL Server Management Studio

Why I am not able to connect to remote server from asp.net website whereas it is connecting from SSMS
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
I tried all the possible solution suggested in this link
I checked Followings as given in the above article, they are enabled/running
SQL Server is up and running.
TCP/IP enabled in SSCM
Opened port in Windows Firewall
Remote Connection enabled
SQL Server Browser Service running
I searched for sqlbrowser.exe but it is not found in the given directory.
Finally I switched off Windows Firewall but still it is not working.
UPDATE: we are connecting to sql server using a custom user created on sql server (not sa )
I have user account credential to Remote connect to server.
I tried to change LogOn to my credentials (administrator) . in Windows Services SQL Server (MSSQlServer) and SQL Server Agent (MSSQL Server) services.
Double check your connection string - are you connecting to a hostname that needs to be added to your Hosts file? For example "dev-sql1" but without a matching entry in dns or hosts file.
If you have created a custom user, can you check if logins are disabled for the user?
In SSMS, goto Security, right click user, Properties -> Status, Login - Enabled.
Hope this should fix it.
Three possibilities and they are not mutually exclusive.
Most hosting providers disable remote connections to SQL servers. Check with RackSpace if blocking port 1433
The SQL Server needs to be reconfigured to accept remote connections. See http://support.microsoft.com/kb/914277
You have to use a different connection string. See http://www.connectionstrings.com/sql-server and look for Connect via an IP address
I got the same issue but with mysql server. Rack space had two mysql server address. One for connecting from outside their local network and one for connecting from inside the network. you will have to use the address that is required to connect from inside the network.

Can't connect to local SQL Server 2005 when plugged into corporate network

This has me stumped. I setup SQL Server 2005 on my development laptop and connected an ASP.NET application to it the other day at home. It is configured with SQL Server Authentication, Remote access is enabled for both TCP/IP and named pipes along with a static IP. Both my application and SQL Server Mgmt Studio Express could connect to it fine.
Then when I came into work today my application can not connect to the local database. Mgmt Studio can connect fine. I get the following error on connection.Open():
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)"
This is the connection string:
Data Source=localhost\\SQLEXPRESS,1433;Initial Catalog=Community;User ID=sa;Password=password;Pooling=True;Min Pool Size=0;Max Pool Size=100;Packet Size=8192
Here is the weird part if I disconnect from the network (unplug the lan cable) I can connect to the database. And after that initial connection is made I can even plug back in the cable and continue to query the database. If I restart my application once it is blocked.
I've disabled Windows Firewall completely and have exhausted my options. Any thoughts?
Try using ".\SQLEXPRESS" instead of "localhost\SQLEXPRESS"

Resources