In a MAVEN project, the packages required to load for SQL and MySQL connections are not the same as those in jdbc.properties
For MySQL:
Jdbc.properties's wording:
Jdbc.driverclassname=-- mysql driver jdbc.url=jdbc\:mysql\://localhost\: 3306 /Workloads?useunicode=true&characterencoding=utf-8 -- specific database information and set encoding jdbc.username= user name Jdbc.password= Password
For SQL:
Need to add Jtds rack package in maven
<dependency> <groupId>net.sourceforge.jtds</groupId> <artifactid>jtds</ artifactid> <version>1.2.4</version> </dependency>
Jdbc.properties's wording:
Jdbc.driverclassname=net.sourceforge.jtds.jdbc.Driver -- database driver jdbc.url= Jdbc:jtds:sqlserver://localhost:1433/Shopping -- data specific information jdbc.username= user name Jdbc.password= password
Drive and database specific information cannot be written like this:
-- Jdbc.driverclassname=com.microsoft.sqlserver.jdbc.sqlserverdriver -- jdbc.url=jdbc:sqlserver://localhost:1433;databasename=shopping
The difference between connecting SQL Server and MySQL in a MAVEN project