jdbc连接sql server

在尝试使用JDBC连接SQL Server时遇到了错误,包括TCP/IP连接超时问题和sqljdbc_auth.dll加载失败的问题。解决方法是检查SQL Server是否在指定端口运行,确认防火墙设置,以及将sqljdbc_auth.dll复制到系统目录下。
摘要由CSDN通过智能技术生成

下载官方jdbc,解压后里面有例子。有jre7和jre8的driver的jar。
跑连接例子的时候报错

  1. com.microsoft.sqlserver.jdbc.SQLServerException: 通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。
    https://blog.csdn.net/niaonao/article/details/53897486 可以
  2. 警告: Failed to load the sqljdbc_auth.dll cause : no sqljdbc_auth in java.library.path
    解决办法:将sqljdbc_auth.dll拷贝到C:\Windows\System32目录下即可解决
    https://blog.csdn.net/tingzhiyi/article/details/52086662
//=====================================================================
//
//  File:    connectURL.java      
//  Summary: This Microsoft JDBC Driver for SQL Server sample application
//	     demonstrates how to connect to a SQL Server database by using
//	     a connection URL. It also demonstrates how to retrieve data 
//	     from a SQL Server database by using an SQL statement.
//
//---------------------------------------------------------------------
//
//  This file is part of the Microsoft JDBC Driver for SQL Server Code Samples.
//  Copyright (C) Microsoft Corporation.  All rights reserved.
//
//  This source code is intended only as a supplement to Microsoft
//  Development Tools and/or 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值