Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JDBC Questio

Reply
Thread Tools

JDBC Questio

 
 
AC
Guest
Posts: n/a
 
      01-31-2005
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
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      01-31-2005
AC <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
AC
Guest
Posts: n/a
 
      02-01-2005
On Mon, 31 Jan 2005 11:53:01 -0700,
Chris Smith <(E-Mail Removed)> 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
(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embarrasing questio Catherine Heathcote Python 13 02-14-2009 05:21 PM
Just a Quick Questio Jack Stevens MCDST 2 02-23-2008 02:32 AM
oracle.jdbc.OracleDriver vs oracle.jdbc.driver.OracleDriver Betty Java 1 05-21-2005 05:15 PM
Re: jdbc help:sun.jdbc.odbc.JdbcOdbcDriver Keith Wansbrough Java 0 08-16-2004 07:31 PM
Newbie questio, null or not an object Henke ASP .Net 2 11-27-2003 07:44 AM



Advertisments