问题描述
实际上,我是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进行Java数据库或XML处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!