We have been trying some code compiled under java 1.3 running on SCO unix and have been unsuccessful in retrieving any data.
We get the following output:
TestDBF.checkConnection
TestDBF.getConnection
sql1 = SELECT * from urglocal WHERE model='XXXX' and unique=1000 AND urgid='YY'
Exception in thread "main" java.lang.UnsatisfiedLinkError: no JNIFile in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java, Compiled Code)
at java.lang.Runtime.loadLibrary0(Runtime.java:744)
at java.lang.System.loadLibrary(System.java:815)
at com.hxtt.concurrent.JNIFile.(Unknown Source)
at com.hxtt.concurrent.x.(Unknown Source)
at com.hxtt.concurrent.p.do(Unknown Source)
at com.hxtt.concurrent.p.if(Unknown Source)
at com.hxtt.concurrent.p.a(Unknown Source)
at com.hxtt.sql.dbf.i.null(Unknown Source)
at com.hxtt.sql.dbf.i.long(Unknown Source)
at com.hxtt.sql.dbf.d.a(Unknown Source)
at com.hxtt.sql.dbf.d.(Unknown Source)
at com.hxtt.sql.dbf.u.a(Unknown Source)
at com.hxtt.sql.be.if(Unknown Source)
at com.hxtt.sql.cv.a(Unknown Source)
at com.hxtt.sql.cv.a(Unknown Source)
at com.hxtt.sql.be.a(Unknown Source)
at com.hxtt.sql.be.a(Unknown Source)
at com.hxtt.sql.ab.a(Unknown Source)
at com.hxtt.sql.ab.a(Unknown Source)
at com.hxtt.sql.ab.executeQuery(Unknown Source)
at TestDBF.checkConnection(TestDBF.java, Compiled Code)
at TestDBF.(TestDBF.java:101)
at TestDBF.main(TestDBF.java:110)
TestClass:
public class TestDBF {
public static final String DBF_JDBC_DRIVER = "com.hxtt.sql.dbf.DBFDriver";
// public static final String DBF_JDBC_URL = "jdbc:dbf:/c:/fpd26";
public static final String DBF_JDBC_URL = "jdbc:dbf:////usr/tmp";
// For linux use e.g., "jdbc:dbf:////usr/tmp"
// For DOS use e.g., "jdbc:dbf:/c:/data"
private Properties props = new Properties();
/**
* get a database connection
*
* @return
*/
private Connection getConnection() {
System.out.println("TestDBF.getConnection");
Connection conn = null;
try {
Class.forName(DBF_JDBC_DRIVER);
props.setProperty("versionNumber", "F5");
props.setProperty("lockType", "FOXPRO");
conn = DriverManager.getConnection(DBF_JDBC_URL, props);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
/**
* Check that we can get a connection with the DBF driver and
* use the driver to update, query and execute SQL's
*/
private void checkConnection() {
System.out.println("TestDBF.checkConnection");
Connection conn = getConnection();
try {
Statement st = conn.createStatement();
String sql1 = "SELECT * from urglocal WHERE model='XXXX' and unique=1000 AND urgid='YY'";
System.out.println("sql1 = " + sql1);
long now = System.currentTimeMillis();
ResultSet rs = st.executeQuery(sql1);
while (rs.next()) {
System.out.println(rs.getString("urgid"));
}
rs.close();
String sql2 = "UPDATE urglocal SET model='0625' WHERE unique=1000 AND urgid='YY'";
System.out.println("sql2 = " + sql2);
now = System.currentTimeMillis();
st.executeUpdate(sql2);
System.out.println("Time taken for update: " + (System.currentTimeMillis() - now));
sql2 = "INSERT INTO urglocal (model, urgid, unique) values ('XXXX', 'YY', 1000)";
System.out.println("sql2 = " + sql2);
now = System.currentTimeMillis();
st.executeUpdate(sql2);
System.out.println("Time taken for insert: " + (System.currentTimeMillis() - now));
st.close();
conn.close();
} catch (SQLException e) {
System.err.println(e);
SQLWarning warnings = null;
try {
warnings = conn.getWarnings();
int errorCode = warnings.getErrorCode();
String message = warnings.getMessage();
System.out.println("message = " + message);
System.out.println("errorCode = " + errorCode);
} catch (SQLException e1) {
System.out.println("errror 2 = " + e1);
}
}
}
/**
* Call the checkConnection method when the class is constructed
*/
public TestDBF() {
checkConnection();
}
/**
* Run the test
*
* @param args
*/
public static void main(String[] args) {
new TestDBF();
}
} // TestDBF
Any help or advice would be welcomed.
Tony Burgess
Actual Systems UK Ltd.
|
1st solution:
>props.setProperty("lockType", "FOXPRO");
If you haven't any FOXPRO application on SCO unix, you can remove that lockType property, then your program can run normally.
2nd solution:
If you use JDK1.4.X, or JDK1.5.X, not JDK1.3.X,you needn't JNIFile library.
3rd solution:
>no JNIFile in java.library.path
You should download JNIFile.zip from http://www.hxtt.com/download.jsp?product=dbf. More detailed information is at Question 6:"You need download the JNIFile.dll ( or libJNIFile.so) from here, and add the JNIFile.dll ( or libJNIFile.so) into your library path. DBF driver will lock and unlock automatically when you execute SQL through DBF driver.".
|