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.
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.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Kindly help with the "cannot connect to the database" error