java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver : Am I loading the right driver?
问题 When I run the following snippet to connect to datasource to get the data out through queries : try { String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; Class.forName(driver); String Url = "jdbc:sqlserver://localhost:1433;databaseName=movies"; Connection connection = DriverManager.getConnection(Url,"sa", "xxxxxxx); // Context initContext = new InitialContext(); // Context envContext = (Context)initContext.lookup("java:comp/env"); // DataSource ds = (DataSource)envContext.lookup("