Avatar of miral13
miral13
 asked on

Java app not able to connect to SQL Server, windows authentication

I am trying to conenct from a java app to SQL Server with Windows authentication (not SQL Server one) but it fails.

Please see code below.
dbURL=jdbc:sqlserver://tst-server:1433;databaseName=my_DB;integratedSecurity=true;

 try
 {

       Class.forName(driverName);
    Connection dbConn = DriverManager.getConnection(dbURL);
    System.out.println("Connection Successful!");  
    // if successful print Connection Successful!
    return dbConn;

  }
 catch (Exception e)
 {
     e.printStackTrace();
     return null;
  }

I am receiving this error:
access denied (java.net.SocketPermission tst-eudqt:1433 connect,resolve)

If I use SSMS I can access the server and the db ;-)
Java App ServersMicrosoft SQL Server 2005

Avatar of undefined
Last Comment
miral13

8/22/2022 - Mon
lcohan

Are your NT credentials from workstation where you login to network added to SQL Server Security and have sufficient database access right for the same login?

ASKER CERTIFIED SOLUTION
lcohan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
miral13

ASKER
Point 5 did the trick. Thank you very much.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck