static final String dbURL =
"jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=DBServer";
static final String user = "sa";
static final String pwd = "sa";
I am getting: "Error establishing socket"......any help??
Java
Last Comment
mte01
8/22/2022 - Mon
CEHJ
Make sure the server is running on that port on the local machine
mte01
ASKER
I couldn't find the place where I could verify in Microsoft SQL Server that it is running on port 1433.......but this is what is supposed to be doing, I have just installed it with the default settings.
bloodredsun
Are you sure that that is the correct URL for the database?
>>I couldn't find the place where I could verify in Microsoft SQL Server
netstat -a | find "1433"
No output means it's not running
mte01
ASKER
Yes....this is the correct URL of the DB (it's name is DBServer, the port is 1433 , and these are the username & pwd & and everything else is from the driver........)
I just checked it on the GUI...it's 1433.........but it doesn't appear on the netstat list.............
CEHJ
You used the command exactly as i mentioned?
mte01
ASKER
Yes CEHJ...........it didn't return anything.........& I also checked the whole list.................does it affect if I am uisng Win XP Home Edition??
So what protocols are enabled?
And what port is it listening on?
gnoon
mte01,
I ever got a problem that seems to be like your case. If I enabled both Named Pipes and TCP/IP and let TCP/IP on top of the list .. I could start SQL service but nothing running on port 1433 (as I configured). If I enabled only TCP/IP on port 1433 .. I couldn't start the service and an error shown in event viewer .. the error was
I thought the error telling me that SQL Server couldn't get IP Address of database server by computer name.
It's true! I couldn't ping my computer by computer name. My solution is I open file C:\WINDOWS\system32\drivers\etc\hosts and then put a mapping of computer IP and name there, then started the service again.
Of couse, it worked like a charm ... I could start the service with TCP/IP on port 1433. Then, my java app could connect to the service. Happy ending :-)
Right now I don't have the computer where the problem is with me,.
>>gnoon
Although I checked the system log for SQL Server, there was no problem, but I'll do the steps that you followed (later), and I'll see what happens.
What happens when you take the DatabaseName out of the connection String?
mte01
ASKER
I haven't tried it, and I can't try it now because the PC with the problem is not with me..........but I tried another DB, and the problem was the same............I'll be trying it if you want later..........
Well actually, my friend who had the problem on his pc (which we were working on it) decided that we would work with sql server on another pc, so he removed sql server from his pc