Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Alex Evans   on Sep 18 In Java Category.

  
Question Answered By: Brandon Tucker   on Sep 18

I dont think there is any big advantage of using
static intializer block for connection  if you are
using it only once.It will give you Connection object
just before the application  is started which you can
use later in your code.
According to me if you are using the database  heavily
then you should consider using connection pool from
where you can get connection object  as and when
required.It also reduces the overhead of opening and
closing the connection everytime you are using it.

Share: