Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Getting error trying to connect to SQL Server using java

Posted on 2016-09-30
4
Medium Priority
?
59 Views
Last Modified: 2016-10-11
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
Comment
Question by:Brian Sandt
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
Pawan Kumar earned 2000 total points
ID: 41824370
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
 
LVL 14

Expert Comment

by:Nakul Vachhrajani
ID: 41824735
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
 

Author Comment

by:Brian Sandt
ID: 41826174
The JDBC driver was installed.  

Sending my developer the link for the connection string.
0
 

Author Closing Comment

by:Brian Sandt
ID: 41838820
Developer was finally able to get it working.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question