JDBC Jtds无法建立连接

编程入门 行业动态 更新时间:2024-10-27 18:27:19
本文介绍了JDBC Jtds无法建立连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我要访问的SQL数据库比放置在ASUS\MSSQLSERVER1中的SQL数据库和数据库名称"Test"的访问权限都可以用密码teste来访问用户teste

I want to make a access to my sql database than is placed in ASUS\MSSQLSERVER1 and database names "Test" with access to user teste with password teste

在Java代码中,我对此进行了编码:

in java code I coded this:

@Test public void TesteTemp() throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException { Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance(); String connString = "jdbc:jtds:sqlserver://ASUS/Test;instance=MSSQLSERVER1;user=teste;password=teste;"; Connection conn = null; try{ conn = DriverManager.getConnection(connString); }catch(SQLException ex){ ex.printStackTrace(); } conn.close(); }

我收到此错误:

服务器ASUS没有名为MSSQLSERVER1的实例.

Server ASUS has no instance named MSSQLSERVER1.

有道理吗?

我正在运行MSSQLSERVER1服务.

I have the MSSQLSERVER1 service running.

推荐答案

我解决了问题..代码可以,问题是tcp/ip协议和命名管道被禁用,我只是激活了它们,现在运行好的.. SQL配置管理器> SQL服务器网络配置> [Server_Name]的协议

i resolved the problem.. the code is ok, the problem was than protocols for tcp/ip and named pipes were disabled, i just activated them, now runs ok.. Sql Configuration Manager > Sql Server Network Configuration > Protocols for [Server_Name]

更多推荐

JDBC Jtds无法建立连接

本文发布于:2023-11-15 04:47:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1591280.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:JDBC   Jtds

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!