Results 1 to 3 of 3

Thread: Example of using JdbcTemplate to do an insert

  1. #1
    Join Date
    Mar 2005
    Posts
    3

    Default Example of using JdbcTemplate to do an insert

    I cannot seem to find any examples of doing an insert, there are lots of selects and updates. Has any one got sample code of doing an insert using an SQL statement and passing parameters.

    Thanks,
    Chris

  2. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    Code:
    jdbcTemplate.update("insert into foo (col1, col2) values (?, ?) ",
        new Object[] { value1, value2 })
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  3. #3

    Default

    Thansk for good example. If we are able to do the insert and update with this
    Code:
    jdbcTemplate.update("insert into foo (col1, col2) values (?, ?) ",
        new Object[] { value1, value2 })
    code, then why we use
    Code:
    int update(String sql,
               Object[] args,
               int[] argTypes)
    What is the use of third parameter as argTypes. Kindly tell us when we should use argTypes parameter and in which condition we should not use this. Please one samll example also.

    Thanks in advance,

    Thanks,

    Ayush Suman

    http://ayushsuman.blogspot.com

Similar Threads

  1. MySQL DDL
    By analogueboy in forum Security
    Replies: 5
    Last Post: Aug 17th, 2007, 03:48 PM
  2. Replies: 2
    Last Post: May 5th, 2005, 09:35 PM
  3. CMT, JdbcTemplate and connection pools
    By jayschm in forum EJB
    Replies: 3
    Last Post: Apr 25th, 2005, 08:11 AM
  4. How to insert a row using JdbcTemplate?
    By DanielQ in forum Data
    Replies: 2
    Last Post: Jan 12th, 2005, 07:19 PM
  5. Replies: 1
    Last Post: Oct 16th, 2004, 07:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •