Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 5 years have passed since last update.

[realme]JDBCRealm MySQL Server.xml

Posted at
server.xml
<?xml version="1.0" encoding="UTF-8"?>
<Server
	port="8105"
	shutdown="SHUTDOWN">

	<Listener
		SSLEngine="on"
		className="org.apache.catalina.core.AprLifecycleListener" />

	<Listener className="org.apache.catalina.core.JasperListener" />
	<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
	<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
	<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

	<GlobalNamingResources>
		<!-- conf/tomcat.xml -->
		<Resource
			auth="Container"
			name="UserDatabase"
			factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
			pathname="conf/tomcat-users.xml"
			type="org.apache.catalina.UserDatabase" />
	</GlobalNamingResources>
	.
	<Service name="Catalina">

		<Connector
			connectionTimeout="20000"
			port="8180"
			protocol="HTTP/1.1"
			redirectPort="8443" />

		<Engine
			defaultHost="localhost"
			name="Catalina">

			<!-- conf/tomcat.xml -->
			<Realm
				className="org.apache.catalina.realm.UserDatabaseRealm"
				resourceName="UserDatabase" />
				
			<!-- jdbc:mysql://localhost/base2 -->
			<Realm
				resourceName="MySqlUserDatabase"
				className="org.apache.catalina.realm.JDBCRealm"
				connectionName="base2"
				connectionPassword="base2"
				connectionURL="jdbc:mysql://localhost/base2"
				driverName="com.mysql.jdbc.Driver"
				userTable="tbuser"
				userNameCol="account"
				userCredCol="password"
				userRoleTable="tbuser"
				roleNameCol="role" />

			<Host
				appBase="webapps"
				autoDeploy="true"
				name="localhost"
				unpackWARs="false">

				<Context
					docBase="struts2.app"
					path="/struts2.app"
					reloadable="true"
					source="org.eclipse.jst.j2ee.server:struts2.app">
				</Context>
			</Host>
		</Engine>
	</Service>
</Server>
create-tbuser
CREATE TABLE `tbuser` (
   `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
   `account` varchar(50) NOT NULL,
   `role` varchar(50) NOT NULL,
   `password` varchar(50) NOT NULL,
   `created` datetime NOT NULL,
   `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
   `deleted` date
);
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?