日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

使用JDBC连接SQL Server 2000 命名实例(Named Instance)

發(fā)布時間:2025/7/14 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用JDBC连接SQL Server 2000 命名实例(Named Instance) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

????????最近比較閑,就愛擺弄一些玩意,前時間對ruby on rails比較感興趣,就想繼續(xù)看看,但是系統(tǒng)壞了好幾次,前段時間配好的eclipse+rdt+sqlserver的環(huán)境也就得重新diy了;
????????按照 Setting up a Rails Development Environment on Windows Using Eclipse上的步驟,一步一步走的挺順利的,可是到Install the DBEdit Eclipse plugin的時候,想恢復以前的直接連接自己比較熟悉的SQL Server 2000,可是死活也無法連上,老是報[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.錯誤,起初以為是沒有打sp3包,就干脆重新安裝了個msde sp4的命名實例,可是懵了,怎么連命名實例啊,想起總是用net start mssql$InstanceName 啟動命名實例服務,突發(fā)其想以為可用jdbc:microsoft:sqlserver://serverName$InstanceName:Port來連接還是報[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.錯誤,說明猜想不對,google了一下找了n多資料一直沒有解決,最后在msdn上發(fā)現(xiàn)有這么篇文章How To Connect to a SQL Server 2000 Named Instance with JDBC??找到解決方案了:

?To find the SQL Server instance port number, follow these steps:

1.On the Microsoft SQL Server 2000 server, start the SQL Server Network Utility.
2.Click the General tab, and then click the instance you want from the Instances drop-down menu.
3.Click TCP/IP, and then click Properties. Note that the port number for this instance appears in the Properties dialog box.

As soon as you have this value, you can use it in your connection URL when you connect to SQL Server through JDBC. The following is an example of a typical connection URL:

jdbc:microsoft:sqlserver://yourServerName:1433;user=yourUser;password=yourPwd

??????也就是說不是用jdbc:microsoft:sqlserver://serverName$InstanceName:Port這個主觀臆造的URL來連接,而是使用上面的串,其中yourServerName是服務器名,1433應該替換成你命名實例的端口號,在這個url中根本體現(xiàn)不出命名實例名,比如我的連接url:jdbc:microsoft:sqlserver://oy-m:2046(我新安裝的命名實例為ruby,端口號為2046),就這么簡單……

轉載于:https://www.cnblogs.com/Hedonister/archive/2006/09/11/501387.html

總結

以上是生活随笔為你收集整理的使用JDBC连接SQL Server 2000 命名实例(Named Instance)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。