I'm still working on getting my head around this type of design. I might have been a little further along a few years ago in PHP, but some of it has slipped. I know what i have so far can be cleaned up, so by all means point out those mistakes as well.

What I need to do is create a Close() function. I need to close "connection" that resides inside Connect(). I'm thinking that needs defined within database() but I'm not 100% sure. The idea behind what I'm doing is I wasnt to register the driver, make a connection, and be able to return multiple query results using database() before using database.close()

Any help and pointers is much appreciated with this little self teaching exercise of mine.

I don't do java, but I do C# whcih is very semantically similar. I think issue is scoping -- your connection is a variable inside the Connect method, it probably should be a class variable or perhaps just returned from the function so the caller can manage the lifecycle.

I'd also advise not catching the exceptions but letting them bubble. If I was writing code against this I'd want exceptions not stacktraces and false returns.

KyleWolfe
—
2012-10-18T14:13:24Z —
#3

So in C#, how would that be written do you think so I can give it a try?

What do you guys think? Please help me correct anything. My goal is that I can run multiple queries inside the class before closing the connection by calling resultSetClose, once completed, close the connection with dbClose().