Showing posts with label establishing. Show all posts
Showing posts with label establishing. Show all posts

Saturday, February 25, 2012

Connecting SQL Server Express.......uuhhhhh....

following is the error that I get:

"An Error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server dows not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) "

I have following fields that I am supposed to fill:

1) Data Source : Defauld value "Microsoft SQL Server (SqlClient)"

2) Server Name: Empty - I am supposed to enter something. It has a button says Refresh. I entered localhost as you suggested, but not to avail.

3)Select or enter a database name: I am entrying SQLEXPRESS which is the default name of my SQL server. It is not working.

No, there is only one instance of the server.

I guess this information will help you to help me.....:-)

Have you used the surface area configuration tool to allow remote connections to SQL Server?

-Jamie

Sunday, February 19, 2012

Connecting JDBC with SQL Server, error establishing socket

I have tried everything..I cant get Java to connect to my sql
server...
heres the code I altered provided my microsoft to test this connection:
import java.sql.*;
class test {
public static void main(String args[]) {
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLSer verDriver").newInstance();
Connection conn = DriverManager.getConnection(
"jdbc:datadirect:sqlserver://dbserver:1433;DatabaseName=sample",
"sa", "");
conn.close();
System.out.println("ok");
}
catch (Exception e) {
e.printStackTrace();
}
}
}
Heres the error messages:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error
establis
hing socket.
at com.microsoft.jdbc.base.BaseExceptions.createExcep tion(Unknown
Source
)
at com.microsoft.jdbc.base.BaseExceptions.getExceptio n(Unknown
Source)
at com.microsoft.jdbc.base.BaseExceptions.getExceptio n(Unknown
Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<in it>(Unknown
Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnecti on.open(Unknown
Sou
rce)
at
com.microsoft.jdbc.base.BaseConnection.getNewImplC onnection(Unknown S
ource)
at com.microsoft.jdbc.base.BaseConnection.open(Unknow n Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager .java:512)
at java.sql.DriverManager.getConnection(DriverManager .java:171)
at test.main(test.java:12)
thanks
It appears that you do not have access to your db server machine.
try ping command for the IP address.
This has to do with the network settings.
I use MSSQLServer driver and It seems that my DB-URL is different.
DRIVER=com.microsoft.jdbc.sqlserver.SQLServerDrive r
URL=jdbc:microsoft:sqlserver://localhost:1433;SelectMethod=cursor
this works fine.
Message posted via http://www.sqlmonster.com