Glassfish server4 1上的sqljdbc4 2 [英] sqljdbc4 2 on Glassfish server4 1

查看:109
本文介绍了Glassfish server4 1上的sqljdbc4 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sqljdbc42和此连接代码在netbeans v8.0.2中的glassfish server v4.1上运行我的Java Web应用程序-

I am running my java web application on glassfish server v4.1 in netbeans v8.0.2, using sqljdbc42 and this connection code-

    Connection connection;
    String url = "jdbc:sqlserver://localhost:1433;databaseName=Lista;integratedSecurity=true";
    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    connection = DriverManager.getConnection(url);

当我打开ide并第一次运行我的项目时,glassfish服务器会自动启动,因为我的项目服务器是glassfish,并且我可以使用Ms-Sql server2012进行任何操作.

When i open my ide and run my project for the first time the glassfish server starts automatically since my project's server is glassfish, and i can perform any crud operation with my Ms-Sql server2012.

但是当我在使服务器保持打开状态的任何文件中进行更改时问题就开始了,并再次运行该项目并尝试执行任何粗略的操作,我得到以下错误-

But the problem starts when i make changes in any file keeping the server on and run the project again and try to perform any crud operation i get this following error-

com.microsoft.sqlserver.jdbc.SQLServerException:该驱动程序不是 配置为集成身份验证

com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication

但是,如果我在更改任何文件之前先停止服务器,然后在更改并运行项目后启动服务器,那么它将正常工作.

But if i stop the server before changing any file and start after changing and run the project then it works without any error.

一次又一次地停止并重新启动服务器,这从我的项目总时间中耗费了很多时间!任何帮助或建议,将不胜感激.

Stopping and re-starting the server again and again taking so many times from my total project time! Any help or suggestion will be appreciated.

谢谢.

推荐答案

我解决了我的问题!

我得到的错误(在我上面的问题中描述)是因为glassfish服务器对sqljdbc42.jar文件没有任何访问权限.所以我已将sqljdbc42.jar文件放入此位置的glassfish服务器中-

The error (described in my question above) i was getting because the glassfish server had not any access on sqljdbc42.jar file. so i have placed the sqljdbc42.jar file into my glassfish server in this location-

glassfish-4.1\glassfish\domains\domain1\lib.

现在运行正常.

谢谢大家!

这篇关于Glassfish server4 1上的sqljdbc4 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆