Ask Your Question
1

How to read .odb file in java using JDBC?

asked 2013-09-18 11:24:51 +0100

ergalaxy81@gmail.com gravatar image

updated 2015-09-06 14:16:14 +0100

Alex Kemp gravatar image

For .mdb files we use the following code

import java.sql.*;

class Odbctest1 { public static void main(String args[]) { try { Class.forName("sun.jdbc.odbc.jdbcodbcDriver"); Connection con; con=DriverManager.getConnection("jdbc:odbc:myDB","","");
Statement s=con.createStatement(); ResultSet rs; System.out.println("hai....\n"); String q="select * from \"Table1\""; rs=s.executeQuery(q); System.out.println("rollno\t\tname\t\tdept\t\tyear\t\taddress"); System.out.println("-----\t\t----\t\t----\t\t-----\t\t------"); while(rs.next()) { System.out.print(rs.getString(1)+"\t\t"); System.out.print(rs.getString(2)+"\t\t"); System.out.print(rs.getString(3)+"\t\t"); System.out.print(rs.getString(4)+"\t\t"); System.out.println(rs.getString(5)+"\t\t"); } } catch(Exception e) { System.out.println("Error"+e); } }

For .odb files we are not able to find any code for the same.

edit retag flag offensive close merge delete

Comments

That might be because there is no code avaiable that I know of.

Alex Thurgood gravatar imageAlex Thurgood ( 2014-08-10 19:35:44 +0100 )edit

Is this similar to this question? https://ask.libreoffice.org/en/questi...

EasyTrieve gravatar imageEasyTrieve ( 2016-10-08 05:04:16 +0100 )edit

2 Answers

Sort by » oldest newest most voted
0

answered 2015-11-17 18:56:09 +0100

jon gravatar image

It is not working for me unfortunately, I would like to read a database created using LibreOffice base and create create-read-update-delete scripts and such.

edit flag offensive delete link more
1

answered 2014-12-14 20:03:06 +0100

Alex Thurgood gravatar image

updated 2014-12-14 20:06:50 +0100

Not possible, to my knowledge. An ODB file is a zipped container containing hsqldb script, info, properties, and data files, along with the data itself in binary format. Your code would have to load all of that or connect all of that, to a running instance of hsqldb. In LO, when and ODB file is loaded, an included hsqldb.jar is instantiated in LO process memory - this is what allows the data to be loaded, along with any forms, reports, queries, etc, which are stored in separate folders of the ODB file and defined mainly by XML resources. So, if you can do all that, then you might be able to find a solution.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-09-18 11:24:51 +0100

Seen: 1,508 times

Last updated: Nov 17 '15