Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMD test database connection

I setup a site on my localhost and I am getting unable to connect to database errors. (its not my local database) and now I am trying to connect to that database in the command line to see if its a firewall issue or php issue.

Whats the command to test a database connection (not local) in cmd?

like image 610
user2499454 Avatar asked Aug 22 '26 21:08

user2499454


2 Answers

Here is a quick way you can test for database connectivity with no other database software installed :

  1. Create a new text file anywhere on the computer
  2. Rename the file and make the extentsion .udl (TestConnection.udl)
  3. When prompted about changing the extension select "Yes"
  4. Double click the file and Boom! Instant database connection tool

enter image description here

like image 174
Mike Circuitry Avatar answered Aug 25 '26 16:08

Mike Circuitry


It depends on what kind of database are you trying to connect to.

e.g. if you're connecting to Oracle db you may use something like this:

sqlplus <user>/<password>@<service>

if it's a Microsoft SQL Server you may use

osql -U<user> -P<password> -S<instance>

If you just want to test network ports to be sure no firewall is preventing connection, you can use telnet tool,

telnet <server-address> <service-port>

(default tcp port for Oracle db service is 1521, for SQL Server's 1433)

like image 26
Luca Clavarino Avatar answered Aug 25 '26 18:08

Luca Clavarino