How can I access SQL server using ADO through a proxy? - delphi

I have a Delphi application that uses ADO to connect to a SQL server hosted on the Internet. The user running this application wants to access the SQL server through a proxy internally. How can this be done?

There is nothing special that needs to be done in the actual application, this is a networking problem, you would have to open some ports (1433 is the default) on the firewall for the communications to go through (going out)

Related

In Delphi 10.4 how do I provide the client tcp port to a WebBroker (TWebModule) when connecting via a TWebBroswer?

Maybe I'm not searching for the correct terms, or maybe this is not something that people usually care about but I simply cannot find out how to get the TCP Port the Client is connecting from.
I have a client that uses a TWebBrowser and an Apache server that has a Delphi WebModule running. The client connects to the URL on port 80 and somewhere in this I need to report on the port that client is using.
At the WebModule end I can collect the IP address of the incoming connection (Request.RemoteAddr) and any variables it sends in a POST body, but I cannot seem to get the port it is originating from.
I have found some explanation of this using Indy but nothing that has helped me to implement something useful at either the client or server end. I'm not sure where to go from here so any suggestions would be welcome.
Sadly, TWebRequest simply does not expose the client's port, or access to the underlying request/socket needed so you can obtain the client's port manually.
This is a limitation of WebBroker itself, not of Indy (which is one of the available backends that WebBroker can use, via Indy's IdHTTPWebBrowserBridge unit. Indy has access to the client port, but you don't have access to the Indy HTTP server that WebBrowker uses internally).

Is it possible to access Neo4J graph database with server public ip

Is it possible to access Neo4J graph database every body.
I tried localhost and router level working fine but I want give remotely to access every one so install this neo4j in Windows server R2.
My issue is, I want to give URL with public IP address like http://MyPublicIp:7474/browser/ but browse this URL getting site can't reachable.
You need to enable listening for non-local connections. And of course the port needs to be open in your firewall.
Depending on version of neo4j you use it might be:
3.0.x (you need to do this bor http, https and bolt separately):
dbms.connector.http.address=0.0.0.0:7474
3.1.x/3.2.x:
For all connectors
dbms.connectors.default_listen_address=0.0.0.0
For single connector
dbms.connector.http.listen_address=:7474
For more see the Neo4j operations manual.

FQDN in SQL connection string

We have an azure website and an azure VM
our SQL instance is on the VM.
I am trying to craft a connection string that will allow the azure site to see the SQL box
using the FQDN doesn't seem to work
any help would be greatly appreciated
Thanks
You will have to (not so wide) open a port for the SQL Server on VM. You can do this by setting an Endpoint. The good thing is that an Endpoint has a Public port (this is what Internet sees) and a Private Port (this is where the connection goes on the VM itself). Thus easily masking the default port 1433. My personal advise is that you NEVER open public port 1433 for your Server. Even in that scenario, I would advice you to use ACL on the Endpoint to only allow connections from Azure web sites in the DataCenter your web site is deployed. As stated in the last referred article, you shall not assume that traffic originating from Azure DataCentres is trustworthy, but at least you limit the attack surface for your SQL Server.
You may also evaluate using Hybrid Connections with a VM, but I never tried it.
Another side of the story is that you may want to consider using SQL Azure (sorry, Azure SQL Database) instead of maintaining own SQL Server. Then your connection will be securely established without a lot of hassle.

.Net MVC Server to Server communications

I need to do some simple comms between two sites, including the case where the same website acts as both the client and server.
The client needs to call a server function with signature something like:
complexObject GetData( int, string)
I'm on c#, .Net MVC 4.5 and running on Windows 7 for dev and & Server 2008 for hosting. I'm looking at both Websockets and SignalR, but can't decide on suitability (I don't need javsacript support, it's purely client/server). There also seems to be limitations running Websockets below Windows server 2012, and on combining client & server in the same app/website ( I could remove that requirement if its a serious issue).
Any advice on the right way to go would be great.
You cannot use WebSocket in ASP.NET unless you are using Internet Information Server 8, so you would need Windows 8 or Windows 2012 server.
SignalR will fallback to SSE, ForeverFrame or LongPolling if you are not using IIS8. SSE is unidirectional from server to client, and does not work in IE.
You can host a WebSocket component in a worker role, that runs in the same domain but in different port. Running in the same domain, the WS connection will send the cookie during the HTTP negotiation, but you would have to work out how to associate the user identity.
You can use for example:
XSocket.NET: http://xsockets.net/
SuperSocket: http://superwebsocket.codeplex.com/
That said, you can still use other technologies for communicating from server to server, like a duplex WCF channel.
A Beginner's Guide to Duplex WCF
Duplex Service in WCF
Cheers.

Trying to connect ASP.NET MVC to SQL Server 2008 R2 with possible wrong connection string

Running SQL Server 2008 R2 and ASP.NET MVC 2 web application on the Virtual Server of big german hosting-provider.
I have a problem to connect to the SQL Server.
On localhost this connection string works fine:
#"Data Source=LOCAL-HP;Initial Catalog=OnlineVertrag;Integrated Security=True";
I'm using a similar connection string on the server:
#"Data Source=MYSERVER\SQLEXPRESS;Initial Catalog=OnlineVertrag;Integrated Security=True";
but nothing happens over there.
Here is my project which I am trying to connect: http://www.hotcont.eu/OnlineVertrag/Home
Based on your comments, your SQL instance on the server has a username/password combination. You cannot use the integrated security connection for a SQL Server connection requiring SQL authentication.
Using the login information provided to you by your host, you should update your connection string to the following:
Server=MYSERVER\SQLEXPRESS;Database=OnlineVertrag;User Id=myUsername;
Password=myPassword;
Taken from ConnectionStrings.com
EDIT
Ok - I think I know what you are dealing with now. You have a virutal machine hosted on a large hosting provider -> meaning that you have control over the machine itself (aka Remote Desktop Management or something?)
The SQL connection string that I provided is for use with SQL server accounts -> meaning those that you actually create within SQL server itself. The SQL connection string that you provided uses the current logged in user's user account information from Windows to connect to SQL.
So here is the disconnection between localhost and the virtual server. When you are running on localhost, I am going to assume that you are using the built in web server to Visual Studio or some equivalent. Most often, during debugging, the web application is running under the Logged in user of the machine - aka: you. You have permission to your own SQL database, thus no issue. BUT...when you deploy your web application to an IIS instance, the web application is no longer running as the logged in user, but rather the identity of the application pool that is your app is a member of. Typically this is something like NETWORKSERVICE.
You have three options available to you
Enable and use SQL user accounts for connection from your web application and your SQL server. If you choose to go this route, you will need to use the connection string I provided above.
Login to your SQL server and add the identity of your application pool to the Allowed Users of SQL server and your database.
Change your application pool's identity to an actual user account on the server (BAD IDEA)
Most web applications go with the first option as it allows you do a few things such as create a distinct SQL user for each application that you host and as well as you can explicitly define permissions for the SQL user to each database that it may need access to (for instance, do not allow the SQL user to DROP tables).
EDIT 2
The way you are trying to connect sounds like it should be using the Shared Memory Protocol, but it might be trying to connect over TCP/IP. I forgot this earlier, but most installs of SQL are not setup to listen on the TCP/IP interface on first install. To check your configuration, click the start button (or orb or whatever Microsoft calls that now) -> All Programs -> Microsoft SQL Server 2008 -> Configuration Tools -> SQL Server Configuration Manager. This will open a new window with some options on the left hand side. Click the SQL Server Network Configuration. Ensure that TCP/IP and Shared Memory is set to enabled. If a 64 bit install, you should probably do this for both the SQL Server Network Configuration (32 bit) and the SQL Server Network Configuration
http://msdn.microsoft.com/en-us/library/ms191294.aspx
Try this
Data Source=MYSERVER\SQLEXPRESS;Initial Catalog=OnlineVertrag;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False
I hope this works for you.

Resources