Subject Re: JayBird + Firebird Embedded on Win 7 x64
Author denixx.baykin
2Roman

I builded sources using Ant.
Got jaybird-full-2.2.0.jar in output\lib folder.
Moved it to the project folder and added it as a external jar in Eclipse.

Ran the project and got the following exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jaybird22_x64 in java.library.path

After that i have added the jaybird22_x64.dll to the project folder.
Ran it and got another exception about database opening error.
Corrected the sql-code, added the database file from virtual machine WinXP x32 to the Win 7 x64 project (This database works in WinXP x32).

Corrected java-code Main.java:
package test;

import java.sql.*;

public class Main {

public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("org.firebirdsql.jdbc.FBDriver");

Connection bd = DriverManager.getConnection("jdbc:firebirdsql:embedded:database.fdb");
Statement st = bd.createStatement();
//st.execute("create table if not exists 'TABLE1' ('name1' int, 'name2' text, 'name3' text);");
st.execute("delete from TABLE1; ");
st.execute("insert into TABLE1 (name1, name2, name3) values (1, 'name1', 'name2'); ");
st.execute("insert into TABLE1 (name1, name2, name3) values (2, 'name3', 'name4'); ");
st.execute("insert into TABLE1 (name1, name2, name3) values (3, 'name5', 'name6');");
ResultSet rs = st.executeQuery("select * from TABLE1");
while (rs.next())
{
System.out.print (rs.getString(1)+" ");
System.out.print (rs.getString(2)+" ");
System.out.println(rs.getString(3));
}
}
}

Ran this and got next exception:

Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/runtime/RecognitionException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.firebirdsql.gds.ClassFactory.get(ClassFactory.java:61)
at org.firebirdsql.gds.impl.jni.EmbeddedGDSFactoryPlugin.getConnectionClass(EmbeddedGDSFactoryPlugin.java:31)
at org.firebirdsql.gds.impl.GDSFactory.getConnectionClass(GDSFactory.java:334)
at org.firebirdsql.jca.FBManagedConnectionFactory.newConnection(FBManagedConnectionFactory.java:785)
at org.firebirdsql.jca.FBManagedConnection.getConnection(FBManagedConnection.java:485)
at org.firebirdsql.jca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:73)
at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:122)
at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:131)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at test.Main.main(Main.java:10)
Caused by: java.lang.ClassNotFoundException: org.antlr.runtime.RecognitionException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 13 more

What am I doing wrong?