[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 65
  • Last Modified:

Getting error trying to connect to SQL Server using java

Trying to connect to a SQL Server database from our internal web portal.
This is what I'm getting:
An error occurred at line: 1,694 in the jsp file: /accountDetail.jsp
DriverManager cannot be resolved
1691: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
1692:
1693: String connectionUrl = "jdbc:sqlserver://HNCIISDEV;" + "databaseName=WebPortal;user=" + login + ";password=" + pass;
1694: con = DriverManager.getConnection(connectionUrl);
1695: }
1696: catch(ClassNotFoundException cnfex)
1697: {

Any ideas what my developer is missing?
0
Brian Sandt
Asked:
Brian Sandt
  • 2
1 Solution
 
Pawan KumarDatabase ExpertCommented:
IS your connection string correct. In most of the cases connection string seems to be incorrect.

For connection string please refer - https://www.connectionstrings.com/sql-server/
0
 
Nakul VachhrajaniTechnical Architect, Capgemini IndiaCommented:
It looks like your environment does not have the JDBC driver for SQL Server installed. Can you please try installing it? https://msdn.microsoft.com/en-us/library/mt484311(v=sql.110).aspx
0
 
Brian SandtSystems AdministratorAuthor Commented:
The JDBC driver was installed.  

Sending my developer the link for the connection string.
0
 
Brian SandtSystems AdministratorAuthor Commented:
Developer was finally able to get it working.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now