People who code: we want your input. Take the Survey

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
2
votes
1answer
50 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: ...
-1
votes
0answers
42 views
0
votes
0answers
26 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 ...
1
vote
1answer
39 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 ...
5
votes
3answers
964 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 ...
4
votes
2answers
76 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 ...
4
votes
3answers
1k 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 ...
2
votes
0answers
36 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 ...
5
votes
4answers
226 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 ...
2
votes
1answer
199 views

Generating and storing a unique salt in Oracle database using Java

This is my account table: ...
0
votes
1answer
65 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 ...
2
votes
1answer
42 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 ...
1
vote
0answers
210 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 ...
2
votes
3answers
109 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 ...
3
votes
1answer
278 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 ...
1
vote
1answer
255 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. ...
-3
votes
1answer
55 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 ...
1
vote
0answers
58 views

JavaScript loop to copy JDBC query results to a 2D array

I have a JS running in Google App Script, but for me, it's like an overall example/problem I ran into more often. The script fetches via JDBC the results of a MySQL query. The result has about 60.000 ...
2
votes
2answers
812 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 ...
0
votes
1answer
357 views

JDBC wrapper in a functional manner

I implemented a simple Java JDBC wrapper in Kotlin with Arrow functional library. ...
1
vote
3answers
3k 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 ...
2
votes
2answers
1k 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 ...
1
vote
0answers
75 views

CRUD in JSP AND SQL

I would like to simplify my code when I add an entry. All is OK for 1 table (table = "ecole"). I can add an entry without problem. My problem is that I will wish to add a second table named "nom" in ...
2
votes
0answers
299 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 ...
2
votes
0answers
403 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. ...
2
votes
2answers
8k views

Transaction in spring boot

I am using spring boot in my application. ...
4
votes
0answers
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"....
3
votes
1answer
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 ...
1
vote
4answers
93 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 ...
3
votes
3answers
11k views

JDBC query with limit and offset

I have this method that lists database objects: ...
6
votes
1answer
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 ...
2
votes
1answer
97 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 ...
5
votes
2answers
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 ...
3
votes
1answer
98 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 ...
6
votes
4answers
874 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 ...
2
votes
1answer
456 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 ...
3
votes
1answer
176 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 ...
0
votes
1answer
667 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 ...
3
votes
1answer
730 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: ...
2
votes
1answer
136 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 ...
3
votes
1answer
10k 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 ...
1
vote
0answers
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: ...
2
votes
1answer
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 ...
4
votes
2answers
6k 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 ...
-2
votes
1answer
101 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 ...
2
votes
1answer
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 ...
1
vote
1answer
109 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, ...
2
votes
2answers
254 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 ...
6
votes
1answer
63 views

Library of news articles

I have a library of news articles. Each story is unique by id. ...
1
vote
1answer
2k views

Speeding Up JavaMail Sending

I am creating a miniature bulk email sender. I am using Postfix on Ubuntu with JavaMail. Here is the key part of the code: ...