Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to connect to MS SQL 2005 Evaluation version

 
michael byrd
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you configured the security settings of your MSSQL server instance to allow "SQL Server and Windows Authentication"?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic