This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes Not able to connect to MS SQL 2005 Evaluation version Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Not able to connect to MS SQL 2005 Evaluation version " Watch "Not able to connect to MS SQL 2005 Evaluation version " New topic
Author

Not able to connect to MS SQL 2005 Evaluation version

michael byrd
Greenhorn

Joined: Jan 21, 2006
Posts: 23
Hi,

I have installed MS SQL 2005 Evaluation version(downloaded from microsoft site) on my win2k3 Enterprise Edition I am writing a java application that connects to MS SQL 2005.

I have downloaded the MS SQL 2005 JDBC driver. And i unjarred the
I have unjarred the sqljdbc.jar file and kept the com folder and my .java file in the same folder.

When i am trying to connect, I am getting the following error:

-------------
com.microsoft.sqlserver.jdbc.SQLServerException: Failed Logon:com.microsoft.sqlserver.jdbc.SQLServerException: TCP/IP connection failed to host:155.35.54.160 java.net.ConnectException: Connection refused:connect
-------------

My code look like this:
---------------------------------------
try {
Class.forName ("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String fs = File.separator;

String conn_str = "jdbc:sqlserver://155.35.54.160:1433;user=sa;password=SA;databaseName=asdb";

conn = DriverManager.getConnection ( conn_str );
}
catch (Exception e) {System.out.println(e); }


Please reply.
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
Is your MS SQL server on the same machine as you are running your code on, or are they on different boxes? If different boxes, I'd check for a firewall configuration problem. Don't use win2k3, but on winxp you hit that problem.


Reid - SCJP2 (April 2002)
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Have you configured the security settings of your MSSQL server instance to allow "SQL Server and Windows Authentication"?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Not able to connect to MS SQL 2005 Evaluation version