DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Sep 2005

    Exclamation Database in MS Access using Java...Help!!

    I have already created an MS Access database to store a list of users with the following details:- First Name, Last Name, Address, Home Tel No, Mobile No and E-mail Add.

    Now i need all the names to be read into an array of structures and the names should be displayed when the form is loaded. When the name is highlighted, all the details of that user should apprear at the bottom of the screen.

    There are also 4 other options needed;

    Add new user - update the Access database with the relevant details and display a welcome message.

    Delete user - delete the user from the database after displaying a delete confirmation message.

    Update user - select the user name and click update button to amend the details.

    Total users - calculate the total number of users in the database and display the top 10 users according to last names in alphabetical order.

    Anyone kind enough to provide a source code for the following or have a similar program's source code?? I need some help badly...


  2. #2
    Join Date
    Aug 2003
    Here is some source code which tries to solve the Othello game using a depth first search (not realistic). There is a class called DBWriter which is probably the type of thing that you are looking for. I'm sure there are better classes out there, but this should hopefully get you started.

    Hope this helps.
    Attached Files Attached Files

  3. #3
    Join Date
    Sep 2005
    Thanks evilch....but it dosen't seem to work the way i wanted it to...

    Any experts out there have a better solution??

    Pls advice.

    Thanks a million!!

  4. #4
    Join Date
    Aug 2004
    Only you know what "doesn't seem to work" means...

    Please be a little more explicit about what you're doing, what you expect to happen, and what you actually observe.

    Please post a short, concise, executable example of what you're trying to do. This does not have to be the actual code you are using. Write a small example that demonstrates your intent, and only that. Wrap the code in a class and give it a main method that runs it - if we can just copy and paste the code into a text file, compile it and run it without any changes, then we can be sure that we haven't made incorrect assumptions about how you are using it.

    Post your code between [code] and [/code] tags. Cut and paste the code, rather than re-typing it (re-typing often introduces subtle errors that make your problem difficult to troubleshoot). Please preview your post when posting code.

    Please assume that we only have the core API. We have no idea what SomeCustomClass is, and neither does our collective compiler.

    If you have an error message, post the exact, complete error along with a full stack trace, if possible. Make sure you're not swallowing any Exceptions.

    Help us help you solve your problem.

  5. #5
    Join Date
    Nov 2004

    Here is:

    A simple one-table database application. I have modified it so it
    deals with your table. The database is MySQL, so you will have to
    change the database connection parameters.
    And it has a qouple of quirks left.... you are cordially invited to find
    them, understand them and fix them.

    PS: you may want to remove the package directive on top of the src files.
    Attached Files Attached Files
    eschew obfuscation

  6. #6
    Join Date
    Sep 2005

    Thumbs up


    It was exactly what i was looking for.. i managed to correct the quirks and the database is working perfectly fine now!!

    Thank you so much for your help sjalle

    Hope to learn more from you experts here..

    Last edited by vanaxel; 09-07-2005 at 11:16 AM.

  7. #7
    Join Date
    Nov 2004
    Thats fine.

    Btw, have you tried to overwrite (one of the) primary key field(s) with a new value
    and clicked "save changes" .. hmm ?
    eschew obfuscation

  8. #8
    Join Date
    Oct 2005

    Need your help

    Hi all... I wan to know the way how to insert data from java into database Access. I need to insert into 2 table in one time...can put like this?

    String url = "jdbcdbc:library";
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String theStatement="INSERT INTO Member (MemberID, Name, UserID, Password, TelNo, Email) VALUES ('"+ jTextFieldID.getText() + "','" + jTextFieldName.getText() + "','" + jTextFieldUser.getText() + "','" + jTextFieldPass.getText() + "','" + jTextFieldTel.getText() + "','"+ jTextFieldEmail.getText() + "')";
    String theStatement2="INSERT INTO Student(RegisterNo ) VALUES ('"+ jTextFieldID.getText() + "')";
    try {
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    String loc = "jdbcdbc:librarysystem";
    con = DriverManager.getConnection (loc);
    catch (ClassNotFoundException cnf) {
    JOptionPane.showMessageDialog (null, "Driver not Loaded...");
    System.exit (0);
    catch (SQLException sqlex) {
    JOptionPane.showMessageDialog (null, "Unable to Connect to Database...");
    System.exit (0);
    setVisible (true);

    Connection connection=DriverManager.getConnection(url);
    Statement querylibrary=connection.createStatement();
    int result = querylibrary.executeUpdate(theStatement);
    int result2 = querylibrary.executeUpdate(theStatement2);

    if ( result == 1 ){
    System.out.print( "\nOrder Placed\n" );
    JOptionPane.showMessageDialog (this, "Record has been Saved.");
    System.out.print( "\nInsertion failed\n" );
    JOptionPane.showMessageDialog (this, "Problem while Saving the Record.");}


Similar Threads

  1. Java and MS access database connection
    By borceivanovski in forum Java
    Replies: 1
    Last Post: 04-27-2005, 05:35 PM
  2. Really Cool 3 tier Java database solution
    By Russ in forum Database
    Replies: 0
    Last Post: 06-04-2002, 12:57 AM
  3. .NET vs. Enterprise Java: Who's Got Better Security?
    By Glen Kunene in forum Talk to the Editors
    Replies: 17
    Last Post: 03-23-2002, 12:43 AM
  4. General class in java to access database using JDBC
    By Rafat balaom in forum VB Classic
    Replies: 0
    Last Post: 12-09-2001, 02:47 AM
  5. Open Access database Form from VB 6.0?
    By Demo in forum VB Classic
    Replies: 7
    Last Post: 07-25-2000, 08:10 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
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.