TCDBSERVER: Simple User Database Management System
The simplest user database management system.
Used technologies:
- Java 8
- DBMS MySQL
- MySQL Connector/J 6.0.5
- Hibernate 5.2.5
- Servlet API 3.1
- JSP / JSTL 1.2
Launch of the application
- (Not necessary) Choose the type of data access technology used - JDBC or Hibernate (Hibernate is used by defending)
- Hibernate: proceed to paragraph 2
- JDBC: In the configuration file
TCDBServersrcmaindb.properties change DAOFactoryImplementationClassName parameter on database.dao.factory.JdbcDaoFactory
- Indicate the path to the user database, name and password in the
ConnectionURL parameter of TCDBServersrcmaindb.properties (using JDBC) or hibernate.connection.url . hibernate.connection.username , hibernate.connection.password file TCDBServersrcmainhibernate.cfg.xml (using hibernate) - Fulfill
mvn install . As a result, WAR archive will be collected - Expand the archive on the server. I used Tomcat 8.5
Read more about the launch of the application on the Tomcat 8.5 server from Intellijidea
- Install Tomcat from the official site, unpack, prescribe the necessary environment variables, indicate the path to Tomcat in Intellijidea
- We go to the Run/Debug Configuration> Add New Configuration> Tomcat Server> Local:
- We go to the Deployment> Add> Artifact> TcdbSERVER: War Explode> OK> OK
- We launch as a regular
Shift + F10 project - We move in a browser at http: // localhost: 8080/
Description of the main possibilities
- Registration. You can register only with the rights of the user. You can create an administrator profile from the administrator control panel or directly add a user with the
role = admin SQL-pounding field - Authorization. After registration, you can enter the system under your login and password
- User rights system. Unregistered users, like ordinary users, do not have access to the administrator panel
/admin/* - The administrator can:
- View the list of all users and their data at the address
/admin or by clicking on the navigation panel corresponding to the menu item - Create new users (including new administrators) at
/admin/add - Change the data of existing users at the address
/admin/edit?id={id} , where {id} is the ID of a variable user - Delete users -
/admin/delete?id={id} , {id} - ID of the user removed
An example of a user table
The possibility of using other DBMS
To use other DBMS, you need to perform several actions:
- Connect the dependence of the required connector of the DBMS
- Create a class, the implementation of userdao by implementing all the methods used in it:
public class MyDbUserDao implements UserDao {
@ Override
...
}- Create a class, the heir to DaoFactory, reducing the only method in it so that it returns the only copy of your DAO:
public class MyDbDaoFactory extends DaoFactory {
@ Override
public UserDao getUserDao () {
if ( userDao == null ) {
userDao = new MyDbUserDao ();
}
return userDao ;
}
}- In the
resources/db.properties file, specify the class of the use of the DaoFactory implementation and in the hibernate.cfg.xml file ( db.properties - depending on what you will use) indicate the database settings
List of set and completed goals
Implemented in SpringwebApp (but not implemented here):