File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dave McQueen
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • 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.


 
Venkat Sidh
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic