Problem with mass Data (13000 Entries)
Hi,
i am a (german) PHP,MySQL,Ajax Programmer and now i wanna learn Java. It works well, for my first 4 Days.
http://tcg-zone.de/MyCards2.gif
But there is one Problem. I wanna code an Deck Editor for Trading Card Games and i have to save the Cards on the Computer. But how? I thought about creating TextFiles, but with 13000 Entries? It is not good, when the Program need more than a few seconds for initialization.
So i thought about Databases in Java. But i read something about install the driver and so on, but i dont want that my users have to install a db and then install the application.
Is there anyway without an extra installation?
I hope there is anyway with MySQL, because i wanna make an Card Search Engine for the Editor and thats too strange with Textfiles.
Sorry for my bad english, but i wouldn't post here, if i dont have to.
You are my last hope ^^
see ya
Message was edited by:
KOku
[978 byte] By [
KOkua] at [2007-11-27 3:49:32]

> So i thought about Databases in Java. But i read
> something about install the driver and so on, but i
> dont want that my users have to install a db and then
> install the application.
They don't have to. Either with DNSless JDBC-ODBC or, better, a DB like HSQLDB that runs in your program's JVM.
> hmm. i have to install the driver to use the db and
> my users can download the application and run it
> without install a driver?
Huh? Just give your user a bunch of JARs - your app and the DB. Or you can use a DNSless JDBC-ODBC connection to the file directly, without needing to set it up first. Might be easiest for you as you're not doing any operations on the file, so the crappiness of that JDBC_ODBC brigde shouldn't bother you much.
http://forum.java.sun.com/thread.jspa?threadID=454316
> Is HSQLDB good?
Should be sufficient for your purposes.
> I am a newbie to java, so i dont know
> so much about it and the tools. But i dont have the
> time to read the tutorials for java because i just
> wanna code one application and i never need all the
> tools.
Then you're hosed either way. You at least need to know how to use JDBC.
One thing though: it will make no real difference if your program reads 13000 entries or the DB reads 13000 entries. So you might not gain any performance after all. Depending on your data, it might be easiest just to construct a data model from the file in memory and operate on that.
Ok, i need help.
I use HSQLDB and it works, but after restarting the app:
Exception in thread "main" java.sql.SQLException: The database is already in use by another process
at org.hsqldb.Trace.getError(Unknown Source)
at org.hsqldb.Trace.error(Unknown Source)
at org.hsqldb.Log.open(Unknown Source)
at org.hsqldb.Database$Logger.openLog(Unknown Source)
at org.hsqldb.Database.open(Unknown Source)
at org.hsqldb.Database.<init>(Unknown Source)
at org.hsqldb.jdbcConnection.openStandalone(Unknown Source)
at org.hsqldb.jdbcConnection.<init>(Unknown Source)
at org.hsqldb.jdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Database.<init>(Database.java:27)
at MyCards.main(MyCards.java:20)
i am using eclipse.
My Database Class:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/**
*
*/
public class Database {
public Connection con = null;
public Statement stmt = null;
public ResultSet rs = null;
/**
*
*/
public Database()
throws SQLException, ClassNotFoundException {
try {
Class.forName("org.hsqldb.jdbcDriver");
}
catch(Exception e) {}
this.con = DriverManager.getConnection("jdbc:hsqldb:cards", "sa", "");
this.stmt = this.con.createStatement();
}
/**
*
*/
public ResultSet query(String sql) throws SQLException {
ResultSet result = this.stmt.executeQuery(sql);
return result;
}
/**
*
*/
public void close() throws SQLException {
if(!this.con.isClosed()) {
this.con.close();
}
}
}
Database DB = new Database();
DB.rs = DB.query("INSERT INTO ...");
DB.close();
But where is the Problem?
KOkua at 2007-7-12 8:53:25 >
