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



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. Hi all, i have tried above code, but am getting fo
View Tutorial          By: shalini Iyer at 2008-04-22 01:20:32

2. Actually in gallery example the images can be move
View Tutorial          By: santu at 2013-02-16 12:40:29

3. i have created the main class to run the five clas
View Tutorial          By: Muraya at 2014-04-08 14:48:36

4. Hi i changed some codes in that and i gave interne
View Tutorial          By: GöktuÄŸ ÖZEL at 2013-03-13 22:44:55

5. Hi sir,
please send some sample code for sp

View Tutorial          By: Kruttika at 2015-07-07 05:14:14

6. This example really works and help a lot me to dis
View Tutorial          By: Monu Kumar at 2010-03-30 09:26:23

7. Hi thanks for your information.

I g

View Tutorial          By: karthikeyan at 2009-09-18 04:50:37

8. Is there any way to show the dynamic bean value in
View Tutorial          By: Bala at 2008-05-04 01:40:18

9. Hi!
Any body have code for recieving sms fr

View Tutorial          By: Haseeb at 2009-07-01 04:59:13

10. very good site for qustion answer. I just spellbo
View Tutorial          By: Anindya Mitra at 2012-04-22 16:28:42