The getInstance() method seems to indicate you are trying to use a singleton pattern.
Generally with that pattern, the getInstance() method should be static, but none of the other methods on the class.
You obtain the object via the call to getInstance() and then invoke the non static methods on that object.
The database code looks a bit dodgy as well.
What is the ConnectionsManager class?
You get both a connection and a statement from it, but then only use the statement.
The general way to use it would be to obtain a connection, and then create the statement from the connection object.
I would also recommend using prepared statements over sql strings like you have to guard against sql injection.
Joined: Jun 23, 2012
It worked the way you said (with leaving away the "static") for the rest of the methods :)
I use only Statement, but invoking the connection method as well because they are bound together:
The ConnectionsManager.java is:
Concerning PreparedStatement, you're the second one saying that, but well I'm using that insert statement only once.
Bear Bibeault wrote: So? Is that a good reason to leave your site open to SQL injection?
I read now on Wiki about this. I don't want to sound rude or something but, look, I'm not working on a commercial software now. I'm just making a project and my prof. said to use just Statements, plus I would have to write a few methods more in the java file and I really don't have the time right now. I need to make my project full and working and afterwards, with the remaining time(i hope i'll have it) I'll try to see what I can change in some parts.
subject: Error accessing a static method (JSP, Java)