• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Anyone know where I can find a short explanation of how to use getJdbcTemplate?

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm relatively new to Java - even newer to Spring - and I've to use getJdbcTemplate.queryForList to access a database.

It's not complicated code: List returnedSQL = this.getJdbcTemplate().queryForList(sqlQuery);

My problem is that I'm working on a project that requires I use this method and I don't have time to read a spring book. Is there any sites/books/sources that will tell me the minimum I need to get the method to work, as at the moment I'm using trial and error which is hardly efficient - and getting nothing returned.

Please suggest anything other than the api! The APIs seems to be written in a language I just can't fathom. Plus for the jdbcTemplate it's not very clear. The api only tells you about the specific method/class and doesn't take a more holistic/tutorial oriented approach on how to use it - not very helpful for a beginner (which is strange as I assumed the API was for people who don't know that stuff already...)

Any help/patience is appreciated!

P.S The sqlQuery string is a static String and works when used directly on the DB, but not when using queryForList.


 
Ranch Hand
Posts: 69
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check this http://www.oyejava.com/tiki-index.php?page=Spring
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JDBCTemplate is a kind of Connection object obtained from Datasource.

For e.g.,

JdbcTemplate jt = new JdbcTemplate(dataSource);

once you get jt then you can use queryForList() to get List object.

You may find some details here,

http://forums.sun.com/thread.jspa?threadID=5336900
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic