使用Spring进行Java数据库或XML处理? [英] Java Database or XML handeling using Spring?

查看:144
本文介绍了使用Spring进行Java数据库或XML处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



实际上,我是Java开发的新手.我发现Spring对于快速开发确实很有帮助.

请告诉我数据库[插入/更新/删除]上的链接或其他学习资料
使用Java在Java中使用.
我必须为Oracle编写代码.


我还想知道Spring 3.2(Java)如何帮助我们管理xml(即读取,编写或修改)?



实际上,我正在尝试调用queryForInt()方法,但它显示NULL异常.当我使用以下代码使用相同的凭据来添加dB时:

Hi,

Actually I am new to Java development. I found Spring is really helpful for rapid development.

Please tell me the links or other Study materials on database [insert/update/delete]
in Java using Spring.
I have to code for Oracle.


Also I would like to know how Spring 3.2 (Java) help us in managing the xml (i.e., reading, writing or modification)?



Actually I am trying to call queryForInt() method but it displays NULL exception. When I acces the dB with same credential using Following Code:

DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
dataSource.setUrl("jdbc:oracle:thin:@localhost:1521:xe");
dataSource.setUsername("userName");
dataSource.setPassword("pwd");




------在Bean中-----------------




------ In Bean -----------------

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
        <property name="username" value="userName"/>
        <property name="password" value="pwd"/>
    </bean>

    <!-- DAOS -->
    <bean id="ProductDAO" class="br.edeploy.voive.dao.ProductDAO">
        <property name="dataSource" ref="dataSource"/>
    </bean>




---------关于ProductDAO类--------------




---------On ProductDAO Class --------------

try
{
  int i = getSimpleJdbcTemplate().queryForInt("Select * from ERP_PRODUCT", "");
}
catch(DataAccessException dax)
 {
      throw new Exception("Error: "+dax.getMessage());
 }




谢谢.




Thanks.

推荐答案

Spring在hibernate上运行良好: http://www.springsource.org/get-started [ http://www.roseindia.net/spring/ [
Spring works fine with hibernate: Spring Hibernate Integration Tutorial[^]

Have you seen the Spring Website? http://www.springsource.org/get-started[^]. Also great source.

and RoseIndia has always some to contribute: http://www.roseindia.net/spring/[^]


这篇关于使用Spring进行Java数据库或XML处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆