aspose file tools*
The moose likes JDBC and the fly likes I'm getting a null value passing my database connection string other class... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "I Watch "I New topic
Author

I'm getting a null value passing my database connection string other class...

Darryl Walker
Greenhorn

Joined: Oct 10, 2001
Posts: 1
Can someone please help me I'm trying to pass my database connection string to my Main class via returnConnection method. Method returnConnection() is located in class LoginMenu(). I'm not having any luck. It keeps returning a null value. I'm trying to pass the connection from LoginMenu() to Main(). Two files are involved for now. Can someone please give help me out.
This is what my returnConnection() method looks like:

Method returnConnection() is located in the class LoginMenu. However when I instantiate it, it doesn't work.

I'm trying to pass the Connection object to my Main() class. This is what I'm doing in class Main():

Keeps returning a null value what am I doing wrong.
-----------------------------------
Here's the code for my LoginMenu class...

I added the ubb tags for code to improve readablity

[This message has been edited by Carl Trusiak (edited October 10, 2001).]
[This message has been edited by Carl Trusiak (edited October 10, 2001).]
Toyin Sogeke
Greenhorn

Joined: Oct 08, 2001
Posts: 14
Hi,
From your LoginMenu source code, the connection object
will only have a value if button Connect (btnConnect)
is clicked.
You might want to review your LoginMenu source code, by
providing a default value for your Connection object.
Cheers
Originally posted by Darryl Walker:
[B]Can someone please help me I'm trying to pass my database connection string to my Main class via returnConnection method. Method returnConnection() is located in class LoginMenu(). I'm not having any luck. It keeps returning a null value. I'm trying to pass the connection from LoginMenu() to Main(). Two files are involved for now. Can someone please give help me out.
This is what my returnConnection() method looks like:

Method returnConnection() is located in the class LoginMenu. However when I instantiate it, it doesn't work.

I'm trying to pass the Connection object to my Main() class. This is what I'm doing in class Main():

Keeps returning a null value what am I doing wrong.
[/B]


homeboy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I'm getting a null value passing my database connection string other class...