-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQ
PostPosted: Thu Nov 25, 2010 12:03 am 
Newbie

Joined: Wed Nov 24, 2010 11:49 pm
Posts: 4
Hi guys, im newbie using java and hibernate, im trying to connect with a database in mssql, but im having this error

336 [main] ERROR org.hibernate.connection.DriverManagerConnectionProvider - JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQLServerDriver
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)
at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:84)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:79)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:425)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)
at grabaempleado.main(grabaempleado.java:12)
443 [Finalizer] INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: null

this is my config file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="Factory">
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.password">pass</property>
<property name="hibernate.connection.url">jdbc:odbc:embedded_sql_app://127.0.0.1;DatabaseName=cipencil;SelectMethod=cursor</property>
<property name="hibernate.connection.username">user</property>
<property name="hibernate.default_catalog">cipencil</property>
<property name="hibernate.default_schema">portatil</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<mapping resource="empleado.hbm.xml"/>
</session-factory>
</hibernate-configuration>

the sqljdbc.jar is in the libraries of my proyect i dont know what to do somebody help me please =(

thanks for ur time


Top
 Profile  
 
 Post subject: Re: JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQ
PostPosted: Thu Nov 25, 2010 1:43 am 
Newbie

Joined: Tue Nov 23, 2010 7:28 am
Posts: 4
try this way.. it should work..

<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://127.0.0.1:3306/test</property>


Top
 Profile  
 
 Post subject: Re: JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQ
PostPosted: Thu Nov 25, 2010 5:27 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
maverma wrote:
try this way.. it should work..

<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://127.0.0.1:3306/test</property>



Why should he use the MySQL-Driver if he has a MS-SQL-Server?

@papablopop
It's not enough to have the jar in a folder, you have to put it on your classpath.


Top
 Profile  
 
 Post subject: Re: JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQ
PostPosted: Thu Nov 25, 2010 10:17 am 
Newbie

Joined: Wed Nov 24, 2010 11:49 pm
Posts: 4
thanks for urs answers, yes the jars r in my proyect
u can see here
http://cid-aad600bca61c4307.skydrive.live.com/redir.aspx?page=play&resid=AAD600BCA61C4307!597

config file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="Factory">
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.password">pass</property>
at this part i have a doubt
<property name="hibernate.connection.url">[b]jdbc:sqlserver://127.0.0.1:1433;DatabaseName=cipencil;SelectMethod=cursor</property>[/b]
<property name="hibernate.connection.username">user</property>
<property name="hibernate.default_catalog">cipencil</property>
<property name="hibernate.default_schema">portatil</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<mapping resource="empleado.hbm.xml"/>
</session-factory>
</hibernate-configuration>

thanks 4 ur time


Top
 Profile  
 
 Post subject: Re: JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQ
PostPosted: Thu Nov 25, 2010 3:25 pm 
Newbie

Joined: Wed Nov 24, 2010 11:49 pm
Posts: 4
its me again, i found a solution

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

i changed this line
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
for this
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
the curious thing is, i used the hibernate autogeneration tools to generate the configuration file :$...

and now i have another error :$ haha "luv java"
error org.hibernate.MappingException: entity not found: Empleado

i have the Empleado class created

whats wrong?

thanks 4 ur time


Top
 Profile  
 
 Post subject: Re: JDBC Driver class not found: com.microsoft.jdbc.sqlserver.SQ
PostPosted: Thu Nov 25, 2010 4:49 pm 
Newbie

Joined: Wed Nov 24, 2010 11:49 pm
Posts: 4
I CAN DO IT HAHAHA THANKS FOR UR HELP, i have the last problem with the connect to mssql server this link help me to solve this

http://santyhoney.wordpress.com/2009/10/03/solucion-problema-de-conexion-de-ms-sql-server-2005-con-java/

its in spanish.


BR


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.