jackcess

Using Jackcess with JCIFS to manipulate an Access database on an SMB share

时光怂恿深爱的人放手 提交于 2020-01-02 12:10:12
问题 I need to work with an MS Access file in Java using Jackcess. The file is located on an SMB share so I assume I would have to use JCIFS. I tried this String testdirectory = "smb://" + "file location"; SmbFile testsmbdir = null; try{ testsmbdir = new SmbFile(testdirectory,auth); }catch(Exception e){ e.printStackTrace(); } SmbFileInputStream smbFilestream = new SmbFileInputStream(testsmbdir); db = DatabaseBuilder.open(testsmbdir); However, it says SMBFile can not be converted to File for the db

Access (.mdb) file corrupted during servlet write to the client

一笑奈何 提交于 2019-12-24 06:38:55
问题 This was originally a part 2 of a different thread, but another use suggested that I separate the part 2 into it's own topic, so here we go. Original thread is here (Original Thread) I am using Jackcess to create a V2010 mdb file that I need to transfer to a client that will use Access 2013 to open it. Jackcess itself works - V2010 creates a file that Access 2013 can open when the file is FTP'd to the client by a third party software, such as FAR. However, when I try to upload this file to

Jackcess Numberformatexception

蓝咒 提交于 2019-12-20 05:53:18
问题 I'm trying to create a program which takes input from a CSV-file and writes it to a Java-created Access database and table. The program uses a while-loop to go through the CSV-file. The first line of the file is written perfectly to the database, but it crashes at the second line, while trying to write the same kind of input to the table. How can I solve this? Here's my code so far: public void GPXtoAccess() { try { Access = new Scanner(DummyCSV); Scanner = new Scanner(DummyCSV); while

Sort a table in Jackcess

纵饮孤独 提交于 2019-12-13 19:26:40
问题 I work with an MS-Access table in Java using Jackcess: Database mdb = Database.open(new File(myPath)); Table myTable = mdb.getTable("TableName"); Is there a way to get the table sorted/ordered by one or more column(s)? Couldn't find anything in the docs. Thanks for any hint. 回答1: If you iterate through the Table rows using a Cursor which is backed by an Index, you will get the rows ordered by the relevant Index. This is an example (using the 1.x API) which iterates the table based on the

Creating a new MS Access file in Java using Jackcess

南楼画角 提交于 2019-12-11 17:58:10
问题 I have referred selected answer to this question: Java: Create MSAccess Database File (.mdb 0r .accdb) using Java. I have MS Office 2010 in my machine. I am trying to create access database file (*.mdb / *.accdb). But, still the file is not getting created itself throwing following exception: Exception in thread "main" java.io.FileNotFoundException: given file does not exist: C:\Users\473886\Desktop\employeedb1.mdb at com.healthmarketscience.jackcess.impl.DatabaseImpl.open(DatabaseImpl.java

jackcess delete row and set autoincrement column

不打扰是莪最后的温柔 提交于 2019-12-11 10:43:53
问题 How delete row from table with help jackcess? I try so, but it's bad: Table ptabl = db.getTable("person"); int pcount = ptabl.getRowCount(); for (int i = 0; i < pcount; i++) { Map<String, Object> row2 = ptabl.getNextRow(); if (row2.get("id") == Integer.valueOf(1)) { ptabl.deleteCurrentRow(); } } How set column "id" attribute to autoincrement? Table newTable = new TableBuilder("diagnosis"). addColumn(new ColumnBuilder("id") .setSQLType(Types.INTEGER) .toColumn()) .addColumn(new ColumnBuilder(

Jackcess DatabaseBuilder.open fails

送分小仙女□ 提交于 2019-12-11 09:36:51
问题 I am using Jackcess API in my Eclipse plugin project. I added jackcess-2.1.0.jar file under resources/lib . I included the jar under my Binary build and in build.properties . I successfully make a connection using connection string but my DatabaseBuilder.open() call is not executing. My code is public void run() { try { File tempTarget = File.createTempFile("eap-mirror", "eap"); try { this.source = DriverManager.getConnection(EaDbStringParser.eaDbStringToJdbc(sourceString)); this.source

Will Jackcess work with MS Access 2013?

不问归期 提交于 2019-12-11 04:17:40
问题 I am writing a Java application that creates some data for the user and needs to generate an Access file that the user can then download and open with MS Access. The user has MS Access 2013. The only Java library I found online is Jackcess. However, in their documentation and in their API as well they only go up to V2010. Will the file generated with File Format V2010 be opened by Access 2013? Based on research so far - no. Are there any other solutions that will allow a Java program to

Convert byte[] with binary data to String

萝らか妹 提交于 2019-12-10 21:32:03
问题 I have data in binary format ( hex: 80 3b c8 87 0a 89 ) and I need to convert that into String in order to save binary data in MS Access db via Jackcess. I know, that I'm not suppose to use String in Java for binary data, however Access db is third party product and I have not control whatsoever. So I tried to convert binary data and save it, but unfortunately the result was unexpected. byte[] byteArray = new byte[] {0x80, 0x3b, 0xc8, 0x87, 0x0a 0x89}; System.out.println(String.format("%02X "

UCanAccess/Jackcess exception when calling executeUpdate disables my Logger output

送分小仙女□ 提交于 2019-12-10 13:57:55
问题 I am using UCanAccess for manipulating an Access database. When calling executeUpdate I get the exception: net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.2 Unexpected page type 1 (Db=db.accdb;Table=MyTable;Index=PrimaryKey) It only occurs when trying to update one specific row - I already know how to fix this in the Access DB. The problem is with the Logger, after this exception is thrown and I catch it, I log an info message and it is not shown, all of the next log messages are not