Pessoal,
Ola,
Estou fazendo o exemplo de como utilizar o Hibernate que esta presente na area de tutoriais desse forum (aquele com classes Amigo, AmigoDAO…) e estou enfrentado o seguinte problema:
FATAL hibernate.connection.DriverManagerConnectionProvider -> JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQLServerDriver.
O hibernate que eu uso eh o 2.1, o eclipse eh o 3.0.1, o banco de dados eh o SQLServer 2000 e o arquivo de propriedades(hibernate.properties) eh esse:
Código:
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class = com.microsoft.jdbc.sqlserver.SQLServerDriver
hibernate.connection.url = jdbc:microsoft:sqlserver://192.162.0.3:1433/hibernate
hibernate.connection.username = xx
hibernate.connection.password = xxxx
hibernate.show_sql=true
o arquivo .jar do driver mssqlserver.jar esta no classpath do projeto, ja esta na pasta JAVA_HOME\jre\lib, ja esta na pasta lib do hibernate, ja fiz o diabo e esse troco nao funciona!
Tambem tentei fazer funcionar com o plugin Hibernate Synchronizer que gera o arquivo hibernate.cfg.xml:
Código:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory name="factory" >
<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://192.162.0.3:1433/hibernate</property>
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.username">xx</property>
<property name="hibernate.connection.password">xxx</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for Microsoft SQL Server -->
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
</session-factory>
</hibernate-configuration>
Mas dai da esse erro aqui:
2005-03-16 14:07:31,343 INFO hibernate.cfg.Environment -> Hibernate 2.1.8
2005-03-16 14:07:31,343 INFO hibernate.cfg.Environment -> hibernate.properties not found
2005-03-16 14:07:31,375 INFO hibernate.cfg.Environment -> using CGLIB reflection optimizer
2005-03-16 14:07:31,375 INFO hibernate.cfg.Environment -> using JDK 1.4 java.sql.Timestamp handling
2005-03-16 14:07:31,375 INFO hibernate.cfg.Configuration -> Mapping resource: Amigo.hbm.xml
2005-03-16 14:07:33,734 INFO hibernate.cfg.Binder -> Mapping class: Amigo -> amigos
2005-03-16 14:07:33,812 INFO hibernate.cfg.Configuration -> processing one-to-many association mappings
2005-03-16 14:07:33,828 INFO hibernate.cfg.Configuration -> processing one-to-one association property references
2005-03-16 14:07:33,828 INFO hibernate.cfg.Configuration -> processing foreign key constraints
2005-03-16 14:07:33,875 WARN hibernate.cfg.SettingsFactory -> No dialect set - using GenericDialect: The dialect was not set. Set the property hibernate.dialect.
2005-03-16 14:07:33,875 INFO hibernate.dialect.Dialect -> Using dialect: net.sf.hibernate.dialect.GenericDialect
2005-03-16 14:07:33,890 INFO hibernate.cfg.SettingsFactory -> Use outer join fetching: true
2005-03-16 14:07:33,890 WARN hibernate.connection.UserSuppliedConnectionProvider -> No connection properties specified - the user must supply JDBC connections
2005-03-16 14:07:33,906 INFO hibernate.transaction.TransactionManagerLookupFactory -> No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
2005-03-16 14:07:33,906 INFO hibernate.cfg.SettingsFactory -> Use scrollable result sets: false
2005-03-16 14:07:33,906 INFO hibernate.cfg.SettingsFactory -> Use JDBC3 getGeneratedKeys(): false
2005-03-16 14:07:33,906 INFO hibernate.cfg.SettingsFactory -> Optimize cache for minimal puts: false
2005-03-16 14:07:33,906 INFO hibernate.cfg.SettingsFactory -> Query language substitutions: {}
2005-03-16 14:07:33,906 INFO hibernate.cfg.SettingsFactory -> cache provider: net.sf.hibernate.cache.EhCacheProvider
2005-03-16 14:07:33,921 INFO hibernate.cfg.Configuration -> instantiating and configuring caches
2005-03-16 14:07:33,953 WARN ehcache.config.Configurator -> No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/F:/Bin/hibernate-2.1/lib/ehcache-0.9.jar!/ehcache-failsafe.xml
2005-03-16 14:07:34,140 INFO hibernate.impl.SessionFactoryImpl -> building session factory
2005-03-16 14:07:34,484 INFO hibernate.impl.SessionFactoryObjectFactory -> Not binding factory to JNDI, no JNDI name configured
java.lang.UnsupportedOperationException: The user must supply a JDBC connection
at net.sf.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:32)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:292)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3373)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3333)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:63)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:5
at net.sf.hibernate.impl.BatcherImpl.prepareBatchStatement(BatcherImpl.java:111)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:454)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2449)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2435)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2392)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2261)
at AmigoDAO.insert(AmigoDAO.java:22)
at TesteAmigo.main(TesteAmigo.java:30)
Alguem por favor me ajude!
Fischer