Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Cobol v2.1
  HXTT DBF v5.2
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT ACCESS
Emergency Bug report
Barmak
2007-06-06 03:31:18.0
Hi,

Bug#1:
1- I created a new database and a new table in there
2- Just after step 1, I tried to insert some records in the table, but it was not successful. But when I executed the program again where the database was already created at the first time, it was successful.
So, the problem is that, the driver is not capable to do both jobs consecutively.
Note: I uses Java 5.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

import junit.framework.TestCase;

/**
* @author barmak
*
*/
public class MSAccessTest extends TestCase {
private static String CATALOG_PATH = "c:/temp/testaccess";
private static String DATABASE_NAME = "Database1";
private static String TABLE_NAME = "Table1";
private Connection connection;
public MSAccessTest(String name) {
super(name);
}

/**
* @throws java.lang.Exception
*/
protected void setUp() throws Exception {
String lUrl = "jdbc:access:///"+CATALOG_PATH;
Properties prop=new Properties();
prop.setProperty("versionNumber","JET4");//default
prop.setProperty("charSet","Cp1252");//correct
DriverManager.registerDriver(new com.hxtt.sql.access.AccessDriver());
connection = DriverManager.getConnection(lUrl, prop);
}

/**
* @throws java.lang.Exception
*/
protected void tearDown() throws Exception {
}
public void test1() throws Exception{
//1 create database
Statement statement = connection.createStatement();
statement.execute("create database if not exists "+DATABASE_NAME+"");
statement.execute("create table if not exists "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha varchar(25))");
statement.executeUpdate("insert into "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha) values('Hello1')");
statement.executeUpdate("insert into "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha) values('Hello2')");
statement.close();
connection.close();
}
}



Question #1: Is it possible to create a Catalog in zip form from java.

Best regards, Barmak Heidarasadi
Temporary Workaround :Emergency Bug report
Barmak
2007-06-06 04:23:00.0
A for now workaround:
When 2 tables are created, it works fine:

Statement statement = connection.createStatement();
statement.execute("create database if not exists "+DATABASE_NAME+"");
statement.execute("create table "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha varchar(25))");
statement.execute("create table if not exists "+DATABASE_NAME+"."+"BUG_WORKAROUND_TABLE"+"(TAlpha varchar(25))");
statement.executeUpdate("insert into "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha) values('Hello1')");
statement.executeUpdate("insert into "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha) values('Hello2')");
statement.executeUpdate("insert into "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha) values('Hello3')");
statement.executeUpdate("insert into "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha) values('Hello4')");
statement.execute("drop table "+DATABASE_NAME+"."+"BUG_WORKAROUND_TABLE");
Re:Re:Emergency Bug report
HXTT Support
2007-06-06 05:35:52.0
>statement.execute("create database if not exists "+DATABASE_NAME+"");
>statement.execute("create table if not exists "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha varchar(25))");
>statement.executeUpdate("insert into "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha) values('Hello1')");
>statement.executeUpdate("insert into "+DATABASE_NAME+"."+TABLE_NAME+"(TAlpha) values('Hello2')");
Failied to recur your issue. What's your exception message?

The simplest solution:
statement.execute("create database if not exists "+DATABASE_NAME+"");
con.setCatalog(DATABASE_NAME+".mdb");
statement.execute("create table if not exists "+TABLE_NAME+"(TAlpha varchar(25))");
...

Re:Re:Re:Emergency Bug report
Barmak
2007-06-06 05:40:40.0
There is no exception at all, it just does not write the records into the table.
It creates database and tables successfully, but cannot write into the table as the next step (without reporting any exception).
Anyway I managed to find a workaround, (I already posted it), may be a clue for you.
Re:Re:Re:Re:Emergency Bug report
HXTT Support
2007-06-06 07:16:16.0
Recurred and fixed. Thanks. We will release the latest package in 24 hours.

Search Key   Search by Last 50 Questions




Google
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap