| 12
 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
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 
 | 
hibernate.cfg.xml
hibernate-configuration>
    <session-factory>
    <property name="connection.Datasource">
        java:comp/env/jdbc/bdo
    </property>
    <property name="show_sql">true</property> 
        <property name="dialect">
              org.hibernate.dialect.SQLServerDialect
        </property> 
        <mapping resource="Societes.hbm.xml"/>
        <mapping resource="Utilisateurs.hbm.xml"/>
        <mapping resource="Contacts.hbm.xml"/>
    </session-factory>
</hibernate-configuration>
web.xml
j'ai ajouté dans le web.xml le code suivant
<resource-ref>
   <description>Mon Pool de connectionl</description>
   <res-ref-name>jdbc/bdo</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
   <res-sharing-scope>Shareable</res-sharing-scope>
 </resource-ref>
context.xml
j'ai ajouté dans le context.xml le code suivant
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/IntraSitel">
  <ResourceLink name="jdbc/bdo" global="jdbc/bdo"  type="javax.sql.DataSource"/>
</Context>
Configuration avec la console d'administration de tomcat
JNDI NAME=jdbc/bdo
Data Source URL=jdbc:sqlserver://192.168.0.237:1433;database=bdo
JDBC Driver Class=com.microsoft.sqlserver.jdbc.SQLServerDriver
USER NAME=nomutilisateur database
password=mot de passe
Max. Active Connections:4
Max. Idle Connections:2
Exception
Exception in thread "main" java.lang.UnsupportedOperationException: The user must supply a JDBC connection
        at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30)
        at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
        at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
        at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:118)
        at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
        at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1319)
        at dao.testClass.App(testClass.java:103)
        at dao.testClass.main(testClass.java:173)
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds) | 
Partager