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;
}
}
switch(args[0].charAt(0))
{
case 'i':
System.out.println("Insert Op");
insert();
break;
case 'r':
System.out.println("Retrieve Op");
System.out.println("Phone number(s): " + getPhone());
break;
case 'd':
System.out.println("Delete Op");
ID = Integer.parseInt(args[1]);
delete();
break;
case 'a':
System.out.println("Show All");
showAll();
break;
}
}
public static void insert()
{
}
public static String getPhone()
{
String phone = "";
return phone;
}
public static void delete()
{
}
public static void showAll()
{
}
}


dbc:PhoneBook","admin", "lab4" );
Reply With Quote



Bookmarks