https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#MySQL_DBCP_2_Example
위의 reference에서 확인했다.
<Context>
<!-- maxTotal: Maximum number of database connections in pool.
Make sure you configure your mysqld max_connections large enough to handle all of your db connections.
Set to -1 for no limit. -->
<!-- maxIdle: Maximum number of idle database connections to retain in pool.
Set to -1 for no limit.
See also the DBCP 2 documentation on this and the minEvictableIdleTimeMillis configuration parameter.-->
<!-- maxWaitMillis: Maximum time to wait for a database connection to become available in ms, in this example 10 seconds.
An Exception is thrown if this timeout is exceeded.
Set to -1 to wait indefinitely. -->
<!-- username and password: MySQL username and password for database connections -->
<!-- driverClassName: Class name for the old mm.mysql JDBC driver is org.gjt.mm.mysql.Driver
- we recommend using Connector/J though.
Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver. -->
<!-- url: The JDBC connection url for connecting to your MySQL database. -->
<Resource
name="jdbc/TestDB"
auth="Container"
type="javax.sql.DataSource"
maxTotal="100"
maxIdle="30"
maxWaitMillis="10000"
username="javauser"
password="javadude"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/javatest"/>
</Context>
Bold 처리되어 있는 부분을 잘 참고하도록 하자.
Context 설정을 제대로 해주지 않으면,
"이 컨텍스트에 바인딩되지 않았습니다. jdbc 을 를 찾을 수 없습니다"라는 에러가 발생할 수 있다.
'개발 > MySQL' 카테고리의 다른 글
[MySQL] Can't find FULLTEXT index matching the column list 해결 방법 (0) | 2021.07.24 |
---|---|
[MySQL] MySQL/MariaDB Database 데이터베이스 생성, 조회, 선택, 삭제 (0) | 2021.05.04 |
[MySQL] MySQL/MariaDB 콘솔/CLI 접속 방법 (0) | 2021.05.04 |
[MySQL] 작은 따옴표가 추가 되는 에러 - MySQL 예약어 오류 (0) | 2021.01.22 |
SELECT LIMIT - 위치 지정해서 원하는 개수만큼 레코드 선택하기 (0) | 2020.12.30 |