DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005

    plz, I need help, it's carrying marks

    Hi all I will be very thankful if anyone helping me in my lab project, because I am getting my Java course in this summer, the lab is I want to insert some names and phones in DB Access, and the numbers should be Auto, so I the help that I get up to this point and I couldn't finish it and it due on 13-Aug night. In addition I am using JBuilder and I put the name of the "odbc" is "PhoneBook" and the name for the Access file is PhoneBook and it has a password which is lab4 so can any one help me; Also I am sorry about my English be cause English my second language. The program is below:

    import java.sql.*;
    import java.io.*;
    public class PhoneBook {
    private static Connection con;
    private static int ID;
    private static String FName = "";
    private static String LName = "";
    private static String Phone = "";
    public static void main ( String[] args){

    try{ Class.forName ( "sun. jdbc. odbc.JdbcOdbcDriver" );
    con = DriverManager.getConnection ( "jdbcdbc:PhoneBook","admin", "lab4" );
    catch ( Exception e ){System.out.println(e);}

    /* Command Line Arguments:

    i -f fname -l lname -p phone (insert new record)
    r -f fname -l lname (rerieve phone given fname & lname)
    r -f fname (retrieve phone given fname only)
    r -l lname (retrieve phone given lname only)
    d ID (delete record whose primary key is ID)
    a (show all records and all attributes)

    for (int i = 1;i < args.length;i++)

    if (args.compareTo("-f") == 0)

    FName = args[i+1];
    i = i + 1;
    else if (args.compareTo("-l") == 0)
    LName = args[i+1];
    i = i + 1;
    else if (args.compareTo("-p") == 0)
    Phone = args[i+1];
    i = i + 1;

    case 'i':
    System.out.println("Insert Op");
    case 'r':
    System.out.println("Retrieve Op");
    System.out.println("Phone number(s): " + getPhone());
    case 'd':
    System.out.println("Delete Op");
    ID = Integer.parseInt(args[1]);
    case 'a':
    System.out.println("Show All");


    public static void insert()


    public static String getPhone()
    String phone = "";

    return phone;

    public static void delete()


    public static void showAll()


  2. #2
    Join Date
    Jun 2005
    in the case of insert or any othere just use

    Statement st=con.createStatement90;
    ResultSet rs= st.execute(''Insert into ........");

    and same is in the delete case
    but this happens if u r using other than MS
    because microsoft tech makes DSN that u have to configure
    so if u r going to use MS Technology then make DSN then only u can insert ur data

    Hope this will help u

Similar Threads

  1. plz plz plz help me(java)
    By kamon in forum Java
    Replies: 4
    Last Post: 08-10-2005, 10:30 AM
  2. java applet... i'm in a fix, plz help
    By nsbscool in forum Java
    Replies: 1
    Last Post: 05-02-2005, 08:01 AM
  3. Plz Help!!!!
    By Kyle in forum Java
    Replies: 0
    Last Post: 05-14-2003, 03:25 PM
  4. Plz solve this problem
    By mohanreddy in forum Java
    Replies: 0
    Last Post: 07-19-2001, 11:03 PM

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.