• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MySQL & JNI

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone here have any experience with using JNI to embed MySQL within a java application. MySQL is written in C, and they give an example of how to embed it within a C probram but nothing for java. Having no experience with calling native methods I'm wondering how tough this will be. Is JNI the type of API that you really need a book for?

Any thoughts would be appreciated.

ms
 
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why would you like to embbed mysql in your java application and not use jdbc?
Any particular reasons? You might consider another java embeddable db (HSQL, Berkley DB, etc).

--
./pope
[the_mindstorm]
 
Mike Southgate
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will be using jdbc. Only, instead of my app accessing a separate server the dbms will run as part of my app. That way I don't need to force users to install and run mySQL themselves. The complexity of installing MySQL will be too much for most of my users.

ms
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this case I would suggest to take a look at the above mentioned solutions, that are prooved to be easy to embbed.

--
./pope
[the_mindstorm]
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does every instance of the application access its own version of the database? If that's the case, I would recommend looking at a database designed for such useage, such as HSQLDB (which I use to great effect...) Keep MySQL as a server-side database, and I think that you will have far fewewr headaches.
 
Mike Southgate
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's interesting that while thinking it over at work today I reached the same conclusion. I'll just pass a parameter in to tell the app what db to use and have it use HSQL for the embeded version and MySQL for the server version. That way I can easily add more db's if desired down the line.

I'm planning on using resourceBundle to hold the sql strings for each db.

thanks

ms
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great to hear that our opinions/experience is confirmed by your research .

--
./pope
[the_mindstorm]
 
reply
    Bookmark Topic Watch Topic
  • New Topic