MS SQL Server 2005 Express 的 jTDS JDBC 连接 URL 是什么

发布于 2024-07-25 10:17:37 字数 236 浏览 7 评论 0原文

我正在尝试从 java 程序连接到在本地主机上运行的 MS SQL Server 2005 Express 数据库。

我尝试了与运行 MS SQL Server 2000 的另一个系统(相同的 jave 代码)上使用的相同的连接 URL(如下)。但这不起作用。

jdbc:jtds:sqlserver://127.0.0.1:1433/Finance

有任何想法吗?

I'm trying to connect to a MS SQL Server 2005 Express database that is running on the local host from a java program.

I have tried the same connect URL (below) that I used on another system (same jave code) that was running MS SQL Server 2000. But that does not work.

jdbc:jtds:sqlserver://127.0.0.1:1433/Finance

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

您的好友蓝忘机已上羡 2024-08-01 10:17:37

您确定这是正确的实例吗? SQL Express 倾向于安装为命名实例,例如“localhost\SQLExpress”,而不是标准实例。 所以它会是这样的:

jdbc:jtds:sqlserver://127.0.0.1:1433/Finance;instance=<instance_name>

如果这不起作用,请尝试删除实例名称,并将端口更改为命名实例使用的端口:

jdbc:jtds:sqlserver://127.0.0.1:<instance_port>/Finance

否则尝试首先通过 OSQL.exe 工具检查您的连接。 您还可以查看jTDS 常见问题解答

Are you sure it is the correct instance? SQL Express tends to install as named instance, like "localhost\SQLExpress", instead of a standard instance. So it would be something like:

jdbc:jtds:sqlserver://127.0.0.1:1433/Finance;instance=<instance_name>

If this doesn't work, try dropping the instance name, and changing the port to the port used by the named instance:

jdbc:jtds:sqlserver://127.0.0.1:<instance_port>/Finance

Else try to check your connectivity through OSQL.exe tool first. You can also check the jTDS FAQ on this.

熊抱啵儿 2024-08-01 10:17:37

我建议 MicSim 的 url:

jdbc:jtds:sqlserver://localhost/Finance;instance=sqlexpress

检查 this 获取 jTDS Url 信息。

还提供了一些有趣的信息来帮助排除故障jtds 到 sql express 的各种问题。

祝你好运。 让我们知道怎么回事。

I would suggest MicSim's url:

jdbc:jtds:sqlserver://localhost/Finance;instance=sqlexpress

Check this for jTDS Url Info.

This also has some interesting information to help troubleshoot jtds to sql express sorts of problems.

Good luck. Let us know how it goes.

寒冷纷飞旳雪 2024-08-01 10:17:37

要检查 TCP/IP 是否已启用且端口是否未被阻止,可以使用“telnet 1433”。 在 telnet 无法连接之前,jTDS 也不会连接。

e.g, c:>telnet servername 1433

在 Windows 上启用 telnet 客户端

http://social.technet.microsoft.com/wiki/contents/articles/910.how-to-enable-telnet-client-in-windows-7.aspx

To check whether TCP/IP is enabled and the port is not blocked you can use "telnet 1433". Until telnet doesn't connect, jTDS won't either.

e.g, c:>telnet servername 1433

to enable telnet client on windows

http://social.technet.microsoft.com/wiki/contents/articles/910.how-to-enable-telnet-client-in-windows-7.aspx

生活了然无味 2024-08-01 10:17:37

默认情况下禁用 SQL Server Browser 服务。 如果您正在开发 .Net 应用程序,则无需启动 SQLBrowser,但如果您在 Java 中使用 JTDS,则需要启动它。
示例(无需指定sql server端口)。

<property name="connection.url">jdbc:jtds:sqlserver://localhost/yourDbName;instance=SQLEXPRESS</property> 
<property name="connection.username">yourDbUser</property>
<property name="connection.password">yourDbPassword</property>

SQL Server Browser service is disabled by default. If you're developing .Net apps, you do not need to start SQLBrowser, but if you're using JTDS in Java, you will need to have it started.
Example (no need to specify the sql server port).

<property name="connection.url">jdbc:jtds:sqlserver://localhost/yourDbName;instance=SQLEXPRESS</property> 
<property name="connection.username">yourDbUser</property>
<property name="connection.password">yourDbPassword</property>
独闯女儿国 2024-08-01 10:17:37

你可以使用这个::

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
    <property name="url" value="jdbc:sqlserver://localhost:1433;DatabaseName=Test1" />
    <property name="username" value="sa" />
    <property name="password" value="vic123" />
</bean>

you can use this::

<bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
    <property name="url" value="jdbc:sqlserver://localhost:1433;DatabaseName=Test1" />
    <property name="username" value="sa" />
    <property name="password" value="vic123" />
</bean>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文