I recently developed a secondary development of a college campus card payment system. After getting the source code, I roughly read the code, which is relatively simple and not too complicated. The database is oracle10G, after obtaining the data file, the data is imported smoothly. However, when I was preparing to modify the database configuration file as usual, I found it was written as follows: transactionManagertypeJ
Recently, I was engaged in Secondary Development of a college campus card payment system. After obtaining the source code, I roughly read the code, which is relatively simple and not too complicated. The database is oracle 10 Gb, after obtaining the data file, the data is imported smoothly. However, when I was preparing to modify the database configuration file as usual, I found that:
- <TrAnsactionManager type ="JDBC">
- < span> "JNDI" > <>
- < span> "DataSource" Value = "Java: comp/env/jdbc/nfcDataSource" /> <>
The JNDI method is used to obtain the data source, but the specific configuration of the database is not expectedMcAt content. in the xml file, I found it online and found it was in content. in xml, I read it on the server, and the content. in xml, configuration drops are as follows:
- < span> Class = "Html" Name = "Code" > < span> "Jdbc/nfcDataSource" Auth = "Container" <> <>
- Type ="Javax. SQL. DataSource"DriverClassName ="Oracle. jdbc. driver. OracleDriver"
- Url ="Jdbc: oracle: thin: @ 192.168.0.1: 1521: tt"
- Username ="Ttt"Password ="Ttt"MaxActive ="50"MaxIdle ="10"MaxWait ="-1"/>
So far, I have learned how to configure a new data source.
The following is a simple description of java: comp/env found on the Internet:
- * ************************* Java: comp/env ***************************
- Java: comp/env is the environment naming context (environment naming contExT (ENC )),
- It was introduced after EJB specification 1.1 to solve conflicts caused by the original JNDI search and improve the portability of EJB or J2EE applications.
- ENC is a reference, which is the logical name used to locate the external resources of an enterprise application. References are defined in the application deployment descriptor file. During deployment, reference the physical location (JNDI name) bound to the resources in the target operable environment ).
- ENC is used to free up the hard encoding of the JNDI lookup for other resources. By configuring this reference, you can point the reference to different EJB (JNDI) without modifying the code ).
- Commonly used references in J2EE are: --------- JDBC data source reference declaration in java: comp/env/jdbc subcontext --------- JMS connection factory declaration in java: comp/env/jms subcontext