Duke dollars
Hello, I have 3 important college assignment that I need help on. I am prepared to pay a fee for. Can anyone help?
The first one is based on JDBC/ODBC
The second on a chat application using client server
The third is based on locales
In case of the first application I have most of it done already. Just having problem gettin resultset working.
I also intend to most of the build on the other ones. Just needing help with them.
I will provide more details once I hear from some-one. Incidentally, how can I send modurlaized files for insepection. It would look very long if posted on this textarea. Finally, how could I earn or purchase Duke dollars in order to reward solutions.?
I thank you in advance
[754 byte] By [
sunExpance] at [2007-9-30 20:37:15]

Hello, I have developed a modular assignment to access an Access database called "RESPONSE". Within response there is a a table called GetMe. GetMe has a primary key called PHONENUMBER along with records such as phone number email address etc.
The database has been registered in the same directory as the java files.
At present the application only seems to be accessing a string rather than retrieving a record consisting of phone numbers.
The intention is to use the custom made button to retrieve a record within the JTextfield called field.
Gui.java is the GUI file
-import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class GuiV1 extends JFrame
{
JButton button = new JButton("AddressBook");
JLabel label = new JLabel("Retrieve AddressBook",JLabel.CENTER);
JTextField field= new JTextField();
ButtonListener butListener = new ButtonListener(this);
GuiV1()
{
Container con = getContentPane();
con.setLayout(null);
con.add(button);
con.add(label);
con.add(field);
button.addActionListener(butListener);
button.setBounds(30,110,120,40);
field.setBounds(170,120,200,20);
label.setBounds(150,20,170,40);
setSize(450,350);
setTitle("Data retreival");
setVisible(true);
setResizable(false);
}
}
ButtonListener.java file
--
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JOptionPane;
import java.util.*;
public class ButtonListener extends JFrame implements ActionListener
{
private Connection connection;
private Statement statement;
private ResultSet resultSet;
private ResultSetMetaData rsMetadata;
GuiV1 x;
public ButtonListener(GuiV1 a)
{
x = a;
String url= "jdbc:odbc:Response";
String username = "read";
String password = "pass";
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection=DriverManager.getConnection(url,username,password);
}
catch(ClassNotFoundException cnfex)
{
System.err.println("Failed to load JDBC/ODBC driver");
cnfex.printStackTrace();
System.exit(1);
}
catch(SQLException sqlex)
{
System.err.println("Unable to connect");
sqlex.printStackTrace();
System.exit(1);
}
}// end of constructor
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("GetMe"));
{
x.field.setText("SELECT * GetMe");
getTable();
}
}
private void getTable()
{
try
{
String query = x.field.getText();
statement= connection.createStatement();
resultSet=statement.executeQuery(query);
displayresultSet(resultSet);
}
catch(SQLException sqlex)
{
sqlex.printStackTrace();
}
}
private void displayresultSet(ResultSet rs)
throws SQLException
{
boolean moreRecords = rs.next();
if(!moreRecords)
{
JOptionPane.showMessageDialog(this, "Resultset contained no records");
setTitle("No message to display");
return;
}
}
}// end of class
Client program
-
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class ClientOne
{
public static void main(String args[])
{
GuiV1 x = new GuiV1();
}
}
It is there, Paul, hidden in the getTable() method.
sunExpance in answer to your original question:
> Incidentally, how can I send modurlaized files for insepection. It would look very long if posted on this textarea.
If you have that much code, then having to read it is a strong disincentive to helping you. The best thing to do is to come up with a short piece of code which demonstrates the problem. However, if you are going to post code in here please use [code][/code] tags, as that makes your code legible.
With regard to your problem here, I would advise breaking it down into two halves: the DB access and the UI. First write some code which just accesses the DB and prints i) the exact SQL query; ii) the results to stdout (System.out.println(...)). If you can't get that working, post the code and the output, and if possible post the output of the same query performed within the database's native access environment. Once that's working, then add the GUI.