|
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)
HXTT ACCESS
|
java.lang.OutOfMemoryError for Access |
weng chi wang |
2009-10-01 19:02:28 |
Hello:
I am currently using to buy your company's HXTT ACCESS (V 3.2.065) Enterprise License
Platform for Linux Red Hat 9.0 + AP WebSphere 3.5.7 + IBM jdk 1.3
I ran into a problem when every time I Access a mdb, the memory will gradually increase in
Soon there will be java.lang.OutOfMemoryError error, thus will not be able to use your company's
ACCESS element, until the re-opened in order to continue to use WebSphere.
I'm sure my program would be connected each Jieyou closed. And I test platform in the machine
Window + resin 2.1 + sun JDK 1.4 to run the program and not the above problem.
I tested the library version of the total
1.Access_JDBC30.jar
2.Access_JDBC20.jar
3.Access_JDBC12.jar
All be so, can give me some suggestions ...
Attached the error log.
THX
==========================
Acer Inc.
WANG Wen-qi Department of Justice Application Integration
(02) 2784-1000 # 2068
wengchi@gmail.com
==========================
|
Re:java.lang.OutOfMemoryError for Access |
HXTT Support |
2009-10-01 19:35:18 |
Your email was replied yesterday:
It won't increass any more when it reach a sutiable cache size. You should adjust your websphere memory setting. You can find initialHeapSize="1024" maximumHeapSize="2048" in your server.xml .
Because resin need small memroy. JDK1.4 supports full JDBC3.0 package, but JDK1.3 supports partly JDBC3.0 standard. What's your jdbc url sample?
BTW, the latest version is V3.2.094 now.
|
Re:Re:java.lang.OutOfMemoryError for Access |
weng chi wang |
2009-10-01 21:07:49 |
Maybe you have misunderstood my meaning, and I do not once occur outOufMemoError, but every implementation of the time (JSP square test) to read mdb, memory will be
Add some may occur after the use of dozens of the problem. (Seems to be out of memory not released ..)
You said initialHeapSize = "1024" and maximumHeapSize = "2048" will only delay the occurrence of the problem can not really solve the problem: S
Function Description:
This feature will be the first to copy an empty. Mdb file to a randomly generated directory, and then against that. Mdb file from Oracle to write data to. Mdb file in.
Here I will HTXX Access and then wrap the use of components Souce, please refer to the:
package com.sertek.db;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import java.util.Vector;
import com.hxtt.sql.access.AccessDriver;
import com.sertek.util.CheckObject;
import com.sertek.util.utility;
/**
* JAccessUtility au = new JAccessUtility("c://temp2//test.mdb");
*
* String sql = "";
* au.openConnection();
*
* sql = "INSERT INTO Q04 (NAME,AGE) values ('wang',30)";
* au.doSqlUpdate(sql);
* Vector vt = new Vector();
* int field =2;
* sql = "select name,age from Q04";
* vt = au.doSqlSelect(sql,field,false);
* for(int i=0;i* out.println(i +"." + vt.get(i*field) + " " + vt.get(i*field+1) + " ");
* }
*
* au.closeConnection();
* @author Administrator
*
*/
public class JAccessUtility {
private String os = "linux";
private String o_url = "";
private String url = "";
private String userid = "";
private String password = "";
private Connection conn ;
private Statement stmt;
private String dbCharset = System.getProperty("file.encoding");
private String FileSeperator = System.getProperty("file.separator");
private boolean isDel = false;
private DBUtility db;
//private DBFUtility dbf;
private CheckObject check = new CheckObject();
public JAccessUtility(String url,String userid,String password){
this.o_url = url;
this.url = url.replace('\\','/');
this.userid = userid;
this.password = password;
//makeDir(url);
}
public JAccessUtility(String url,DBUtility db){
this.o_url = url;
this.isDel = isDel;
this.db = db;
this.url = url.replace('\\','/');
//makeDir(url);
}
public JAccessUtility(String url){
this.o_url = url;
this.url = url.replace('\\','/');
//makeDir(url);
}
public boolean openConnection(){
return getDdfConnection();
}
public void setCharset(String charset){
this.dbCharset = charset;
}
public void closeConnection(){
try{
stmt.close();
conn.close();
stmt = null;
conn = null;
System.out.println("JAccessUtility closeConnection");
}catch(SQLException e){
System.out.println(e.getMessage());
e.printStackTrace();
}
}
public void setAutoCommit(boolean b) throws SQLException{
conn.setAutoCommit(b);
}
public Connection getConnection(){
return conn;
}
private boolean getDdfConnection(){
boolean retVal = true;
try{
os = checkOS();
//Class.forName("com.hxtt.sql.access.AccessDriver");
Class.forName("com.hxtt.sql.access.AccessDriver").newInstance();
//DriverManager.registerDriver(new AccessDriver());
if (os.equals("linux"))
url = "jdbc:Access:///"+url;
else
url = "jdbc:Access:/"+url;
System.out.println(url);
//Properties properties=new Properties();
//properties.setProperty("user",userid);
//properties.setProperty("password",password);
//properties.setProperty("charSet","MS950");
//conn = DriverManager.getConnection(url, userid,password);
//conn = DriverManager.getConnection(url,properties);
//conn = DriverManager.getConnection(url);
Properties properties=new Properties();
properties.setProperty("lockTimeout","-1");
properties.setProperty("delayedClose","1");
properties.setProperty("maxIdleTime","0");
properties.setProperty("maxCacheSize","0");
//
conn = DriverManager.getConnection(url, properties);
stmt = conn.createStatement();
//stmt.setFetchSize(100);
}catch(Exception e){
retVal = false;
e.printStackTrace();
}
return retVal;
}
private String checkOS(){
String retVal = "linux";
String enc = System.getProperty("file.separator");
if (enc.equals("\\"))
retVal = "win";
return retVal;
}
public boolean isClosed() throws SQLException{
boolean retVal = true;
if (conn!=null){
retVal = conn.isClosed();
}
return retVal;
}
public synchronized int doSqlUpdate(String sql) {
int retVal = 0;
try{
sql = new String( sql.getBytes() , dbCharset );
retVal = stmt.executeUpdate(sql);
}catch(SQLException sqlexception){
System.out.println("SQLException:");
while(sqlexception != null){
System.out.println("SQLState: " + sqlexception.getSQLState());
System.out.println("Message: " + sqlexception.getMessage());
System.out.println("Vendor: " + sqlexception.getErrorCode());
sqlexception = sqlexception.getNextException();
System.out.println("");
retVal = -1;
}
}catch(Exception exception){
System.out.println("Exception: " + exception);
exception.printStackTrace();
retVal = -1;
}
return retVal;
}
/**
* @param sql sql�Z��
* @return ResultSet
*/
public ResultSet doSqlSelect(String sql) throws SQLException{
return stmt.executeQuery(sql);
}
public Vector doSqlSelect(String sql,int i,boolean ff){
Vector temp = new Vector();
ResultSet temp1;
String strTmp = "";
try{
temp1 = doSqlSelect(sql);
while (temp1.next()){
for (int k=1;k<=i;k++){
strTmp = (String)check.checkNull(temp1.getString(k),"");
temp.addElement(strTmp);
}
}
temp1.close();
}catch(SQLException sqlexception){
System.out.println("SQLException:");
while(sqlexception != null){
System.out.println("SQLState: " + sqlexception.getSQLState());
System.out.println("Message: " + sqlexception.getMessage());
System.out.println("Vendor: " + sqlexception.getErrorCode());
sqlexception = sqlexception.getNextException();
System.out.println("");
}
}catch(Exception exception){
System.out.println("Exception: " + exception);
exception.printStackTrace();
}
return temp;
}
/**
* rollback
*/
public void rollback() throws SQLException
{
conn.rollback();
}
/**
* commit
*/
public void commit() throws SQLException
{
conn.commit();
}
/**************************************************************/
}
|
Re:Re:Re:java.lang.OutOfMemoryError for Access |
HXTT Support |
2009-10-02 08:00:05 |
Checked.
>Maybe you have misunderstood my meaning, and I do not once occur outOufMemoError,
>but every implementation of the time (JSP square test) to read mdb, memory will be
If you haven't meet OutOfMemoryError, you needn't worry. HXTT Access use cache for IO, query match, index, and so on. When it increase to a limitation, it will decrease too.
BTW, you can create independent statments objects in your query/update method, which needn't synchronized your method. In your JAccessUtility class, you need only to maintain a conn object.
|
Re:Re:Re:Re:java.lang.OutOfMemoryError for Access |
WANG Wen-qi |
2009-10-02 19:52:05 |
Thank you for appropriate advice ~
I have already removed the synchronized.
OutOfMemoryError true that I have encountered an error, so I will raise this issue ~
In addition there Qingdiao HXTT Access cache IO instructions, because my program is for each
Will randomly generate a set of different directories empty mdb file, when you are finished using the mdb file later, that
Will no longer use the mdb file. So, for me cache is pointless.
I have tested the direct delete of mdb file, the memory will be released immediately off, which is what you say IO cache,
In addition to directly delete the mdb file is just outside, is there a way to release off the normal memory? (Parameter maxCacheSize set to 0, the problem did not solve the Cache)
Thank you once again to me appropriate advice
Note:
Mdb file I have only brought as a medium of exchange of information, not directly use it as a database to use. cache index, IO, for me, that did not use
|
Re:Re:Re:Re:Re:java.lang.OutOfMemoryError for Access |
HXTT Support |
2009-10-03 03:13:18 |
>Will randomly generate a set of different directories empty mdb file,
>when you are finished using the mdb file later, that Will no longer
>use the mdb file.
Try delayedClose=0 connection property. Then it will release the cache for each mdb file at once.
|
|
|