Comment on Tutorial - JSP Example to connect to MS SQL database and retrieve records By Abinaya



Comment Added by : NT.Jay

Comment Added at : 2011-10-06 05:33:09

Comment on Tutorial : JSP Example to connect to MS SQL database and retrieve records By Abinaya
Dear Friends, I get the following exception...
java.sql.SQLException: Network error IOException: Connection refused: connect
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:410)..

My Code is....
String driverName = "net.sourceforge.jtds.jdbc.Driver";
String url = "jdbc:jtds:sqlserver://localhost:1433";
Class.forName(driverName);
DriverManager.getConnection(url);
System.out.println("Connected Successfully");

Please give the solution for that one...
Thanks...
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.thanas.test.DBSCONNECTION.getConnection(DBSCONNECTION.java:20)
at com.thanas.test.DBSCONNECTION.main(DBSCONNECTION.java:10)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:307)
at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:257)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:311)
... 6 more


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. Sir, this is very helpful for students and profess
View Tutorial          By: Pankaj Choudhary at 2010-10-19 00:24:36

2. Like every other Java recursion example, this exam
View Tutorial          By: Uriah at 2010-05-08 18:59:16

3. Once i run it gives the following error.Why "
View Tutorial          By: IDK at 2008-12-18 19:56:12

4. Copy the javax.comm.properties into your $JAVA_HOM
View Tutorial          By: sophie at 2009-03-11 08:23:25

5. A good short article on Struts. Require a step by
View Tutorial          By: Atul Saxena at 2012-01-09 19:56:59

6. If one can't use English grammar correctly and wit
View Tutorial          By: Java Man at 2011-12-09 06:04:14

7. Hi ,Razvan

I changed code as in you

View Tutorial          By: sanil at 2011-01-01 11:05:53

8. Hi Jon,

It really depends on the ap

View Tutorial          By: Hong at 2009-05-04 20:40:28

9. i am trying to run the above example in eclipse bu
View Tutorial          By: Prathyusha at 2015-03-10 11:01:06

10. if return type is different but parameters same do
View Tutorial          By: dodo at 2010-04-08 23:08:58