Open-source News

Install JDBC on Linux in 3 steps

opensource.com - Fri, 09/23/2022 - 15:00
Install JDBC on Linux in 3 steps Seth Kenlon Fri, 09/23/2022 - 03:00

When you write an application, it's common to require data storage. Sometimes you're storing assets your application needs to function, and other times you're storing user data, including preferences and save data. One way to store data is in a database, and in order to communicate between your code and a database, you need a database binding or connector for your language. For Java, a common database connector is JDBC (Java database connectivity.)

1. Install Java

Of course, to develop with Java you must also have Java installed. I recommend SDKman for Linux, macOS, and WSL or Cygwin. For Windows, you can download OpenJDK from developers.redhat.com.

More on Java What is enterprise Java programming? Red Hat build of OpenJDK Java cheat sheet Free online course: Developing cloud-native applications with microservices Fresh Java articles 2. Install JDBC with Maven

JDBC is an API, imported into your code with the statement import java.sql.*, but for it to be useful you must have a database driver and a database installed for it to interact with. The database driver you use and the database you want to communicate with must match: to interact with MySQL, you need a MySQL driver, to interact with SQLite3, you must have the SQLite3 driver, and so on.

For this article, I use PostgreSQL, but all the major databases, including MariaDB and SQLite3, have JDBC drivers.

You can download JDBC for PostgreSQL from jdbc.postgresql.org. I use Maven to manage Java dependencies, so I include it in pom.xml (adjusting the version number for what's current on Maven Central):

>
    >org.postgresql>
    >postgresql>
    >42.5.0>
>3. Install the database

You have to install the database you want to connect to through JDBC. There are several very good open source databases, but I had to choose one for this article, so I chose PostgreSQL.

To install PostgreSQL on Linux, use your software repository. On Fedora, CentOS, Mageia, and similar:

$ sudo dnf install postgresql postgresql-server

On Debian, Linux Mint, Elementary, and similar:

$ sudo apt install postgresql postgresql-contribDatabase connectivity

If you're not using PostgreSQL, the same general process applies:

  1. Install Java.

  2. Find the JDBC driver for your database of choice and include it in your pom.xml file.

  3. Install the database (server and client) on your development OS.

Three steps and you're ready to start writing code.

Install Java, install JDBC with Maven, and install the database. Then you're ready to interact with databases in your Java code.

Image by:

Pixabay. CC0.

Java Linux Databases What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

Most Common Network Port Numbers for Linux

Tecmint - Fri, 09/23/2022 - 12:22
The post Most Common Network Port Numbers for Linux first appeared on Tecmint: Linux Howtos, Tutorials & Guides .

In computing, and more so, TCP/IP and UDP networks, a port is a logical address that is usually assigned to a specific service or running application on a computer. It is a connection endpoint

The post Most Common Network Port Numbers for Linux first appeared on Tecmint: Linux Howtos, Tutorials & Guides.

Mesa 22.3 Merges The Big Draw Throughput Improvement For Intel's Vulkan Driver

Phoronix - Fri, 09/23/2022 - 05:00
From two weeks back you may recall the small patches that led to increasing Intel's Vulkan driver draw throughput by ~60%+. Well, as of yesterday the refined version of that work has landed within Mesa 22.3...

Wayland's Weston 11.0 Released With HDR Display & Multi-GPU Preparations

Phoronix - Fri, 09/23/2022 - 00:30
Weston, the reference compositor to Wayland, is out today with a big feature update. Most exciting is preparation work for better supporting HDR monitors moving forward as well as preparing for multi-GPU and multi-back-end use-cases...

Blender 3.3 AMD Radeon HIP vs. NVIDIA CUDA/OptiX Performance

Phoronix - Thu, 09/22/2022 - 23:40
Earlier this month Blender 3.3 released and in addition to introducing an Intel oneAPI back-end, it's notable for bringing improvements to the AMD HIP back-end for Radeon GPUs. Significant on the AMD side is extending GPU support back to GFX9/Vega. Thus it's a good time for a fresh round of benchmarking for showing how the AMD Radeon HIP performance against that of NVIDIA's existing CUDA and OptiX back-ends.

Fwupd 1.8.5 Supports More USB4 Docks, New AMD SMU Firmware Version Plugin

Phoronix - Thu, 09/22/2022 - 22:23
Fwupd 1.8.5 is out today for continuing to improve the firmware updating experience on Linux systems in conjunction with the Linux Vendor Firmware Service (LVFS)...

Intel Gallium3D "Iris" Driver Changes Merged For Rusticl's OpenCL 3.0

Phoronix - Thu, 09/22/2022 - 18:48
While Intel's Compute-Runtime stack is fully open-source and already provides OpenCL 3.0 support for recent generations of Intel graphics under Linux, it looks like the recently-merged "Rusticl" Rust OpenCL implementation in Mesa will soon be working too on Intel graphics hardware as an alternative OpenCL 3.0 implementation...

Pages