This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes executeUpdate() ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "executeUpdate() ?" Watch "executeUpdate() ?" New topic

executeUpdate() ?

Nick Neidig

Joined: Aug 29, 2003
Posts: 12
The class runs fine when I omit s.executeUpdate(). I am unsure of what the problem might be. I am using Windows XP and connecting to an Access database. Thanks for your help.
package be314;
import java.sql.*;
public class Fordate1 {
public static void main (String args []) {
try {
Connection c = DriverManager.getConnection(
"jdbc dbc:Music");
System.out.println("A success");
Statement s = c.createStatement();
s.executeUpdate (
ResultSet r =
"SELECT Albums.Album FROM Albums WHERE Albums.Album)
Between 'A' And 'B')");
while( {
} catch (Exception) {
Lu Battist
Ranch Hand

Joined: Feb 17, 2003
Posts: 104
It would greatly help if you would print the error message in the catch block. My guess, from looking at your source code, is that the table Customer that you're trying to create already exists in the database.
Nick Neidig

Joined: Aug 29, 2003
Posts: 12
Thank you Lu. I went ahead and printed out the error message and you were absolutely correct.
Jason Steele
Ranch Hand

Joined: Apr 25, 2003
Posts: 100
you have an error in the syntax of your SELECT statement after WHERE. Take off the paren.

An egg is a chicken's house!
I agree. Here's the link:
subject: executeUpdate() ?
It's not a secret anymore!