Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package packageDonnes;
- import java.sql.*;
- import oracle.jdbc.pool.OracleDataSource;
- import packageMetier.Films;
- /**
- *
- * @author Guillaume
- */
- public class Connexion {
- public Connexion() {
- }
- private Connection conn;
- public Connection Connecter() throws java.sql.SQLException {
- String userid = "p00000"; // A MODIFIER
- String password = "motmot"; // A MODIFIER
- String URL = "jdbc:oracle:thin:@iuta.univ-lyon1.fr:1521:orcl"; // Adresse de l'hote distant
- DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver() );
- conn = DriverManager.getConnection(URL,userid,password);
- if( conn == null )
- {
- System.exit(1);
- }
- return(conn);
- }
- public void closeConnection() throws java.sql.SQLException {
- conn.close(); // Fermeture de la connection
- }
- }
Add Comment
Please, Sign In to add comment