This is my first post to the forum, thank you in advance for your time and help. I've got an exam scheduling application that's hooking into a SQL server database for a class. I'm trying to run the following command:
because what you posted there is not valid SQL at all. It's Java code. Perhaps the variable it constructs contains valid SQL, but there's no evidence that you have tested that. In other words, look at the SQL and not at the Java code.
extract the sql statement out into a string.
Then you can debug it, by using system.out.println (or a debugger if you are using an IDE like eclipse or netbeans).
I expect you will find you have made a mistake in constructing your string which isn't easily visible in the code.
As the syntax for sql is exactly the same whether you run it from java or an sql window.
Joined: Apr 23, 2012
thank you both for your replies. The syntax was concatenated incorrectly, and it was as simple as that. When I say I took the code and ran it in an SQL editor, I meant I took the SQL piece of the code, and ran it in an SQL editor. I might be a noob to this board, but I understand you can't run java code in SQL.