Results 1 to 1 of 1
- 03-15-2012, 08:24 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 1
- Rep Power
- 0
Integrate spring project with local database
I am working on a simple spring application where I am trying to create and insert data into a database table. I have the create table and insert statements in a data.sql file in the classpath. The code does access this file, but when I connect to the database, I do not find the tables in there. My hunch is the db.properties file that I am using (also in the classpath) is not being accessed by the program. I am using a H2 database and am accessing it via the H2 console. What details am I missing here? How do I link up my spring project to the local database? This is my application context
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schem...g-jdbc-3.0.xsd
Index of /schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<jdbc:embedded-database id="dataSource" type="H2">
<jdbc:script location="classpath:schema.sql" />
<jdbc:script location="classpath:data.sql" />
</jdbc:embedded-database>
<!-- <start id="bean.jdbcTemplate" /> -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.simple.Simple JdbcTemplate">
<constructor-arg ref="dataSource" />
</bean>
<bean id="jdbcSpitter" class="com.habuma.spitter.persistence.JdbcSpitterD ao">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<!-- <end id="bean.jdbcTemplate" /> -->
</beans>
Similar Threads
-
Style for Local Database storage
By CJC in forum JDBCReplies: 8Last Post: 09-27-2011, 05:43 PM -
possible overlapping jars in spring annotated mvc/spring security project
By savantics in forum Web FrameworksReplies: 1Last Post: 12-27-2010, 05:21 PM -
How to bind Spring MVC with my local service
By Alexey Slepov in forum Web FrameworksReplies: 1Last Post: 03-25-2010, 11:48 AM -
Accesing database(Access) from a local machine
By ersachinjain in forum JDBCReplies: 0Last Post: 08-14-2009, 05:09 PM -
New project VFSJFileChooser(browse local and remote locations)
By mrcheeks in forum AWT / SwingReplies: 0Last Post: 01-22-2008, 11:05 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks