Questions tagged [jdbc]

JDBC (Java DataBase Connectivity) is the base API which enables interacting with SQL database servers by executing SQL statements using the Java programming language.

Filter by
Sorted by
Tagged with
0 votes
0 answers
45 views

Mapping named parameters to indices for PreparedStatement as DSL - follow-up

In the previous question I showed you my first attempt to handle named SQL parameters with JDBC and you were right, it wasn't as intuitive as I thought. The ...
t3chb0t's user avatar
  • 44.1k
5 votes
3 answers
498 views

Mapping named parameters to indices for PreparedStatement

I needed something to map named SQL parameters into indices for JDBC queries so I wrote the ParameterMap class that takes an SQL query, searchers for parameters ...
t3chb0t's user avatar
  • 44.1k
1 vote
0 answers
41 views

Import large Excel files directly from XML streams into an SQLite database

I've got some pretty large Excel files with nearly 1M rows that are almost impossible to open and work with in Excel anymore that I'm migrating into a database. Desipte this these files will stick ...
t3chb0t's user avatar
  • 44.1k
3 votes
1 answer
90 views

Company management app: Extracting data with JDBC and java.sql

I'm currently working on a company management system as a university project, and I have to get my hands in java.sql. I have come to struggle with extracting a ...
Thomas Herondale's user avatar
0 votes
2 answers
129 views

Searchable database with Java and SQL

What does the code do? Albeit unfinished (it does work, it's just not complete yet), the code creates a database (members.db) where telephone numbers, IDs, and ...
telometto's user avatar
  • 119
3 votes
1 answer
936 views

Testing DAO Delete User

I have several Dao classes, including a UserDao, below. The DAOs have many methods, but I'm focussing on deleteUser: ...
DozezQuest's user avatar
0 votes
0 answers
54 views

Is my implementation of connection scope for Dao right?I have Dao and Service where I implement connection and transaction scope

I have DaoFactory that returns DaoImpl and can make connection/transation scope ...
Justtoasktheneededquestions's user avatar
1 vote
1 answer
49 views

I have a query like this that seems complicated and I want to do it by using Java Stream Api

I have method that fetches sorted and filtered data from Mysql Database, Firstly I had done It by using Java. Now I did it by Mysql but I don't like the way the code looks I have entity that named ...
Justtoasktheneededquestions's user avatar
5 votes
3 answers
2k views

Using static final Strings for SQL Query in Spring Boot

This is regarding code quality and coding standards with respect to Spring Ecosystem. Here there are two methods: isRecordExists is using a class level static ...
Mohammad Javed's user avatar
4 votes
2 answers
88 views

MySQL JDBC integration into App from tutorial

I was following this tutorial for JavaFX and Gradle: JavaFX with Gradle, Eclipse and, Scene Builder on OpenJDK11 After completion of the tutorial you will have a simple GUI which you input a lower ...
Victor's user avatar
  • 165
4 votes
3 answers
3k views

Updating a huge hashmap from a resultset

I am using Java 7 Problem: I need to retrieve records from a database table based on a condition, orig_setting = 1. This query could return ~1000 records. Parameters from 1-7 of the Params object are ...
Sara's user avatar
  • 151
2 votes
0 answers
53 views

Library/API: simple springboot / jdbc query builder and ORM

I have been using and developing a simple ORM and query builder library that I have found useful in it's practical application. I am pretty sure there are improvements to be made, and I welcome any ...
rmalchow's user avatar
  • 121
5 votes
4 answers
295 views

Java methods to add and authenticate users in MySQL

I'm going through some code and trying to figure out how to get rid of duplicates from the following two methods. Both methods execute a simple login/register query to a local MySQL DB. I couldnt ...
Clayy91's user avatar
  • 61
2 votes
1 answer
456 views

Generating and storing a unique salt in Oracle database using Java

This is my account table: ...
Lebron11's user avatar
  • 143
0 votes
1 answer
92 views

Country, city, and address tables for a customer

I need to create a customer and I have foreign keys for each table. Below is an image displaying the relationships of the tables when I want to insert a new customer. Then below the diagram I list out ...
luckyguy73's user avatar
2 votes
1 answer
51 views

PreparedStatement for closable recordset and connection

Following approach uses more Functional approach (non OOP), each method is passed DataSource as dependency. I've written this piece and I'm wondering if there's something that can be improved. I wish ...
Developer's user avatar
  • 205
1 vote
0 answers
282 views

Consumer Producer problem solution using JDBI, MySQL, HikariCP

The app suppose to solve a subset of Producer–consumer problem. One producer, one consumer thread and buffer. The idea of the app to handle correctly database downtimes. The solution is to keep ...
J.Olufsen's user avatar
  • 151
2 votes
3 answers
116 views

Business rule updater

I'm trying to increase the speed of my application at the moment. My inserting/updating methods were opening every time a new connection which took too much time. I read that it's better to create a ...
J. Adam's user avatar
  • 129
3 votes
1 answer
792 views

Static class for database access Java JDBC

I'm writing a small program to store data in a database (a discord bot mainly). I know cleaner ways of using dependency injections and DAO exist, but I haven't written a DAO (or the user class) and ...
QuyNguyen2013's user avatar
1 vote
1 answer
405 views

Simple JDBC Query By Example (QBE) for Spring JDBC Template

This is a quick and dirty QBE method that covers about 60% of my use cases in my DAO. I just wanted to see if someone would take a quick look at it to see if there are any issues. ...
Jason's user avatar
  • 385
-3 votes
1 answer
62 views

Is there a different way of implementing this program without using nested while loop? [closed]

Presently my program is working properly, but how do i implement this program without using nested while loop(one while loop within another while loop).This is a kids way of programming and my office ...
david mathew's user avatar
2 votes
2 answers
1k views

Slow SQL Server performance with multiple PreparedStatement loop

I have a need to update thousands of database records at a time. I am using a loop to generate the necessary PreparedStatement updates, but am hoping for a more ...
Zephyr's user avatar
  • 217
0 votes
1 answer
449 views

JDBC wrapper in a functional manner

I implemented a simple Java JDBC wrapper in Kotlin with Arrow functional library. ...
Branislav Lazic's user avatar
1 vote
3 answers
4k views

Login module with JDBC

I made simple login module that is responsible for handling registration, and signing in my application. How can I improve this code? Are there any conventions for this case? The idea is to create ...
jas97's user avatar
  • 13
2 votes
2 answers
2k views

Jython using JDBC

I want to access databases by Jython by using JDBC drivers. I started with SQLite because this needs no database installation. I found two tutorials that implement similar things in Java and in ...
miracle173's user avatar
  • 1,326
2 votes
0 answers
391 views

Calling PL/SQL functions using JDBC in a Spring clone

I started to modify some old code and ended up creating a sort of spring jdbc framework. I know just the most popular design pattern, so I was wondering if my design was good. For example, to call ...
Accollativo's user avatar
2 votes
0 answers
418 views

Wrapper for sql.Connection

I wrote wrapper for Connection. It uses my Connection pool implementation. When the wrapper closes, the connection goes back to pool. ...
diofloyk's user avatar
  • 173
2 votes
2 answers
9k views

Transaction in spring boot

I am using spring boot in my application. ...
Prakash P's user avatar
  • 121
4 votes
0 answers
8k views

Simple MVC CRUD with JDBC

I would like to review my simple piece of code. I am beginner (I learn java for 1 year) and I would like to find out whether I am on good way. I have created simple MVC CRUD java app "ProductManager"....
ReviewCody's user avatar
3 votes
1 answer
2k views

Online shop interacting with database, updating cart and instantiating products

I'm new to programming web sites (and so on the relationship between program and database) and I have encountered a problem. I'm creating an online web shop that interacts and saves every info on a ...
Pleasant94's user avatar
1 vote
4 answers
106 views

Methods to get single and multiple JDBC results

I have two methods which are very similar apart from the method call inside and the return type. I wondered if there was a way to make it neater, i.e not duplicate the boiler plate connection code. I ...
user1472672's user avatar
3 votes
3 answers
14k views

JDBC query with limit and offset

I have this method that lists database objects: ...
WoLfPwNeR's user avatar
  • 131
6 votes
1 answer
1k views

Java JDBC: MySQL database-wrapper

I'm currently enrolled in a further education with the topic database administration. Among other chapters it contains how databases can be accessed from application-software. Because it lacks ...
michael.zech's user avatar
  • 4,146
2 votes
1 answer
105 views

Java database query logic

I'm making a wrapper for querying the database so that I can more easily control the flow of database management and to make it easier for me to write data beans around my database. This code is ...
jros's user avatar
  • 155
5 votes
2 answers
2k views

Authentication via LDAP and authorization via JDBC

I have a custom AuthenticationProvider for getting authentication via LDAP and authorization via JDBC. It's running but I think it's not the best way. My custom ...
BokC's user avatar
  • 151
3 votes
1 answer
116 views

Storing configurations of states to a database - Breadth First Search

I have wrote some code to store all possible configurations of a set of numbers in the sliding tile puzzle but the process of doing slow is very slow. Say, for instance, I have a sliding tile puzzle ...
Luke Garrigan's user avatar
6 votes
4 answers
1k views

Simple Oracle connection using JDBC

I'm trying to continue the learning process in Java, and I've made a simple yet useful class which will allow me to retrieve the data inside a table from an Oracle DB, using JDBC. What I'm especially ...
Grajdeanu Alex's user avatar
2 votes
1 answer
607 views

Using HikariCP and JDBC to store data for a Minecraft plugin

I'm creating a plugin for the game Minecraft, and with it I'm using HikariCP and MySQL to store data between server restarts. I've created working code but I'm wanting to improve it. While the code ...
Jerred Shepherd's user avatar
3 votes
1 answer
199 views

Classical model for database connection provider

Let's forget about Spring Singleton Beans and about other frameworks in Java. We have one or more simple HttpServlets. And we should make database connection. (doesn't matter what is it, hibernate ...
Ivan Ermolaev's user avatar
0 votes
1 answer
713 views

JDBC helper model

I needed to create a basic JDBC helper class for our JDBC connection and wanted to know if my design is appropriate or needs cleans up? Just a basic JDBC utility class which helps reduce the ...
Robben's user avatar
  • 203
3 votes
1 answer
824 views

Get RSS feeds and store them into database

It is my first program in Clojure. It read RSS feed's list from text file, get each feed and store result into sqlite database. project.clj: ...
ceth's user avatar
  • 792
2 votes
1 answer
154 views

Java MySQL handler for a Minecraft mod

I am studying computer science and recently I developed an application in Java (it is a minecraft mod) that connects a MySQL database and queries to fetch, update or insert data. My DatabaseHandler ...
Vpant's user avatar
  • 139
3 votes
1 answer
12k views

Reading SQL file using injection and utility reader

I've come up with a way to externalize and read in my .sql files instead of having them in-code as strings. Note that I'm keeping the .sql file in the same package as the DAO (NOT separated into a ...
Tony Card's user avatar
  • 131
1 vote
0 answers
2k views

Pagination from resultset for JTable

I am trying to create simple app, where I need a pagination for my JTable. I want have there buttons with number for all "pages" in my JTable. I have code here: Class Customer: ...
Jan444444's user avatar
2 votes
1 answer
4k views

JavaFX app which does CRUD on a database table

I created my first java application for a college assignment. I tried my best to design my application using best practices of MVC design patterns. I have read about it on Stack Overflow and other ...
coos wolff's user avatar
4 votes
2 answers
7k views

DAO to create, update, and delete a project

I'm trying to write my first "complex" program in Java. So far, I created a local H2 database but I'm not sure about the quality of my code (I'm newbie in Java) because I don't know how I can deal ...
salamanka44's user avatar
-2 votes
1 answer
105 views

REST WS connecting to a database

I have a REST WS in Java using Jersey that connects to a database. I don't know what should be the ideal time for execution but I feel the time it takes is too much. The actual call to DB completes ...
user3275095's user avatar
2 votes
1 answer
1k views

Connection pool for java.sql.Connection

I have made a connection pool for SQL Connection objects. The purpose of this object is to provide multi threaded support for the accessing of the underlying ...
Ferrybig's user avatar
  • 1,347
1 vote
1 answer
136 views

Recording a customer's shopping cart as an order 2.0

Some days ago, I put up a question here for review about the best way to handle JDBC transactions in the context of an e-commerce Java web application. After a kind suggestion from user @gardenhead, ...
Enrique's user avatar
  • 145
2 votes
2 answers
267 views

Recording a customer's shopping cart as an order

I have come up with the following method to post a transaction to a database, in the context of an e-commerce Java web application. The transaction consists in submitting a new order alongside its ...
Enrique's user avatar
  • 145