0

I'm using some simple connection database in java server pages.
to make an web database application.

  1. using this driver syntax

Connection con = DriverManager.getConnection("jdbc:odbc:myodbc");

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

  1. my sample used driver

    Connection con = DriverManager.getConnection
    ("jdbc:odbc:driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + application.getRealPath("WEB-INF/database.mdb"));`

How can I using to include in every pages of web pages application in any folder on my web server?

I don't want too make heavier my web software...

user2427906
  • 321
  • 2
  • 5
  • Why don't you create a DAO class that will handle your database connections in a reusable way (maybe with a connection pool as well?) with the added benefit of having a more MVCish application – ufasoli May 28 '13 at 11:44

1 Answers1

0

Aside from the fact that it's strongly discouraged to put logic in your JSP's (you should move the logic to servlets and use JSPs only for presentation purposes, what you want is a connection pool.

It either exists in your server (for Tomcat, look here) or can be integrated as an extra feature - see How to establish a connection pool in JDBC? for some possibilities.

Community
  • 1
  • 1
fvu
  • 32,488
  • 6
  • 61
  • 79