且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试使用Java连接到SQL Server 2005时出现ClassNotFoundException

更新时间:2022-06-26 09:39:30

这意味着 sqljdbc4.jar 运行代码时, CLASSPATH 中缺少此内容。如果从命令行运行此命令,则在 -cp 中将 sqljdbc4.jar 的路径添加到 java 命令。

It means that sqljdbc4.jar is missing from your CLASSPATH while running the code. If you are running this from command line then add the path to sqljdbc4.jar in -cp switch of java command.

如果从eclipse运行,则添加 sqljdbc4.jar 在您的构建路径中。

If you are running from eclipse, then add sqljdbc4.jar in your build path.