Java Reference
In-Depth Information
{
JDBCGUI frame = new JDBCGUI();
frame.setSize(400,200);
frame.setVisible(true);
frame.addWindowListener(
new WindowAdapter()
{
public void windowClosing(
WindowEvent winEvent)
{
try
{
connection.close();
System.exit(0);
}
catch(SQLException sqlEx)
{
System.out.println(
"*Error
on
closing
connection!*");
}
}
}
);
}
public JDBCGUI()
{
setTitle("Accounts Data");
try
{
connection = DriverManager.getConnection(
"jdbc:odbc:Finances","","");
statement = connection.createStatement();
results = statement.executeQuery(
"SELECT * FROM Accounts");
heads = new Vector<String>();
for (int i=0; i<heading.length; i++)
{
heads.add(heading[i]);
}
rows = new Vector<Vector<Object>>();
while (results.next())
Search WWH ::




Custom Search