![]() |
| ||
| java and sqlserver BIG problem?? hi guys, i'm trying to connect java application to SQL server 2005 developer edition, i used the following code which comes with the microsoft jdbc-odbc driver 1.2, after that i modify the class path to load sqljdbc_auth.dll file. import java.sql.*; import com.microsoft.sqlserver.jdbc.*; public class connectDS { public static void main(String[] args) { // Declare the JDBC objects. Connection con = null; CallableStatement cstmt = null; ResultSet rs = null; try { // Establish the connection. SQLServerDataSource ds = new SQLServerDataSource(); ds.setIntegratedSecurity(true); ds.setServerName("7AMADA-PC\\MYSERVER2005"); ds.setPortNumber(1433); ds.setDatabaseName("AdventureWorks"); ds.setIntegratedSecurity(true); con = ds.getConnection(); // Execute a stored procedure that returns some data. cstmt = con.prepareCall("{call dbo.uspGetEmployeeManagers(?)}"); cstmt.setInt(1, 50); rs = cstmt.executeQuery(); // Iterate through the data in the result set and display it. while (rs.next()) { System.out.println("EMPLOYEE: " + rs.getString("LastName") + ", " + rs.getString("FirstName")); System.out.println("MANAGER: " + rs.getString("ManagerLastName") + ", " + rs.getString("ManagerFirstName")); System.out.println(); } } // Handle any errors that may have occurred. catch (Exception e) { e.printStackTrace(); } finally { if (rs != null) try { rs.close(); } catch(Exception e) {} if (cstmt != null) try { cstmt.close(); } catch(Exception e) {} if (con != null) try { con.close(); } catch(Exception e) {} } } } When i tried to run this code i get this error message 16/11/2008 11:35:33 Õ com.microsoft.sqlserver.jdbc.AuthenticationJNI <clinit> WARNING: Failed to load the sqljdbc_auth.dll com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(Unknown Source) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnectionInternal(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnection(Unknown Source) at connectDS.main(connectDS.java:47) Process completed. |
| ||
| Re: java and sqlserver BIG problem?? Quote:
http://forums.microsoft.com/msdn/Sho...93578&SiteID=1 Albert |
| All times are GMT -4. The time now is 1:21 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC