This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to connect to MS SQL 2005 Evaluation version
 
Similar Threads
basic SQL connection steps
Problems regarding MS JDBC Driver and JTDS-JDBC Connectivity for MS SQL Server 2000
Weblogic 7.0 with MS Sql Server 2000
Trouble Connectiing
Can't connect to SQL server 2005