Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access 7.1.252
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Cobol 5.0.251
  HXTT DBF 7.1.252
  HXTT Excel 6.1.255
  HXTT Json 1.0.223
  HXTT Paradox 7.1.251
  HXTT PDF 2.0.251
  HXTT Text(CSV) 7.1.251
  HXTT Word 1.1.251
  HXTT XML 4.0.252
Offshore Outsourcing
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
   
   
   
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)

HXTT ACCESS
Emergency Bug report
Barmak
2007-06-06 03:31:18
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
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
>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
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
Recurred and fixed. Thanks. We will release the latest package in 24 hours.

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap