Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
  HXTT DBF v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  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 DBF
Is it possible to set default values?
Tobi
2009-07-29 05:45:02.0
Hi everybody,

I use your HXTT-DBF-Driver. Sometimes I add a new column to an existing table. Is it possible to fill this column with default values? (boolean=false, integer=0, double=0.0, and so on)

It's the same problem, if I make a database-insert and don't fill every column(look at my example below)

In your documentation http://www.hxtt.com/dbf/sqlsyntax.html#createtable I found this:
-------------------
The HXTT DBF will ignore DEFAULT expression
-------------------
I suspect, that's why it doesn't work yet?

Here is my example

-------------------------------------------
package mainKlassen;

import java.sql.*;

public class MinimalClass {
public static void main(String[] args) {
String sTableName = "tab";
String connectionUrl;
Connection con;
Statement stmt;
String sSQL;

connectionUrl = "jdbc:dbf:/c:/dbf?versionNumber=03";
try {
Class.forName("com.hxtt.sql.dbf.DBFDriver");
con = DriverManager.getConnection(connectionUrl);
stmt = con.createStatement();

sSQL = "DROP TABLE IF EXISTS " + sTableName;
stmt.executeUpdate(sSQL);

sSQL = "CREATE TABLE " + sTableName + " (int1 NUMERIC(5), int2 NUMERIC(5))";
stmt.executeUpdate(sSQL);

sSQL = "INSERT INTO " + sTableName + " (int1) values (2)";
stmt.executeUpdate(sSQL);

sSQL = "ALTER TABLE " + sTableName + " add int3 NUMERIC(5) DEFAULT 3";
stmt.executeUpdate(sSQL);

stmt.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
------------------------------------

Greetings from Germany
Re:Is it possible to set default values?
HXTT Support
2009-07-29 07:56:40.0
>I suspect, that's why it doesn't work yet?
Because Xbase compatible format will use null/empty value as default value.

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