Re: Overwriting a Access Database using JDBC

From: Alan Gutierrez (alan_at_engrm.com)
Date: 02/06/05


Date: Sun, 06 Feb 2005 01:44:52 -0600

On 2005-02-06, Steve Sobol <sjsobol@JustThe.net> wrote:
> alan@ljubljana.agtrz.com wrote:
>
>> I'm not familiar with JDBC, co I can't comment on the Java.
>>
>> But...
>>
>> No stack trace?
>>
>> The UPDATE statement will update every row in the database, by the way.

> But the Java code looks OK.

    Okay, Tushar.

    You are not updating any rows if rs is zero. You're probably
    running your application for the first time. No rows, no update.

    Have you tryed playing around with SQL in Access, or using one
    of the many JDBC shell utitities. SQL is really easy stuff.

    -- create table foo --
    CREATE TABLE foo (bar integer, baz varchar(32));

    -- delete all rows in foo --
    DELETE FROM foo;

    -- Add a row to foo --
    INSERT INTO foo (bar, baz) VALUES (1, "fred");

    -- Update foo --
    UPDATE foo set baz = "barney" WHERE bar = 1;

    -- get rid table foo entrely --
    DROP TABLE foo;

    You'll generally find that you have to write update and insert
    statements for all the data in your database. It will feel
    redundant until you get used to it.

    As someone else noted, optional in the documentation means
    optional the same way that import declarations are optional in
    java. If you don't put them there, that's fine, but you can use
    any classes external to the package. Make sense?

    You really ought to slow down and read an SQL primer. If you are
    really in a hurry, just serialize your objects to a file for now.

    Good luck.

--
Alan Gutierrez - alan@engrm.com


Relevant Pages

  • Stuff the purple heart programmers cook up
    ... C To act like a framework for the JDBC driver developers. ... D To hide the specifics of accessing particular kinds of database ... Topic: Java 2: Survey Author: Chris Mc Devitt ... The JDBC ResultSet is actually an interface java.sql.ResultSet. ...
    (comp.lang.java.programmer)
  • Re: Mixing P/R philosophy with OO (within J2EE).
    ... I have observed the work of literally hundreds of Java developers. ... Treating a database like a mere "persistence storage mechanisms" is on ... JDBC - Never before in history were so many database API's ... Topmind, if you're reading this, isn't this a good example of OOP? ...
    (comp.object)
  • Re: What about a DBMS that wont be platform-specific
    ... This would be my first time doing this and the database is being ... There is no JDBC driver for Access. ... In Java, you can use databases which provide only ODBC drivers through the JDBC-ODBC ... Sun includes a JDBC-ODBC bridge with their standard distro, ...
    (comp.lang.java.databases)
  • Re: How to modify a MySQL database...
    ... and then update them with Java. ... To learn how to create a MySQL database, ... you will need to learn JDBC. ...
    (comp.lang.java.programmer)
  • Re: Java Instanz und Objekt frage ?
    ... >>>fully qualified name der Klasse.Wenn du jetzt diesen Namensraum nimmst ... > laut VM ist der FQN von Foo Foo und nicht .Foo. .Foo ist ein ungültiger ... einem gedankenexperiment die Sprache Java' vorzustellen, ... Nochmal: die Transformation geht so: ...
    (de.comp.lang.java)