Connexion JDBC avec Access.
Bonsoir,
Bien que n'ayant pas de msg d'erreur a la compile et au debug, je ne parviens pas a me connecter a ma db. Quelqu'un pourrait-il m'aider ?
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| import java.util.*;
import java.sql.*;
public class PersonDAO
{
// arraylist used to store PersonInfo objects
private ArrayList personsList;
private Connection conn;
//***************************************************************************
// constructor
public PersonDAO()
{
personsList = new ArrayList();
initConn();
}
//****************************************************************************
// method used to establish connection with DB
public void initConn()
{
try
{
// load driver
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
// establishing connection
Connection conn = DriverManager.getConnection("jdbc:ucanaccess://c:/Users\\hab\\Desktop\\Decisionsjava1.accdb;memory=false");
}
catch(Exception e)
{
System.out.println(e);
}
} |