This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
GCJ Compile HSQLDB Problem.
- From: Taufik Chowi <m4g1c14n2000 at yahoo dot com>
- To: java at gcc dot gnu dot org
- Date: Wed, 10 Sep 2008 04:12:12 -0700 (PDT)
- Subject: GCJ Compile HSQLDB Problem.
Test_HSQLDB.java
import java.sql.*;
public class Test_HSQLDB {
public static void main(String[] args) throws Exception {
Class.forName("org.hsqldb.jdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:hsqldb:test.db");
Statement stat = conn.createStatement();
stat.executeUpdate("drop table if exists people;");
stat.executeUpdate("create table people (id INTEGER IDENTITY , name VARCHAR(256), occupation VARCHAR(256));");
PreparedStatement prep = conn.prepareStatement("insert into people (name, occupation) values (?, ?);");
prep.setString(1, "Gandhi");
prep.setString(2, "politics");
prep.addBatch();
prep.setString(1, "Turing");
prep.setString(2, "computers");
prep.addBatch();
prep.setString(1, "Wittgenstein");
prep.setString(2, "smartypants");
prep.addBatch();
conn.setAutoCommit(false);
prep.executeBatch();
conn.setAutoCommit(true);
ResultSet rs = stat.executeQuery("select * from people;");
while (rs.next()) {
System.out.println("name = " + rs.getString("name"));
System.out.println("job = " + rs.getString("occupation"));
}
rs.close();
stat.execute("SHUTDOWN");
conn.close();
}
}
to run this well in with java, you have to download HSQLDB 1.7.2.11 http://downloads.sourceforge.net/hsqldb/hsqldb_1_7_2_11.zip?modtime=1103945242&big_mirror=0
if you have downloaded the file, you need to extract them, and at lib folders, you can find servlet.jar and hsqldb.jar , put it in your jre/lib/ext folder
the code above run with no problem with JVM and Excelsior JET
but it has so many runtime problem with gcj, and yes i know this is because i am very new with gcj so yeah i will be learning a lot from this mailing list =))
here is what i type to compile this code using gcj , if i am wrong please let me know (just in case if i have made any syntax error)
(I put servlet.jar , hsqldb.jar and Test_HSQLDB.java in gcc-4.3\bin folder , because i dont know any better way xD , please englighten me if there are any better way of doing this)
D:\gcc-4.3\bin>gcj -fjni -O2 -c servlet.jar hsqldb.jar Test_HSQLDB.java -o Test_HSQLDB.o
D:\gcc-4.3\bin>gcj --main=Test_HSQLDB -o Test_HSQLDB Test_HSQLDB.o
it generate a file named Test_HSQLDB.exe , and no error
BUT
runtime error occured when we run Test_HSQLDB.exe
Exception in thread "main" java.sql.SQLException: Software module not installed
at org.hsqldb.jdbc.jdbcUtil.sqlException(C:/DOCUME~1/userr/LOCALS~1/Temp/cc2Naaaa.i:0)
at org.hsqldb.jdbc.jdbcConnection.<init>(C:/DOCUME~1/userr/LOCALS~1/Temp/cc2Naaaa.i:0)
at org.hsqldb.jdbcDriver.getConnection(C:/DOCUME~1/userr/LOCALS~1/Temp/cc2Naaaa.i:0)
at java.sql.DriverManager.getConnection(/datal/gcc/gcc/libjava/classpath/java/sql/DriverManager.java:166)
at java.sql.DriverManager.getConnection(/datal/gcc/gcc/libjava/classpath/java/sql/DriverManager.java:205)
at Test_HSQLDB.main(C:/DOCUME~1/userr/LOCALS~1/Temp/cc2Naaaa.i:0)
i have tried googling "Software Module Not Installed" , or "HSQLDB GCJ" , but i didnt find any good answer
i know i have done some silly mistake , perhaps somewhere around the command i used for compiling... but i dont know what T.T (and i dont have enough money to implement my project using JET Excelsior) T.T
oh btw, this is my first post , please be nice xD
Thanks a lot
Cheers and God Bless,
Chowi