File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes sql driver with hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "sql driver with hibernate" Watch "sql driver with hibernate" New topic

sql driver with hibernate

Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242

I am using hibernate to write data into mysql database. I get the following error.

I have used hibernate3.jar. I tried the following jars.

1. mysql-connector-java-3.1.11-bin.jar
2. mysql-connector-java-3.1.7-bin.jar
3. mysql-connector-java-3.0.17-ga-bin.jar

But all three of them failed? Do I need anything other jar file apart from hibernate3.jar and mysql connector jar? Please let me know.
Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
my hibernate.cfg.xml as follows.

Anything wrong in the syntax? Thanks.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

<property name="connection.url">mysql.url=jdbc:mysql://DGDS03/test</property>

That looks suspicious. I've never seen a JDBC URL with an '=' symbol in it. Sure it shouldn't just be jdbc:mysql://DGDS03/test ?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Gopu Akraju
Ranch Hand

Joined: Jan 13, 2008
Posts: 242
Thanks Paul. That worked.

My hbm.xml file is as follows:

I get my exception as follows.

I am trying to add two strings (i.e, testNum and testLane) into my table test.

I have created a table test with two columns as RunNum and Control both of VARCHAR(30) datatype.

The place where I call commit in my java class is as follows:

Why am I getting this exception? Thanks.
[ June 27, 2008: Message edited by: Gopu Akraju ]
g wildin

Joined: Jun 26, 2008
Posts: 3
Maybeit appears because you are trying to save a String which does not have a mapping so Hibernate doesn't know how to save it.
I agree. Here's the link:
subject: sql driver with hibernate
jQuery in Action, 3rd edition