Question regarding Connection object for MySQL database

I have a question regarding a project I'm working on. My project is a Java application that accesses a MySQL database underneath it. I am creating a Login window that would allow users to log into their accounts.

The Login procedure consists of a JFrame class and a JInternalFrame class. The JInternalFrame is used for UserLogin. After the user enters his/her username/password and clicks the LoginButton, a Connection object is created within the JInternalFrame. All the user information will be displayed on the JFrame once the user signs in on the JInternalFrame. So if an instance of JInternalFrame was created within the JFrame class...would the connection to the database exist within the JFrame class also??? EX:
public class UserLoginFrame{

//other implementation goes here
//addActionListeners implementation

class LoginButtonPressed implements ActionListener{
Connection conn = new Connection(); //Connection Object created

public class Scheduler{
UserLoginFrame usl = new UserLoginFrame();
Is the connection object now available in class Scheduler? I need a connection object to perform queries thats why. If this route doesn't work with what I'm trying to accomplish, do you have any good suggestions? Sorry if i'm confusing some of you.

I appreciate all your help...thanks in advance!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!