Hello Friends...
I have one urgent query...
Please help me solving it.

I am trying to use PreparedStatementCreator interface.
By making an anonymous inner class,i have implemented it's createPreparedStatement(Connection) method.
When this method is implemented, it will automatically called every time.
But, I want to know which is that connection object being passed to this method?
I am getting a exaception and the error message that is coming is Connection Refused.
Here's the code..

GeneratedKeyHolder generatedKeyHolder = new GeneratedKeyHolder();

        insertResult = adapterJdbcTemplate.update(
                new PreparedStatementCreator() {

                    public PreparedStatement createPreparedStatement(
                            Connection connection) throws SQLException {

                        PreparedStatement preparedStatement = connection
                        preparedStatement.setInt(2, pollingLog.getStatus());

                        return preparedStatement;
                }, generatedKeyHolder);

Please have a look and suggest me how to solve this issue...
Thanks & Regards,
Sumit Desai

Edited by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

7 Years
Discussion Span
Last Post by sumeetdesaeee

The "connection object coming to it" is the one provided to it by whatever calls it. What calls it? Where did that get its connection? I assume you do know what your program does, right?


Thnx a lot...Of course I know what my code does..
But the problem was very small.My IP address wasn't having the privilages to access the database server..That's it..Had to add those manually and it was done....

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.