I posted this message some time back, but dont know why nobody is answering it.It would be nice if somebody takes the time to help me out with this.I did look into the forums , but could not get a suitable error correction.
It would be great if someone helps me out in this very helpful forum.I am giving you the code I have so far written
Don't you need to provide an username and a password to connect to the database? Also, can you print out the sql statement, copy it and try to run it in some other utility to see if there is problem with the sql statement itself?
Joined: Nov 18, 2004
Thanks a lot for the replies.I did print it out in a SQL utility and the statement is al right.
Regarding whether I can do the inserts, I can , I did a select * from <tablename> and it workds fine.
But Why is it with the insert....
It would be great if any one can direct me in the right direction.
Thanking you AS
Joined: Nov 05, 2004
I would suggest trying to run the exact same insert statement in the SQL utility using the same username/password
I can , I did a select * from <tablename> and it workds fine
Look at the permissions for the user you are connecting as - probably GUEST since you don't specify a username with your connection URL. Sounds like they only have permission to SELECT.
Also you might want to revise how you report the exception in your code - you have an error message "Unable to connect to DB" which will be logged when that is not the problem - you may well be able to connect, but you can't run the SQL. Generally trying to second guess what an exception will mean is not as good a strategy as just logging the stack trace and letting it tell you.