2010-12-15 5 views

답변

0

먼저 당신은 응용 프로그램의 context.xml에서 데이터 소스에 대한 enteries을해야한다.

그런 다음 우리의 context.xml에서 항목을 확인해야하고 우리는 데이터베이스 자격 증명 및 위치의 context.xml

에 내가 부착하고 모두 내 프로젝트의 파일을 제공해야합니다.

희망 사항은 도움이 될 것입니다.

코드 응용 프로그램의 context.xml

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/tx 
     http://www.springframework.org/schema/tx 
     http://www.springframework.org/schema/context 
     http://www.springframework.org/schema/context"> 

     <bean id="messageSource" 
     class="org.springframework.context.support.ResourceBundleMessageSource"> 
       <property name="basenames"> 
         <list> 
           <value>report/cobReports_message</value> 
         </list> 
       </property> 
     </bean> 

     <context:component-scan 
       base-package="com.jpmc.am.architecture.emailaddrutil, com.jpmc.am.architecture.cob" /> 

     <bean id="multipartResolver" 
     class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> 
       <property name="maxUploadSize" value="200000" /> 
     </bean> 


     <bean id="sqlMapClientTemplate" 
     class="org.springframework.orm.ibatis.SqlMapClientTemplate"> 
       <property name="sqlMapClient" ref="sqlMapClient" /> 
     </bean> 

     <bean id="sqlMapClient" 
     class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> 
       <property name="configLocation" 
       value="classpath:sqlMap/cobSqlMapConfig.xml" /> 
       <property name="dataSource" ref="cobDataSource" /> 
       <property name="useTransactionAwareDataSource" value="true" /> 
       <property name="sqlMapClientProperties"> 
       <value>COB_SCHEMA=CLTAPPMGR //////// Database Schema Name</value> 
       </property> 
     </bean> 

     /// Data Source Name 
     <bean id="cobDataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> 
      <property name="jndiName" value="java:comp/env/jdbc/cob" /> 
     </bean> 
</beans> 

코드에 대한 context.xml에

<Context> 

<Resource name="jdbc/cob" auth="Container" type="javax.sql.DataSource" 
factory="org.apache.commons.dbcp.BasicDataSourceFactory" 
driverClassName="oracle.jdbc.driver.OracleDriver" 
url="database location:databasename" 
username="username" 
password="password" 
/> 




</Context> 
+0

컨텍스트를 편집했습니다. XSD 네임 스페이스 (task, util, p, jdbc, j2ee 등)를 추가하지 않아도됩니다. –

0

체크 아웃 Spring JDBC 아마 가장 빠르고 간단한 경로 인 JdbcTemplate을하십시오.

기본 이상으로 ORM 솔루션을 살펴보기로 동의했습니다.

+0

현재 버전 링크가 업데이트되었습니다. –

관련 문제