How to scan/search for active SQL Server instances with Java? - sql-server

Is there an easy way, using Java, to scan/search the local network for SQL Server database instances?

You can get source code from the free SQLPing tool to port into Java if you want.
This uses several techniques for SQL Server discovery because there is no foolproof method.
Examples:
what port is the instance on and SQL Browser is turned off?
is the server configued with shared memory only
SQL Services not running

Related

Accessing database ports that are required to be closed due to PCI Compliance on Windows Server 2008

I've got a client that is hosted on a dedicated Windows 2008 Server that we look after. They have recently failed a PCI Compliance check which is asking that we close the ports for SQL Server and MySQL (1433 and 3306).
If we do this we'll loose access to the database from all the hosted website on the server. Is there a way around this or can we connect to the databases whilst still closing the ports?
Thanks
Yes, you can change the port for SQL Server to use a non-default port setting. As long as the port for the SQL Server browser remains open, instances will still be able to retrieve the correct SQL port from the server instance. This is now named instances of SQL Server function while using a dynamic port.
http://support.microsoft.com/kb/823938

running program in computers without sql server

Is it possible to run a program in which a SQL Server database has been used in other computers where "SQL Server" has not been install?
Certainly, you'd change the connection string to connect to a remote server like this:
Server=RemoteServerName;Database=DatabaseName;...
and in fact, that's the most common production configuration. A shared database amongst multiple users.
The answer is YES. The only thing you need to do is to point where the Microsoft SQL Server is placed. Of course, you need to configure the server to accept remote connections and that the client you're tring to connect has internet access.
Configure SQL Server to accept remote connections
Guessing that you use c#...
Connection strings for c#

IP Access to SQL Server

We have a Windows VPS server using SQL Server 2005 for our e-commerce site.
A while back we were suffering from attempts to access the database remotely so someone made changes so that only the IP of the server itself could access data. That was about 18 months ago and everything has been fine since.
However, we now have a second site (hosted on another VPS) that needs to access the same database and I can't get in contact with the person who made the original changes.
I know he was working in the SQL Server Management tool when he made the changes, can anyone point me in the correct direction.
Thanks.
SQL Server 2005 came locked down by default. Rather than SSMS, it also installs the SQL Server 2005 Surface Area Configuration tool, which has a Remote Connections setting where you can limit it to Local connections only.
You may also like to check any firewall on the server, which will have to allow Port 1433 (or different if changed from the default) TCP access from whichever machines you want to access it.
He might have turned the TCP/IP protocol off. In this case only the localhost can access the database. This link describes the procedure for sql server express, but the idea is the same

connect sql server 2005/2008 over internet

How do I connect to SQL Server 2005/2008 using Management Studio or other desktop application over the internet?
Check out WCF Data Services:
http://msdn.microsoft.com/en-us/data/bb931106.aspx
That way, you don't have to totally expose your database server out to the internet, but you get fine grained control over what gets exposed and who (which type of user) can see or modify what.
Marc
I finally solved this by:
Changing default SQL Port to 8080 from 1433 (our ISP was blocking)
Turning off Windows Firewall on the server. I know this is not a long term solution, but at least I was able to pinpoint the problem. I had set two inbound firewall rules to allow port 8080 and SSMS program, on the server. I created an outbound firewall rule on the client for SSMS (but don't think this mad a difference).
I had to change all apps to use the new port instead of the default port. I had to configure our router to handle the new port 8080 and forward to the database server.
I will modify the Windows Firewall settings to see what was blocking SSMS.
DB Server: Windows 7 Pro 64bit 24 GB RAM
If you put 'your' SQL server (any brand, I'm not bashing) on the internet ... it won't be yours for long, unless you add some rather effective security measures ...
I suggest you look into VPN.
To be able to access your database over the internet, you will need to make sure that the server that hosts the database is accessible over the internet and the port that the database instance uses is open on that machine. You will also need to allow remote connections using the SQL Server Configuration Tool.
For Management Studio access I would recommend rather than opening the server to the outside to use a VPN solution that allows you to create a secure connection to the server and from there you can use the server name or IP to connect as if your machine is part of that network.
For the desktop application I would recommend looking into having the data be consumed through a web service or WCF rather than needing to have a direct connection to the database over the internet.
Hope this helps.
Firstly, if we put security consideration on the side, you have to configure SQL server (sql surface area configuration) to accept traffic, then you have to open proper ports on you server and allow inbound traffic thru to your router to the SQL server.
When you open sql server management studio in connect to server window and at the server name type the IP of your server and enter your username and password.
correct format : IP\InstanceName
you should have a user on target database.

How to connect to SQL Server through proxy server

Is it possible to connect to SQL Server server through proxy (http) using SQLSERVER oledb provider?
How can I specify proxy address and port in connection string if it's possible?
What nonstandard methods to bypass proxy you'd recommend if it's not possible?
This article seems specific to MS ISA servers, but the theory may hold.
2008
http://msdn.microsoft.com/en-us/library/ms190801.aspx
2005
http://msdn.microsoft.com/en-us/library/ms190801(SQL.90).aspx
edit:
Perhaps a sql 2005 web service would fit your needs?
http://technet.microsoft.com/en-us/library/ms345140(SQL.90).aspx
It won't give you normal odbc functionality though. You shouldn't be exposing your SQL server to the internet btw.
Also, see comment.

Resources