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. i need save,delete,update use arrayList.
th

View Tutorial          By: kyaw at 2010-04-07 01:55:02

2. You have simply saved my life. After 2 days dealin
View Tutorial          By: M├írio Buratto at 2013-01-11 19:54:36

3. I want to change software of micromax x455 mobile
View Tutorial          By: Sachin at 2012-12-29 09:39:58

4. Nice one , Compailed no Errors ... but when execut
View Tutorial          By: Diamant at 2012-12-04 00:17:11

5. This is a nice introduction. Thanks a lot.
View Tutorial          By: Provas Kumar Saha at 2010-04-26 02:38:34

6. Thanks a lot!!!.Quite helpful article.
keep

View Tutorial          By: Raj at 2008-03-14 03:59:56

7. i have been trained in java stream. But i dont kno
View Tutorial          By: savio at 2013-01-23 10:15:51

8. HI I've been gettin this problem in STEP 6...How d
View Tutorial          By: Omar_sito12 at 2010-02-22 08:46:18

9. where i can find Messageressourse.properties......
View Tutorial          By: sanjiv at 2013-09-07 06:59:19

10. i want to know java coding
View Tutorial          By: carmela azarce at 2012-08-08 02:47:13