aspose file tools*
The moose likes JDBC and the fly likes jtds error while connecting to MS SQL server 2008 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jtds error while connecting to MS SQL server 2008" Watch "jtds error while connecting to MS SQL server 2008" New topic
Author

jtds error while connecting to MS SQL server 2008

prathamesh bandivadekar
Ranch Hand

Joined: May 22, 2008
Posts: 43
Hi All,

I am trying to connect to MS SQL 2008 server using jtds.

Class.forName("net.sourceforge.jtds.jdbc.Driver");

Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/tempdb","sa","");

MSSQL server is running.

But i am getting

java.sql.SQLException: Network error IOException: Connection refused: connect

I am stuck with this error for one whole day . I want to do some Hibernate and JDBC conection trials too.

Can anyone suggest the root cause?

Note: CLASSPATH variable is set with jtds.jar


Prathamesh M.B.<br />Java....only.....
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Is SQL Server configured to accept connections over TCP/IP? Why are you trying to connect to the tempdb? If your username and password correct?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
prathamesh bandivadekar
Ranch Hand

Joined: May 22, 2008
Posts: 43
I dont have any idea about that!

Can you please tell me how to check whether my MS SQL server is configured for that or not?

I think it is easy to work with Oracle rather than working with MS,they alwayz make things complicated!

Oralce do not have such config for TCP/IP!
Shantanu Puranik
Ranch Hand

Joined: Jun 10, 2004
Posts: 67
Have you checked jtds faq?


--- Shantanu
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Use SQL Server Configuration Manager to check. By default, SQL server is not configured to allow connections over TCP/IP.



I think it is easy to work with Oracle rather than working with MS,they alwayz make things complicated!

never heard anyone call Oracle easier to configure than SQL Server before.
prathamesh bandivadekar
Ranch Hand

Joined: May 22, 2008
Posts: 43
The problem is resolved.

I have uninstalled MS SQL server from my machine!

I dont want that programe running on my machine!

Making things complicated and dependant is the legacy of MS!

Using MySQL now!
 
wood burning stoves
 
subject: jtds error while connecting to MS SQL server 2008