Trying to set up a data source in ColdFusion - coldfusion

I'm trying to create a data source for my local sql server using the server name (local). But I keep getting the following error
Connection verification failed for data source: sqlserver
java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC Driver]Error establishing socket. Unknown host: (local)
The root cause was that: java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC Driver]Error establishing socket. Unknown host: (local)
On the reporting services I'm using (local) as the server name and it is working fine,
Ted

Have you enabled external TCP connections on your sql server?
Try using localhost instead of local. (or add 127.0.0.1 local to your hosts file)

You can't use (local) this is a Microsoft ONLY term and won't be understood by anything external.
You need to specify the servername as the name of the server.
If the SQL Server is the same server as ColdFusion you can then use localhost
If not use the DNS or local IP name of the sever, ie sql.local or 192.168.1.22
If the server is external to your You will need TCP/IP configured and port 1433 open also. But by default this should be setup, you may just need to open your firewall to allow access through port 1433.
In a network environment, you would normally use local IP to get LAN access to your DB, but if database is really external you need a real IP / domain

Related

Can't access PowerBi Report Server from outside of Network

Scenario
I'm using Power Bi Report Server - Developer (15.0.1107.116) which is directly connected to Microsoft SQL Server 2008 Database and Microsoft SQL Server 2019 Database, the Operating System is Microsoft Window Server 2019 with Internet Information Service (IIS). IIS already has /RDWeb web portal on 443 port and PBiRS is also on 443 port, both with legit SSL Certificate. Locally both /RDWeb and /Report are accessible in the local area network. I'm also able to connect to IIS main web page from outside of network.
Issue
I can connect with the Report Server /Report web portal on Local Network but when I try to connect to /Report from outside of the network, I get an error of 404 though the same /Report is accessible from Local Area Network.
Points to Note
Firewall is off of (Domain/Private/Public)
Server is in DMZ
IIS Main Webpage is accessible from outside the network
Only /Report is not accessible from outside network
Please keep in mind that this guide is of HTTP 8080 insecure protocol based.
Before starting, I'm assuming that the Power Bi Report Server service running properly, the database is connected successfully and Web URLs are not yet set.
Steps
Go to Web Service URL tab and click APPLY.
Note: Once applied, you will see a link on the same page.
Similarly go to Web Portal URL tab and click APPLY.
Note: Once applied, you will see a link on the same page. The virtual directory is actually sub directory for accessing Power Bi Report Server web portal.
Things to keep in mind.
Database should be SQL Server 2012 or later.
Port 80 must be allowed in Firewall for inbound traffic.
Port 80 must be forwarded in the modem.
You must have public Static IP from your ISP.
Now you can check for localhost as http://localhost/virtual-directory and hopefully it will work, then you can check with your public static ip like http://your-public-static-ip/virtual-directory where in this case virtual_directory is Reports from step 2.
Examples
In case if virtual_directory is Reports from step 2.
For Local: http://localhost/Reports
For Public: http://your-public-static-ip/Reports

GCP ProxySQL and BasicDataSource connection pool

I have an issue with a java BasicDataSource connection pool.
My ProxySql is correctly configured on all my DataProc Compute engine, if I try to connect to my CloudSql instance with sqlclient it works correctly.
When I try to connect to my CloudSql from my connection pool, configured with this connection string: pooljdbc:mysql://127.0.0.1/my_db?serverTimezone=UTC, I get this error:
Cannot create PoolableConnectionFactory (Access denied for user 'myuser'#'localhost' (using password: YES))
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'myuser'#'localhost' (using password: YES))
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
And is correct because the proxySQL tcp connection is on 127.0.0.1 and not on localhost (unix socket).
I don't understand why the BasicDataSource try to connect on localhost and not on 127.0.0.1 as I have configured in the connection string.
Any help is really appreciated.
The string 'myuser'#'localhost' is referring to your login identity, not the server connection string; if you ran your connection attempt from a machine called foo-instance, for example, even if you use a connection string specifying a remote IP address, your login would be 'myuser'#'foo-instance'. While direct connections using your sqlclient will resolve the source hostname differently based on the server hostname specified, this is a quirk that shouldn't be relied on. In particular, in your case the ProxySQL service will be acting on your behalf, so the source hostname will come from the ProxySQL instance, not from your connection string.
You may want to share more details on your ProxySQL configuration, but if you're using defaults, your PROXYSQL_HOSTNAME would be set to localhost; you could try ensuring your PROXYSQL_HOSTNAME is set to 127.0.0.1 instead.
Interestingly, based on cursory testing, it appears creating user grants identified by 127.0.0.1 is more restrictive to login host, while creating the grant for localhost allows both 127.0.0.1 and localhost for connection hostnames:
MariaDB [(none)]> create user 'dhuo'#'127.0.0.1' identified by 'dhuopass';
...
$ mysql -h localhost -pdhuopass
ERROR 1045 (28000): Access denied for user 'dhuo'#'localhost' (using password: YES)
$ mysql -h 127.0.0.1 -pdhuopass
Welcome to the MariaDB monitor. Commands end with ; or \g.
...
MariaDB [(none)]> drop user dhuo#127.0.0.1
MariaDB [(none)]> create user 'dhuo'#'localhost' identified by 'dhuopass';
...
$ mysql -h localhost -pdhuopass
Welcome to the MariaDB monitor. Commands end with ; or \g.
$ mysql -h 127.0.0.1 -pdhuopass
Welcome to the MariaDB monitor. Commands end with ; or \g.
Generally it'd probably work best to configure your user grants to be identified as coming from localhost instead of 127.0.0.1 to have the best chance of supporting either inbound hostname.

OperationalError, connecting to another Django/DB project

I'm trying to connect to another database (project-B) that also uses Django. I would like to ask for help on how to resolve the following error?
Here's the error from Django debug:
could not connect to server: Connection refused Is the server running
on host "111.222.333.444" and accepting TCP/IP connections on port
5432?
Here's the firewall from project-B
Status: active Logging: on (low) Default: deny (incoming), allow
(outgoing), disabled (routed) New profiles: skip
To Action From 5432
ALLOW IN 111.222.333.444
I also put it in the allowed host
ALLOWED_HOSTS = [ '111.222.333.444']
Other than that, I have not modified anything from project-B.
The firewall allows requests from 111.222.333.444, which is effectively blocking all hosts other than same host connection.

How to get original endpoint?

I have set proxy for my browser to my application hosted on localhost
this is a short snippet of the program
boost::asio::io_service ios;
ip::tcp::acceptor acceptor(io_service_,ip::tcp::endpoint("127.0.0.1", 12345))
ip::tcp::socket socket(ios);
acceptor_.async_accept(socket,
boost::bind(&acceptor::handle_accept,
this,
boost::asio::placeholders::error));
where this is my acceptor object.
How could I get origin request destination host and port of request redirected to my application?
Full code is here https://github.com/ArashPartow/proxy/blob/master/tcpproxy_server.cpp
You're pointing the "full code" link to a github repository from someone else. This code example accepts connections on a local port and will forward them to a remote machine. E.g. a connection on localhost to a remote webserver or a connection on your local port 8080 to a remote webserver.
On its command line, you provide the information where to listen for a connection (local) and where to connect to (remote).
I have a strong feeling you want something else: the inbound connection to tell you where to connect to (instead of a fixed remote). That's beyond this simple piece of C++ code.

WebService timeout

I have a problem with deploying my web service in our Web server. In my
development machine (inside of our LAN), everything works fine. When I move
the application into our Web server (public addressed), I always get the
timeout exception. while i connecting the web service through my web browser it works fine with no issues, but through application am getting the timeout error. My app connects to our database server (inside of our LAN) to get statistical data in form of datasets. can i know the issue about this point.
That is most likely a firewall/port forwarding issue.
Did I understand you correctly: Your client application connects to the database server directly?
You should check which port you are using to connect to the database server.
Then check if the web server has an active firewall and if so, configure it properly to accept connections on that port.
You can always easily check if a port is open and reachable by using telnet:
On the command line type telnet MY_IP MY_PORT.
If a connection can be established the port is open.