Open paradox / borland database as single file - java

my question is:
how to connect java tp paradox / borland database ".DB" single files?
Here's what I have:
So, it's Paradox 7 database files.
I'm trying drivers:
http://www.hxtt.com/paradox.html & https://code.google.com/archive/p/paradoxdriver/ as:
String url = "jdbc:paradox:/D:/BABAK/powerGold/SongTitle.DB";
Connection con = DriverManager.getConnection(url);
But both throws exceptions like:
D:/BABAK/powerGold/SongTitle.DB isn't a database directory path!
As you can see, it is trying to find some database folder, but I have only single files! Also, "jdbc:paradox:/D:/BABAK/powerGold" (path to all .DB files folder) didn't work as well.
So, anybody, please help me to figure out, how to open this type of DB in my Java app.

jdbc:paradox:D:/BABAK/powerGold is the correct syntax.
One of the open source Paradox drivers you mentioned is now on Github and has had more features added since a couple of years ago, so that may now work.
If it doesn't, can you post the full stack trace (using this library, not the HXTT one) so we can figure out exactly what's going on? I'm not the original author, but I have made several contributions for different field types.

you're not trying to open the database doing so but a specific file of the whole DB. In fact your DB is composed of files .db, .px ....
The best approach to do so, is to migrate since this DB is not supported, and realy brings a lot of bugs.
I will recommand you to use migrate your database.
install Paradox Database Reader or Editor
export tables to CSV files
import tables in mysql Database (for example)
If you still want to connect this DB without migration with java, share in private a file .db and will give a try now.

To solve it do the following:
String url = "jdbc:paradox:/D:/BABAK/powerGold/";
keep the same files .db and .px of SongTitle in the same directory then run your code and it will work

Related

How to access database from derby in the same directory as jar?

I have developed a movie organizer program in Java with derby database. It works fine on my computer, however I couldn't figure out how to make it "portable" (only for my own use).
My problem is, that if I use the
String url = "jdbc:derby://localhost/Movie";
code for the connection to the derby database, it is only working on my computer as it is the path specified directly to my Netbeans database location. I would like to put the Movie folder near the .jar file of the application and make it portable so I can use the same database everywhere.
Any help would be appreciated on how could I achieve this.
You can access the database from the filesystem for example like this:
jdbc:derby:./myDatabaseName

Accessing Connected Database DB in Eclipse with Java Code

I successfully connected to a DB in eclipse through the Database Development perspective and am able to run queries in the SQL File Editor. However, I would like to write java code to automatically run a query and then extract the data to a flat file. What is the easiest way to do this? Since I am already connected to the database, can I bypass the java code that involves connecting to the database.
No, the Java JVM also needs to be able to connect to the database. There are many examples of JDBC connections on the internet, including this one.
Once you have got the data you needed, you should make use of FileWriter in order to write the information to file.

Automatically export password protected Access Table to .csv file using Java

What it needs to do.
1. Browse filesystem for DB.
2. Open password protected DB. (Program will hold the password)
3. Select table.
4. Export the table into a .csv file.
What I have.
Nothing, I am currently planning and designing. I am somewhat new to programming and have made similar programs just not connected to Access.
Plan so far.
I plan on using UCanAccess to connect with the database and am not sure what would be needed to convert the database into the .csv file.
Any help would be greatly appreciated. Although I know java I am more of a designer and am not great with syntax. I prefer to stick with Java but if there is an easier way I'm open to anything.
The main reason why I developped UCanAccess is to allow SQL query executions.
The direct usage of the jackcess library export utility (class com.healthmarketscience.jackcess.ExportUtil) seems to fullfil your simple requirement. It will allow you to export tables in csv with no more than three rows of code.

Create Jar file with IntelliJ IDEA that has mysql database

I want to create (export) my application into a Jar file to be portable.
How can i put my database contents with jar file?
For e.g for pictures, i put pictures folder beside my jar file, and it shows pictures correctly.
UPDATE
A peace of code to connect to database:
connection = DriverManager.getConnection("jdbc:mysql://localhost/Library", "root", "1234");
If you want to distribute a copy of your database with each copy of your application, I think using MySQL will be a bit complicated. You may want to look into using a database system designed to be embedded, such as SQLite, instead. A complete SQLite database is a single text file - you'd simply distribute your one mydatabase.db file along with the jar. See the examples at the above link.
There are two approaches you could use:
Approach 1
Do you really need to use database? If not, store your data on files in file system, that way you can easily export it with data.
Approach 2
Bundle the mysql installation directory in your jar / installer. Write a scripts which starts up both MySQL server and you application.

Concurrency embedded Java Database for simple Application

I am trying to build a simple GUI in which you can write some Integers. These Integers are supposed to be written into a Database, which I am looking for.
So far so good. The data in the Database should then be used for another stand-alone application, which already exists.
I tried it with SQLite already but I received a lot of "Database locked" Errors. I searched Google. The key answer I often read about was to switch to a database which supports concurrent processes.
I went further on and had a look at H2 and HSQLDB. Both of them seem to be legit but much more complicated.
So I wonder:
I would like to have the GUI to be portable in a .jar file (or a folder only) combined with the Database, so when I switch computers I do not have to install the DB in a certain folder like the home-directory or something. With SQLite all you do is this:
Connection con = DriverManager.getConnection("jdbc:sqlite:test.db");
As you can see, no Path-infortmation is necessary. How can I do this with H2 or HSQLDB?
I am really looking forward to your suggestions. But only open source please.
Kindest regards and thank you very much!
Stefan
With H2 and HSQLDB you can do the same.
With H2, a database URL of the form jdbc:h2:test will create a file called test.h2.db in the current working directory of your application. If this is what you want, then that's fine. Please note I usually don't suggest to do that, because many people run into the problem that they sometimes start the application in a different directory (which will then create a new database). Because of that, I suggest to use jdbc:h2:~/test, which means the database file is stored relative to the current user home directory.
Handling the creation of an embedded db file should not be a big issue - but if you really dislike this stick with SQLite: it should handle concurrency well enough for basic usage - 'database locked' sounds more like an application level problem

Categories

Resources