• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Hibernate Dialect for MS Access

 
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think no dialect made for MS Access so its not working
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks i have downloaded the mysql and now working fine for the same.

 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is MySql up and running on port 3036? Can you connect to it with some other JDBC client?
 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You would have had to configure it especially to use that port, because the default port is 3306.
 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am sorry in typing mistake , it is using 3036 only.

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is not enough to test , i am using mysql console base client , where i am able to connect it.

Mysql_connect.jpg
[Thumbnail for Mysql_connect.jpg]
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I checked the configuration setting it is using 3036

PFA snap screen.

port_mysql_3036.jpg
[Thumbnail for port_mysql_3036.jpg]
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes you are true, so i say every unknown thing is known by some known thing.
 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jdbc:mysql://localhost:3036/



Try using the machine's IP address instead of localhost
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 397
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am sorry , i have fixed my issue..

Now hibernate and jdbc all is working. ALL is WELL.
Thanks
 
Sheriff
Posts: 28322
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See also this thread for a parallel but similar process: https://coderanch.com/t/298301/JDBC/java/which-port-mySQL-running.
 
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic