This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
First, I am sorry about my broken English. I have created simple project manager software with MySql and Java and I got this little problem.
my problem: : java.sql.SQLException: No row count was produced -so there is something wrong in my code, but I can�t find out what is wrong If I do those sql-clauses without switch they work.
This is what i am trying to do: Sql-clause should check is there this days(2004-07-29) field in database if there is sql-clause should only update hours(user given) of the day, but if there is not this days field sql-clause should create it. That�s why I need switch.
I have tried to resolve this problem days. If someone could please help me
Torsti, well, this doesn''t look like standard JDBC to me at all! That would answer why no one has replied to your request for help. They can't help you.
Here's why I think your using non-standard JDBC. Firstly, in JDBC, you supposed to get an object that implements the Connection interface from a DriverManager, or from a DataSource. In your code, you just new a Connection() class, so I suspect somebody where you work wrote a very special Connection class to allow other developers to retrieve a connection easily (they probably did this to do connection pooling, but of course, that is a guess).
Second thing, we don't know what your special Connection class does, but you are calling updatdeQuery() on it. In standard JDBC, you would get a PreparedStatement from the connection, or at least a Statement, and then call executeUpdate() or executeQuery() on that. So now, we can see your using a non-standard way of executing SQL statements. ----------------- Having said that, I suspect your call to conn.updateQuery(sqlClause) is not returning 0 or 1 at all, which is what you are assuming in your 'switch'. You need to put in a "default:" section into the 'switch' statement. Inside the "default:" section, write something like: System.out.println("default: called, updateQuery() not returning 0 or 1");