Kindly help with the "cannot connect to the database" error
nash avin
Ranch Hand
Joined: Nov 18, 2004
Posts: 45
posted
0
Hello All,
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
Thanks for the reply.Sorry to have not included the error message .The error message I get is as follows
Thank you again for your time.
Help would be greatly appreciated.
AS
Craig Jackson
Ranch Hand
Joined: Mar 19, 2002
Posts: 405
posted
0
One suggestion, could it be that you don't have access to add records to this particular database?
Jayesh Lalwani
Ranch Hand
Joined: Nov 05, 2004
Posts: 502
posted
0
Originally posted by nash avin:
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?
Jayesh
nash avin
Ranch Hand
Joined: Nov 18, 2004
Posts: 45
posted
0
Hi ,
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
Jayesh Lalwani
Ranch Hand
Joined: Nov 05, 2004
Posts: 502
posted
0
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 agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Kindly help with the "cannot connect to the database" error