• 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

Connection to PervasiveSQL fails

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!
I'm trying to connect to a PervasiveSQL Server but I fail.
The driver that I use is pvjdbc2.jar (pvjdbc2x.jar might be needed).

Here is my code
Class.forName("com.pervasive.jdbc.v2.Driver");
String url = "jdbc ervasive://database_host_name:1583/source_name";
DriverManager.getConnection(url, username, password);

But here is the stacktrace of the exception that it throws

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/pervasive/pscs/Manager
at com.pervasive.jdbc.lna.LNAAbstractSession.handshake(LNAAbstractSession.java:111)
at com.pervasive.jdbc.lna.LNASocketSession.handshake(LNASocketSession.java:74)
at com.pervasive.jdbc.v2.Connection.<init>(Connection.java:81)
at com.pervasive.jdbc.v2.Driver.connect(Driver.java:57)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at SMS.getClients(SMS.java:275)
at SMS.actionPerformed(SMS.java:327)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

I guess it requires additional jar file (since it cannt find an inner class).
But I walked through forums and saw that everybody connects just using only that jar file.
Maybe you can forward onto a page where I can get another driver for PervasiveSQL?
PLEASE HELP!
Thank you!
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like your jar file is missing from the classpath.
Make sure to add pvjdbc2.jar to your classpath (WEB-INF/lib if using web container)
Good luck
 
fedai gandjaliyev
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using IntelliJ IDEA4.5.
I add pvjdbs2.jar to my libraries where rt.jar, etc. resides.
The strange thing is that the Pervasive-JDBC guide says that
I need only to download the pvjdbc2.jar, add it to my classpath
and write this
DriverManager.registerDriver("com.pervasive.jdbc.v2.Driver");
or
Class.forName("com.pervasive.jdbc.v2.Driver").newInstance();
DriverManager.getConnection(url, username, password);
But doesnt work!
Please help!
Thank you!
 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



I add pvjdbs2.jar to my libraries where rt.jar, etc. resides.



This effectively modifies our Java installation, which is generally considered to be a bad idea. For example, it makes it very difficult to have projects that use different versions of the driver.

Instead, jars should be placed in a directory associated with the directory where your compiled classes will reside. For example, in a J2EE web application, there is a "WEB-INF" directory, which contains a "classes" directory and a "lib" directory; "lib" is where application jars go. For a non-J2EE project, you have more flexability in where things are stored, but it's not a bad model to emulate.

Also, most IDEs don't use any externally set CLASSPATH; instead, each project has it's own CLASSPATH. So you need to pick a good location for the driver jar, and then make sure that location is part of your project's classpath.
 
fedai gandjaliyev
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I had to pick a good location for my jar file then I guess I had to
do it with any other jar that I ever used.
But when connecting to a mySQL database with the aid of the jtds1-1.jar
driver I just need to add it to my libraries
In IntelliJ IDEA you do it by File->Settings->Libraries(Classpath) tab
then Add jar/directory.
And everything works fine.
If you have any difficulties helping me out could you please forward
me onto a page where I get another driver for Pervasive.SQL.
I know that there is another driver PervasiveSQL.jar.
But I searched all the net for it but couldnt find it.
Maybe you can help me?
Waiting for reply.........
Thank you!
Fedai
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The connection works if you add the two other jar files from the Pervasive driver bin folder, the jpscs.jar and the pvjdbc2x.jar.

Cheers
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The last post did the trick - the library jpscs.jar - that was the kicker.
Thank you sooo much!
Regina
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic