This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Connecting to Database using JDBC template (Spring) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Connecting to Database using JDBC template (Spring)

Nimu Chox

Joined: Mar 11, 2012
Posts: 27
Anayonkar Shivalkar

Joined: Dec 08, 2010
Posts: 1469

Hi Nimu Chox,

Welcome to CodeRanch!

Please TellTheDetails. What this xml file is about? Are you deploying any web application? Is it servlet/jsp or ejb? Either way, it does not seem to be 'beginning java' question.

We have dedicated forums for servlet, jsp, jdbc and ejb. You can request moderator to move this topic to appropriate forum.

Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Nimu Chox

Joined: Mar 11, 2012
Posts: 27
Aim: In this XML file, I am configuring the data source, I will use the database instance in class "CityDaoImpl" - please see the code

I am getting an error "Top level element´╗┐ is not comepleted/Valid XML must have a root tag" in this line:

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">

[Thumbnail for Try_Spring.png]

Rob Spoor

Joined: Oct 27, 2005
Posts: 19557

Recreated at

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Connecting to Database using JDBC template (Spring)
Similar Threads
Why this error?
The matching wildcard is strict, but no declaration can be found for element 'context:annotation'
XML name space error in Spring data JPA hibernate applicationContext.xml
Error: ERROR initServletBean, Context initialization failed
spring wont inject the entitymanager