aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate Dialect for MS Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Dialect for MS Access" Watch "Hibernate Dialect for MS Access" New topic
Author

Hibernate Dialect for MS Access

Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
Hi ,

I am using this setting for MS Access Dialect for Hibernate.

But getting Error while parsing of hibernate.cfg.xml

<property name="hibernate.dialect">net.sf.hibernate.dialect.MSAccessDialect</property>
<property name="hibernate.conn.driver_class">sun.jdbc.odbc.JdbcOdbcDriver</property>
<property name="hibernate.conn.url">jdbcdbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ=C:\health\hibernateData.mdb
</property>

Error is : Value must be declared for element type "property".

Please help on this.

Regards,
Prabhat
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
This is my hibernate.cfg.xml




This problem solved, but now i am getting this error:

Dialect class not found: net.sf.hibernate.dialect.MSAccessDialect

could anyone tell me where i am wrong ?
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
I think no dialect made for MS Access so its not working
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
You're right that Hibernate does not ship with an Access dialect; that hasn't stopped various people from writing one, though. You'll find their efforts by searching for "access hibernate dialect" or some such phrase.

But Access as a DB is limited, as is the JDBC/ODBC bridge driver you're trying to use, so be prepared for problems. If this is for a commercial project I advise to use a real JDBC driver (like http://www.hxtt.com/access.html) which incidentally comes with a Hibernate dialect.
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
thanks i have downloaded the mysql and now working fine for the same.

Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
I am getting this error:
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection


My java code:


my cfg file:



this is the error while executing the file:


Exception in thread "main" org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)


what is the problem with the connection.

hOW CAN I GO AHEAD TO SOLVE THIS
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Is MySql up and running on port 3036? Can you connect to it with some other JDBC client?
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
yes mysql was up and i am not sure it was running up on 3036.

How can i make sure that it is running on 3036.
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
You would have had to configure it especially to use that port, because the default port is 3306.
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
yes i checked it is using 3036 port only .

any another clue to resolve it, i saw in google there is lot of people has faced this issue...the solution is also quite different for each one.

I am sorry for typing mistake

it is running only in 3036 port
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
Well, if it uses port 3026 (that's not a typo, right?), then you can't expect to be able to connect to port 3036.
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
i am sorry in typing mistake , it is using 3036 only.

Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
In that case you can use a JDBC client like SquirrelSQL to make sure you can connect. Or write a small desktop application that uses JDBC to test the connection.
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
this is not enough to test , i am using mysql console base client , where i am able to connect it.



[Thumbnail for Mysql_connect.jpg]

Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
That image shows you using a DB named "prabhat" - that's not what the config file uses.

How are you specifying to use port 3036 when starting the MySQL client?
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
I checked the configuration setting it is using 3036

PFA snap screen.



[Thumbnail for port_mysql_3036.jpg]

Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
I checked the configuration setting it is using 3036

Actually, no, just as I thought. Software development is all about paying attention to detail.
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
yes you are true, so i say every unknown thing is known by some known thing.
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
I have tested a simple jdbc program to test the connection.

But getting error:

import java.sql.*;



Error is :




I also looked into the google, lot of people faced same issue but no reply.

could any one help me on this. how peoples are using my sql for development environment.
is there any thing missing from my end.

I have already imported the mysql-connection in build path.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
jdbc:mysql://localhost:3036/


Try using the machine's IP address instead of localhost
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
What I meant by my last post is: Your MySQL instance is NOT running on port 3036. The screenshot you posted shows the actual port. That's what I mean by "paying attention to details".
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
hey lester, see my other post and mysql is running only on 3306 port.

What else i can do

i checked using command: netstat -a

Proto Local Address Foreign Address State
TCP 0.0.0.0:135 Prabhat-PC:0 LISTENING
TCP 0.0.0.0:445 Prabhat-PC:0 LISTENING
TCP 0.0.0.0:2869 Prabhat-PC:0 LISTENING
[b][/b]
TCP 0.0.0.0:5151 Prabhat-PC:0 LISTENING
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
What do you mean: "what else can I do"? All the code you posted shows that you are trying to connect to the DB on a port on which -as you now know- it is not listening. The screenshot you posted 2 days ago already told you which port to use, if only you had paid attention to detail. Now there's nothing left to do but fix your code.
Prabhat Ranjan
Ranch Hand

Joined: Oct 04, 2006
Posts: 391
i am sorry , i have fixed my issue..

Now hibernate and jdbc all is working. ALL is WELL.
Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18910
    
    8

See also this thread for a parallel but similar process: http://www.coderanch.com/t/298301/JDBC/java/which-port-mySQL-running.
 
Don't get me started about those stupid light bulbs.
 
subject: Hibernate Dialect for MS Access