Skip to content

Latest commit

 

History

History
76 lines (69 loc) · 2.34 KB

resources.context.md

File metadata and controls

76 lines (69 loc) · 2.34 KB

Context XML

This example of context xml is compatible in apache-tomcat7 or higher version. Be sure to add the resources following your system rules if it is not tomcat.

[webApplication]/META-INF/context.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Context>
<Context>
<!-- Database -->
	<Resource
		name				=	"jdbc/efw"
		auth				=	"Container"
		type				=	"javax.sql.DataSource"
		driverClassName	 =	"org.postgresql.Driver"
		url				 =	"jdbc:postgresql://localhost:5432/efw"
		username			=	"username"
		password			=	"password"
		maxActive		   =	"100"
		maxIdle		 	=	"20"
		maxWait		 	=	"10"
	/>
	<Resource
		name				=	"jdbc/efw2"
		auth				=	"Container"
		type				=	"javax.sql.DataSource"
		driverClassName	 =	"org.postgresql.Driver"
		url				 =	"jdbc:postgresql://localhost:5432/efw2"
		username			=	"username"
		password			=	"password"
		maxActive		   =	"100"
		maxIdle			 =	"20"
		maxWait			 =	"10"
	/>
	.
	.
	.
<!-- Mail -->
	<Resource
        name       	    	 	=    "mail/efw" 
        auth       	    	 	=    "Container"
        type       	   	  	=    "javax.mail.Session"
        username   	    	 	=    ""
        password   	    		 =    ""
        mail.debug 	   	      =    "false"
        mail.user  	   	      =    ""
        mail.from  	   	      =    "[email protected]"
        mail.transport.protocol 	=	"smtp" 
        mail.smtp.host    		  =    "127.0.0.1"
        mail.smtp.auth    		  =    "false"
        mail.smtp.port    		  =    "25"
        mail.smtp.starttls.enable   =	"true"
        description        		 =    "E-Mail Resource"
    />
</Context>

Database Resource

The default one must be named "jdbc/efw". It can be called by db.select , db.change and db.master without the jdbcResourceName param. If you need some addition database, add the database resource with another name. In this way, you must call the db functions with the jdbcResourceName param.

For example,

db.select(groupId, sqlId, params)		//using the default db resource "jdbc/efw"
db.select(groupId, sqlId, params, "jdbc/efw2")	//using the addition db resource "jdbc/efw2"

Mail Resource

name

If mail.send is called in your program, the mail resource must be set up with the name "mail/efw".