Giter Club home page Giter Club logo

dbf-jdbc-driver's Introduction

DBF-xBase-FoxPro JDBC Driver

The DBF-xBase-FoxPro JDBC driver is provided by DbSchema DBF Designer

Features

  • Connect to DBF files
  • Execute SELECT with JOINS, WHERE, GROUP BY, ORDER BY queries
  • INSERT, UPDATE, DELETE data
  • Create new tables, add or remove columns, etc.

License

CC-BY-ND - Attribution-NoDerivs. The driver is free to use for everyone. Code modifications allowed only to the current repository as pull requests under https://github.com/wise-coders/dbf-jdbc-driver

JDBC URL

jdbc:dbschema:dbf:?[charset=ISO_8859_1]

Connection con = DriverManager.getConnection( "jdbc:dbschema:dbf:/sample_dbf_folder" );
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from cars")
while( rs.next() ){
    ....
}

Download the JDBC Driver

The driver can be downloaded from the DbSchema website.

How the Driver Works

The driver loads all DBF data into an H2 cache database stored in <user.home>/.DbSchema/dbf-jdbc-driver/ The data can be modified, any kind of queries can be executed. To save back data to dbf files use:

Statement st = connection.createStatement();
st.execute("save dbf to <folder_path>");

We save data to a different path, just to avoid any storage issues and don't loose any information.

To clear the caches and reload a file next time you connect, do

Statement st = connection.createStatement();
st.execute("reload <file_path>");

We appreciate any contributions to this repository.

How to Test the JDBC Driver

The driver can be tested by downloading and installing DbSchema DBF and FoxPro Designer. DbSchema can be evaluated 15 for free.

There is no need to register or download the driver - DbSchema will do everything for you.

DBF xBase Connection Dialog

After connecting DbSchema will reverse engineer the database structure and show it as diagrams.

DBF Database Diagrams using DbSchema

Use the Query Editor to execute queries with JOINS, GROUP BY and ORDER BY.

xBase DBF Query Editor

Use the Relational Data Browse to explore data from multiple tables simultaneously. DbSchema can create virtual foreign keys which will be used in the Data Browse.

xBase DBF Query Editor

dbf-jdbc-driver's People

Contributors

jeremyross avatar matteobaccan avatar wise-coders avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dbf-jdbc-driver's Issues

Are memo fields supported?

When I connect to a dbf+fpt file, I see that large varchar columns are created for the memo field, but the data doesn't seem to be imported. All records have null for memo fields.

No support for writting TIMESTAMP

Hi,
I get this error when I try to save the database:

java.lang.IllegalArgumentException: No support for writting TIMESTAMP
at com.linuxense.javadbf.DBFField.setType(DBFField.java:431)
at com.wisecoders.dbschema.dbf.schema.Table.createDBFField(Table.java:48)
at com.wisecoders.dbschema.dbf.io.H2Writer.(H2Writer.java:38)
at com.wisecoders.dbschema.dbf.H2Connection.saveDbf(H2Connection.java:154)
at com.wisecoders.dbschema.dbf.H2Connection.access$100(H2Connection.java:38)
at com.wisecoders.dbschema.dbf.H2Connection$StatementProxy.invoke(H2Connection.java:90)
at jdk.proxy3/jdk.proxy3.$Proxy137.execute(Unknown Source)

I thought that it was a problem with the insert clauses I made, but it occurs although saving without updating the database.

How should DBF tables be refreshed?

I'm wanting to simply query a DBF database for new information, but it seems that the tables are not updated (within the same application).

* When you open a connection, we store transfer all DBF data to a local H2 database in user.home/.DbSchema/ .
probably should be "When you open a connection for the first time in a JVM..." (see line 98).

It would be nice to be able to invoke

if ( !DBFtoH2.isFileTransferred( file, h2Connection )){
DBFtoH2.transfer( table, reader, h2Connection );
DBFtoH2.saveFileTransferredInfo( file, h2Connection );
}
for a specific table/file at will.

java.nio.file.NoSuchFileException

Hi,
in the JDBC constructor, the library tries to open the log file, but the \.DbSchema\logs path does not exist.

java.nio.file.NoSuchFileException: C:\Users\<User>\.DbSchema\logs\DbfJdbcDriver.log.lck
 	at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
 	at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
 	at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
 	at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(Unknown Source)
 	at java.nio.channels.FileChannel.open(Unknown Source)
 	at java.nio.channels.FileChannel.open(Unknown Source)
 	at java.util.logging.FileHandler.openFiles(Unknown Source)
 	at java.util.logging.FileHandler.<init>(Unknown Source)
 	at com.wisecoders.dbschema.dbf.JdbcDriver.<clinit>(JdbcDriver.java:44)

Is it even right to create own log if the application using this library has own log?

Library Update has broken tests

Since a13fccd, the tests have failed with errors like

java.sql.SQLException: Precision ("2147483647") must be between "1" and "1048576" inclusive; SQL statement:
create table "cars"(
	"NAME" char(15),
	"YEAR" decimal(4,0),
	"SEDAN" boolean,
	"PROD_DATE" date,
	"CC" decimal(10,3),
	"DESCR" longvarchar(2147483647)) [90150-210]

New release

Is there a release scheduled? I think having a release that includes #10 would be useful.

Unsupported connection setting "DATABASE_TO_LOWER"

When I start the symmetricds application, this error occurs, is there anything I can do?

AbstractSymmetricEngine - Initializing connection to database
Jan 07, 2024 8:32:25 PM com.wisecoders.dbschema.dbf.JdbcDriver getConnection

INFO: Create H2 database 'jdbc:h2:file:~/.DbSchema/jdbc-dbf-cache/4fcaccd23defd13fb448def2adb30e38;database_to_lower=true;case_insensitive_identifiers=true'

JdbcDriver - Create H2 database 'jdbc:h2:file:~/.DbSchema/jdbc-dbf-cache/4fcaccd23defd13fb448def2adb30e38;database_to_lower=true;case_insensitive_identifiers=true'

Could not get a connection to the database: Cannot create PoolableConnectionFactory (Unsupported connection setting "DATABASE_TO_LOWER" [90113-176]).
Waiting for 10 seconds before trying to connect to the database again.

Reload fails: Column "file_name" not found

When attempting the reload command, I get:

Column "file_name" not found
DELETE FROM dbs_meta_files WHERE file_name=?

f96f0b3 change the expected column name from file_path to file_name. But the column is still file_path.

java.nio.file.NoSuchFileException

##When I connect to dbf I am getting this error. But if I do a select like the following example, apparently it's working. Why this error?

java.nio.file.NoSuchFileException: C:\Users\Success.DbSchema\logs\DbfJdbcDriver.log.lck
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:120)
at java.base/java.nio.channels.FileChannel.open(FileChannel.java:292)
at java.base/java.nio.channels.FileChannel.open(FileChannel.java:345)
at java.logging/java.util.logging.FileHandler.openFiles(FileHandler.java:512)
at java.logging/java.util.logging.FileHandler.(FileHandler.java:308)
at com.wisecoders.dbschema.dbf.JdbcDriver.(JdbcDriver.java:44)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:780)
at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:722)
at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1395)
at java.sql/java.sql.DriverManager$2.run(DriverManager.java:614)
at java.sql/java.sql.DriverManager$2.run(DriverManager.java:594)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.sql/java.sql.DriverManager.ensureDriversInitialized(DriverManager.java:594)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:665)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)
at javateste.Main.main(Main.java:14)
jul 06, 2022 10:20:00 AM com.wisecoders.dbschema.dbf.JdbcDriver getConnection
INFORMAÇÕES: Create H2 database 'jdbc:h2:file:~/.DbSchema/jdbc-dbf-cache/97c587a242cdcd1420a820f0af14f5df;database_to_lower=true;case_insensitive_identifiers=true'
erro

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.