java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.

Jakarta, 11 November 2008

03.55 WIB

Mencoba menjalankan kelas koneksi ini :

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package northwindWannaBe;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.sql.*;
import javax.swing.*;
import java.util.*;
import java.awt.*;
/**
*
* @author user
*/
public class connectionSQLServer {
Connection con;
Statement stmt;
public connectionSQLServer(){

String url = “jdbc:microsoft:sqlserver://al-haq;DatabaseName=Northwind”;

//Connection con;

try {
Class.forName(“com.microsoft.jdbc.sqlserver.SQLServerDriver”);
} catch (java.lang.ClassNotFoundException e) {
System.err.print(“ClassNotFoundException: “);
System.err.println(e.getMessage());
}

try{
con = DriverManager.getConnection(url, “sa”, “”);
//         con=DriverManager.getConnection(“jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Northwind”,”sa”,””);

//stmt = con.createStatement();
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
} catch (SQLException ex) {
Logger.getLogger(connectionSQLServer.class.getName()).log(Level.SEVERE, null, ex);
}

}
}
===============

Namun GAGAL!

Error message :

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
===============

Link Referensi :

http://forums.sun.com/thread.jspa?threadID=622397

http://forums.sun.com/thread.jspa?threadID=419214

http://www.websina.com/bugzero/errors/sql-server-socket-error.html

Tentang Netstat :

Finding Active Network Ports Using ‘netstat.exe’

Tentang Telnet :

http://www.issociate.de/board/goto/1183765/How_to_TELNET_to_localhost.html

http://floppix.ccai.com/telnet.html

===============

Solusi :

Ternyata error pada kelasku terjadi HANYA karena salah menggunakan nama localhost.

Awalnya : al-haq (ini mah nama servernya)

Diganti menjadi : localhost:1433

Jalan deh..Alhamdulillah..

Yet another simple and stupid mistake,huh!

Tapi jadi belajar tentang netstat dan telnet.

Leave a Reply