1

I'm creating a db connection with Oracle using JDBC in a JSP page.

Is it safe to call connection every time before querying, as pages contains server side pagination and also some insert/delete queries too? Or Is there any better approach to handle connection instead of calling every time getConnection(...)?

DriverManager.getConnection(url, user, password);
Matteo Baldi
  • 5,613
  • 10
  • 39
  • 51
userLearner
  • 127
  • 1
  • 11

1 Answers1

2

It is not a good practice to create new connection every time in JSP. Instead use connection pooling. You can find more information about connection pooling here - Connection Pooling Strategy For A JSP Site?

Krishna
  • 21
  • 3