Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Connection Problem

0 views
Skip to first unread message

Shaun

unread,
Apr 6, 2002, 8:30:17 AM4/6/02
to
Hi,

I have created a program which updates stock levels for a shop. The program
uses Internal frames for each function i.e. connect, stock, users etc. Each
time i open a new frame it creates a new instance of that frame. The problem
is as follows: If I open the stock window before connecting to the database
i cant update stock, so i open the connect window to connect but the stock
window doesnt recognise this, I have to close the stock window and open it
again for the stock functions to work.

The main frame contains the connection details:

public static void setConnection(Connection c){
connection = c;
}

public static Connection getConnection(){
return connection;
}

In the stock window, I can access the connection as follows:

connection = mainFrame.getConnection();

I have tried debugging, but if i try the above senario, connection=null,
even though I have set the connect object by opening the connection window.

I am not sure if this is a problem with my gui programming or my database
programming. I would be very grateful for any help offered.

Thanks

Shaun

unread,
Apr 6, 2002, 12:20:48 PM4/6/02
to

John B. Moore

unread,
Apr 8, 2002, 8:25:28 PM4/8/02
to
duplicate post


+++++++++++++++++++++++
TeamB are volunteer helpers. Please do not email replies or questions.
Post or reply only on this newsgroup. Thank you.
For Papers on DataExpress, Applets, and Web Technologies go to:
http://www.microps.com/mps/papers.html
=======================

John B. Moore

unread,
Apr 8, 2002, 8:25:27 PM4/8/02
to
In article <3caef85d$1_1@dnews>, Shaun wrote:
> I have tried debugging, but if i try the above senario, connection=null,
> even though I have set the connect object by opening the connection window.
>

The best I can suggest is that the sequence is not what you think. If the
connection is created then you are not setting it when you think. It could
be that the events you expect are not occuring when you expect them. A good
way to debug somthing like this is to put System.out.println() at each
critial location to see what code is "really" firing.. then go from there..

John..

0 new messages