Search code examples
jdbcseam

Seam connect to DB and retrieve data


I am using Seam Framework-Java EE for my web application. The end user will connect to a database and retrieve some records with an SQL (or HQL) command in my web application (it has a GUI).

Parameters (fields) will be: DB url (jdbc:oracle:thin:@...), username, password and SQL command to retrieve records. The GUI has these fields. Is it possible to do this with an entityManager? Or any suggestions please?

By the way, not only for Oracle, but also other DBs and drivers. Do I need to put driver jars somewhere or does Seam already have built-in drivers?


Solution

  • Lots of questions here

    In order:

    EntityManager - I've never used an entity manager to connect to random databases (which is what you're doing).

    Drivers: you'll need to supply drivers for each database type you're planning on supporting.

    General: are you sure this is the best way to achieve what you're trying to do? Essentially you're giving users the ability to do what they want to your databases.