Reputation: 197
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?
Upvotes: 6
Views: 48029
Reputation: 890
Here is a quick way you can test for database connectivity with no other database software installed :
Upvotes: 23
Reputation: 200273
It depends very much on which database you want to connect to. MySQL? Oracle? PostgreSQL? SQL Servrer? DB2? Filemaker? Informix? One thing you could try is opening an ADO connection with VBScript:
Set conn = CreateObject("ADODB.Connection")
conn.Open "..."
WScript.Echo conn.State
conn.Close
Replace "..."
with a connection string matching your database.
Upvotes: 0
Reputation: 434
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)
Upvotes: 7