javasql-servernetbeansglassfishsqljdbc

sqljdbc4 2 on Glassfish server4 1


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);

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: 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.

Thank You.


Solution

  • I solved my problem!

    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.

    And it's now working perfectly.

    Thank you everyone!