This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC from Spring framework

 
jay lai
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am very new to Spring framework, has anyone know how to write jdbc connection using in Spring framework,
Very thanksful if you can giving some hints or links to some sample code.
Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jay,
The spring framework site has some sample code. Are you looking for something more specific?
 
jay lai
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeane:
Thanks for the hints, if i got return from database more than one record, like a list of record, how do I implemented? For example, select id, first,last,street from table1, it will return like thoudsand of records, I want to loop through all the record and display to the user.
Many thanks for the help
 
Abhi Vuyyuru
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to use the JdbcTemplate class query(SQL, params, new MyRowMapper()). Where MyRowMapper is an implementation of the RowMapper, which will map individual rows to objects of your choice as shown below
For a detailed example, of all the classes involved, visit this blog post
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic