|
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)
HXTT Excel
|
close() problem + save problem +Excel executeUpdate (save) problem. |
Rafael Gandia-Castello |
2007-07-05 02:54:46 |
Hi.
I've been in trouble first with .close() command. I forgot to close() several ResultSet objects I created in my first (and very quick) implementation, and my Connection objects and Statement objects failed on close() command. I solved it when I close the ResultSet objects. The problem is that the exception thrown by the other objects on close, is not very helpful (it says something like the object has been closed before).
Other problem:
hard = DriverManager.getConnection(urlHard,prop);
Statement stm = hard.createStatement();
stm.execute("DROP TABLE IF EXISTS TradOUT.Textos");
stm.execute("create database if not exists TradOUT");
stm.execute("CREATE TABLE TradOUT.Textos (Descripcion_"+Idi_Orig+" VARCHAR(128), Descripcion_"+Idi_Dest+" VARCHAR(128), Ayuda_"+Idi_Orig+" VARCHAR(128), Ayuda_"+Idi_Dest+" VARCHAR(128))");
stm.executeUpdate("insert into TradOUT.Textos values('Hello1','H','H','H')");
stm.close();
Well, if you do not insert some values ('Hello1',...), wen open the TradOUT excel, you find that the TradOUT.Textos was not created!! (no exception was received)
And the last one:
I have MyStatement.execute commands for update in one existing database. My program works fine with Sun JDBC-ODBC driver and I changed to HXTT to get better charset support (and I had). The problem is, this time, that the changes seem NOT to be SAVED, or not always, with the same program and start conditions (I think). All this start to work when executeUpdate() is used instead of execute().
Best regards,
Rafael Gandia-Castello
|
Re:close() problem + save problem +Excel executeUpdate (save) problem. |
HXTT Support |
2007-07-05 06:18:37 |
>The problem is that the exception thrown by the other objects on close, is not
> very helpful (it says something like the object has been closed before).
Maybe you closed statement or connection, then call ResultSet.close. Because Statemen.close and Connection.close will call all their created ResultSet.close().
>Well, if you do not insert some values ('Hello1',...), wen open the TradOUT excel,
>you find that the TradOUT.Textos was not created!! (no exception was received)
Passed test in my test. Maybe your connection or statment is still open, then that TradOUT.xls hasn't been updated utill that database is released. If you will all data is writed at once when that dabase is closed. You can use delayedClose=0 connection property.
delayedClose: Indicates the delayed seconds for close transaction. That option is used to avoid frequent close/open table operations for following sqls. You can use 0~120 seconds. Default: 3. null
>that the changes seem NOT to be SAVED, or not always, with the same program and
> start conditions
It will be saved when there's no opening table on database. First, try to use delayedClose=0. Secondly, if you're using TradOUT.xls in your jdbc url, that TradOUT.xls will be open until that connection is closed.
|
Re:Re:close() problem + save problem +Excel executeUpdate (save) problem. |
Rafael Gandia-Castello |
2007-07-05 08:22:05 |
You are right,
delayedClose=0 is the diference between work and dont, when I remove the insert SQL statement. Now it works fine. The speed decrease (foreseeable), but its not critical for me.
In the other hand, my first problem is diferent. I think its due to several open ResultSet objects (about 500 perhaps) without close :) . I'm sure that my Connection objects and Statement objects, have not been closed by me before (mine is a small-one-and-no-optimized application). I reach an exception if I try to open more ResulSet-s by adding more excel sheets to de data transfer. If you are interested, I can post the full (and dirty) code here. Anyway, I work fine by close() the ResulSet objects each time i finish to use them.
I use actually: Debian unstable with Java ...
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
Thanks for your quick answer
Best regards,
Rafael Gandia-Castello
|
Re:Re:Re:close() problem + save problem +Excel executeUpdate (save) problem. |
HXTT Support |
2007-07-05 08:25:49 |
>I reach an exception if I try to open more ResulSet-s by adding more excel sheets
> to de data transfer. If you are interested, I can post the full (and dirty) code
> here. Anyway, I work fine by close() the ResulSet objects each time i finish to
> use them.
You can send webmaster@hxtt.com it so that we cna recur your issue.
|
|
|