Showing posts with label throughthe. Show all posts
Showing posts with label throughthe. Show all posts

Thursday, March 22, 2012

can not connect to local sql server 2005 express through jdbc

I was not able to connect to local sql server 2005 express database through
the ms jdbc driver, my local sql server 2005 server name is:
DENLAP0059987\SQLEXPRESS,
my Java code is following:
...
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
DriverManager.getConnection("jdbc:sqlserver://DENLAP0059987\\SQLEXPRESS;user
=sa;password=shanghai");
I got error message:
com.microsoft.sqlserver.jdbc.SQLServerException: Failed
Logon:com.microsoft.sqlserver.jdbc.SQLServerException: Failed connection to
named instance [sqlexpress] [java.net.SocketTimeoutException: Receiv
e timed
out]
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
.........
what's wrong with this connection string:
"jdbc:sqlserver:// DENLAP0059987\\SQLEXPRESS;user=sa;passwo
rd=shanghai"
Please advise.
Thanks
steventhe microsoft sql server beta2 jdbc driver still has bugs,but you can
do as follows:
fist Go to configuration Manager/Protocols/TCP IP, and entered a port
number (eg. 5560) as the default port, and for port value in IP1, IP2,
and IP3.
and then just write your jdbc url like this :
DriverManager.getConnection("jdbc:sqlserver://DENLAP0059987:5560;databaseNam
e=MydatabaseName;user=sa;password=shangh
ai");
don't care "\SQLEXPRESS",it's no use.
good luck!
BTW:are you lived in shanghai
steven wrote:
> I was not able to connect to local sql server 2005 express database throug
h
> the ms jdbc driver, my local sql server 2005 server name is:
> DENLAP0059987\SQLEXPRESS,
> my Java code is following:
> ...
> Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
>
> DriverManager.getConnection("jdbc:sqlserver://DENLAP0059987\\SQLEXPRESS;us
er=sa;password=shanghai");
>
> I got error message:
>
> com.microsoft.sqlserver.jdbc.SQLServerException: Failed
> Logon:com.microsoft.sqlserver.jdbc.SQLServerException: Failed connection t
o
> named instance [sqlexpress] [java.net.SocketTimeoutException: Rece
ive timed
> out]
> at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
> at java.sql.DriverManager.getConnection(DriverManager.java:512)
> at java.sql.DriverManager.getConnection(DriverManager.java:193)
> .........
>
> what's wrong with this connection string:
> "jdbc:sqlserver:// DENLAP0059987\\SQLEXPRESS;user=sa;passwo
rd=shanghai"
>
> Please advise.
> Thanks
> steven

can not connect to local sql server 2005 express through jdbc

I was not able to connect to local sql server 2005 express database through
the ms jdbc driver, my local sql server 2005 server name is:
DENLAP0059987\SQLEXPRESS,
my java code is following:
...
Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver");
DriverManager.getConnection("jdbc:sqlserver://DENLAP0059987\\SQLEXPRESS;user=sa;password=shangha i");
I got error message:
com.microsoft.sqlserver.jdbc.SQLServerException: Failed
Logon:com.microsoft.sqlserver.jdbc.SQLServerExcept ion: Failed connection to
named instance [sqlexpress] [java.net.SocketTimeoutException: Receive timed
out]
at com.microsoft.sqlserver.jdbc.SQLServerDriver.conne ct(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager .java:512)
at java.sql.DriverManager.getConnection(DriverManager .java:193)
..........
what's wrong with this connection string:
"jdbc:sqlserver://DENLAP0059987\\SQLEXPRESS;user=sa;password=shangha i"
Please advise.
Thanks
steven
the microsoft sql server beta2 jdbc driver still has bugs,but you can
do as follows:
fist Go to configuration Manager/Protocols/TCP IP, and entered a port
number (eg. 5560) as the default port, and for port value in IP1, IP2,
and IP3.
and then just write your jdbc url like this :
DriverManager.getConnection("jdbc:sqlserver://DENLAP0059987:5560;databaseName=MydatabaseName;use r=sa;password=shanghai");
don't care "\SQLEXPRESS",it's no use.
good luck!
BTW:are you lived in shanghai
steven wrote:
> I was not able to connect to local sql server 2005 express database through
> the ms jdbc driver, my local sql server 2005 server name is:
> DENLAP0059987\SQLEXPRESS,
> my java code is following:
> ...
> Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver");
>
> DriverManager.getConnection("jdbc:sqlserver://DENLAP0059987\\SQLEXPRESS;user=sa;password=shangha i");
>
> I got error message:
>
> com.microsoft.sqlserver.jdbc.SQLServerException: Failed
> Logon:com.microsoft.sqlserver.jdbc.SQLServerExcept ion: Failed connection to
> named instance [sqlexpress] [java.net.SocketTimeoutException: Receive timed
> out]
> at com.microsoft.sqlserver.jdbc.SQLServerDriver.conne ct(Unknown Source)
> at java.sql.DriverManager.getConnection(DriverManager .java:512)
> at java.sql.DriverManager.getConnection(DriverManager .java:193)
> .........
>
> what's wrong with this connection string:
> "jdbc:sqlserver://DENLAP0059987\\SQLEXPRESS;user=sa;password=shangha i"
>
> Please advise.
> Thanks
> steven