It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes Connection to PervasiveSQL fails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connection to PervasiveSQL fails" Watch "Connection to PervasiveSQL fails" New topic

Connection to PervasiveSQL fails

fedai gandjaliyev
Ranch Hand

Joined: Dec 05, 2005
Posts: 99
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
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(
at com.pervasive.jdbc.lna.LNASocketSession.handshake(
at com.pervasive.jdbc.v2.Connection.<init>(
at com.pervasive.jdbc.v2.Driver.connect(
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at SMS.getClients(
at SMS.actionPerformed(
at javax.swing.AbstractButton.fireActionPerformed(
at javax.swing.AbstractButton$Handler.actionPerformed(
at javax.swing.DefaultButtonModel.fireActionPerformed(
at javax.swing.DefaultButtonModel.setPressed(
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(
at java.awt.Component.processMouseEvent(
at javax.swing.JComponent.processMouseEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(
at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

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?
Thank you!
Roman Merkushen

Joined: May 25, 2004
Posts: 9
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

Joined: Dec 05, 2005
Posts: 99
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.getConnection(url, username, password);
But doesnt work!
Please help!
Thank you!
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333

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

Joined: Dec 05, 2005
Posts: 99
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!
Antonio Loo

Joined: Jun 07, 2007
Posts: 1
The connection works if you add the two other jar files from the Pervasive driver bin folder, the jpscs.jar and the pvjdbc2x.jar.

Regina Olguin

Joined: Oct 03, 2003
Posts: 5
The last post did the trick - the library jpscs.jar - that was the kicker.
Thank you sooo much!
I agree. Here's the link:
subject: Connection to PervasiveSQL fails
It's not a secret anymore!