JNDI now a day is very popular as it provide the underline database connectivity directly to the application which providing any driver and connection string and all , everything has to be defined at application server level only the JNDI name is what matters to the spring application , it basically connect with database only by using the JNDI Name .
So how to connect with database using jndi
In this program we are trying to connect our spring application with Mysql database using Mysql JNDI which we are defining in tomcat server of the application.
Below is the tag we need to add in the tomcat context.xml.
<Resource name="jdbc/springlearning" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/springlearning?useSSL=false"/>
below is the program
The structure of the project will be like below
Hope this will help you in understanding the program
Thanks for the reading
Noeik
So how to connect with database using jndi
In this program we are trying to connect our spring application with Mysql database using Mysql JNDI which we are defining in tomcat server of the application.
Below is the tag we need to add in the tomcat context.xml.
<Resource name="jdbc/springlearning" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/springlearning?useSSL=false"/>
below is the program
The structure of the project will be like below
Hope this will help you in understanding the program
Thanks for the reading
Noeik
0 comments:
Post a Comment