thelordoftherings
Programmer
Hello,
When I am writing this code:
Connection connection;
try
{
connection = DriverManager.getConnection...
}
catch( SQLException e )
{
e.printStackTrace();
}
finally
{
try
{
connection.close();
}
catch( SQLException e )
{
e.printStackTrace();
}
}
I receive a complitation error on this line: connection.close(): "Connection may have not have been initialized". But of course it may not have been initialized, this is why the try...catch are for. So why am I receiving this error?
Roy
When I am writing this code:
Connection connection;
try
{
connection = DriverManager.getConnection...
}
catch( SQLException e )
{
e.printStackTrace();
}
finally
{
try
{
connection.close();
}
catch( SQLException e )
{
e.printStackTrace();
}
}
I receive a complitation error on this line: connection.close(): "Connection may have not have been initialized". But of course it may not have been initialized, this is why the try...catch are for. So why am I receiving this error?
Roy