JDBC Questio

Discussion in 'Java' started by AC, Jan 31, 2005.

  1. AC

    AC Guest

    Coming from the world of VisualBasic, I'm not find Java too hard to catch on
    to. After just a couple of weeks of real coding, I'm even cranking out some
    code to access a MySQL database. I've got something of a conceptual hill to
    jump over, and that's about the Statement class. In VB, I'm used to using
    ADO, and just opening a connection and then running queries against it
    (either record sets or update-style queries). Is it just the case that any
    code I'm translating I just need to insert the lines dealing with the
    Statement class, and that's it? What is the purpose of Statement?

    --
    Aaron Clausen
     
    AC, Jan 31, 2005
    #1
    1. Advertising

  2. AC

    Chris Smith Guest

    AC <> wrote:
    > Coming from the world of VisualBasic, I'm not find Java too hard to catch on
    > to. After just a couple of weeks of real coding, I'm even cranking out some
    > code to access a MySQL database. I've got something of a conceptual hill to
    > jump over, and that's about the Statement class. In VB, I'm used to using
    > ADO, and just opening a connection and then running queries against it
    > (either record sets or update-style queries). Is it just the case that any
    > code I'm translating I just need to insert the lines dealing with the
    > Statement class, and that's it? What is the purpose of Statement?


    There are several ways to interact with SQL. They are:

    1. Just run queries.

    2. Call stored procedures (except that you're using MySQL, which is one
    of the very few major databases that don't provide this feature).

    3. Use server-prepared statements and then plug in parameters where they
    are needed.

    If you're using the first approach, then yes you just need to call
    createStatement and get on your way. In that case, the extra layer of
    having a statement might seem pointless.

    However, when you're doing either of the last two, there can sometimes
    be substantial advantages to "getting ready" to do things only once, and
    then actually interacting with the database several times, passing
    different parameters each time. Whether the database takes advantage of
    this is implementation specific -- for example, PostgreSQL didn't up
    until the drivers from version 8.0; but now it does. The point is that
    JDBC is a generic interface, and it's designed so that you can write
    code that *will* run faster if the database and drivers support it.

    There are also other details to the Statement class, but that's the bulk
    of it.

    --
    www.designacourse.com
    The Easiest Way To Train Anyone... Anywhere.

    Chris Smith - Lead Software Developer/Technical Trainer
    MindIQ Corporation
     
    Chris Smith, Jan 31, 2005
    #2
    1. Advertising

  3. AC

    AC Guest

    On Mon, 31 Jan 2005 11:53:01 -0700,
    Chris Smith <> wrote:
    >
    > There are also other details to the Statement class, but that's the bulk
    > of it.
    >


    Thanks for the details, that helps considerably. Just trying to wrap my
    brain around this.

    --
    Aaron Clausen
     
    AC, Feb 1, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henke
    Replies:
    2
    Views:
    980
    Henke
    Nov 27, 2003
  2. Keith Wansbrough

    Re: jdbc help:sun.jdbc.odbc.JdbcOdbcDriver

    Keith Wansbrough, Aug 16, 2004, in forum: Java
    Replies:
    0
    Views:
    802
    Keith Wansbrough
    Aug 16, 2004
  3. Betty
    Replies:
    1
    Views:
    9,931
    Juha Laiho
    May 21, 2005
  4. Jesus M. Salvo Jr.
    Replies:
    2
    Views:
    4,322
    robert
    Feb 11, 2006
  5. Catherine Heathcote

    Embarrasing questio

    Catherine Heathcote, Feb 12, 2009, in forum: Python
    Replies:
    13
    Views:
    387
    marika
    Feb 14, 2009
Loading...

Share This Page