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
61 views

Generating and storing a unique salt in Oracle database using Java

This is my account table: ...
0
votes
1answer
43 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 ...
0
votes
1answer
27 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
59 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
106 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 ...
4
votes
0answers
6k 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
46 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
56 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
3answers
374 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 ...
-3
votes
1answer
52 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 ...
0
votes
1answer
197 views

JDBC wrapper in a functional manner

I implemented a simple Java JDBC wrapper in Kotlin with Arrow functional library. ...
1
vote
0answers
49 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 ...
1
vote
3answers
954 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
602 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 ...
5
votes
2answers
1k 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 ...
1
vote
0answers
65 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
206 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
339 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
3answers
6k views

JDBC query with limit and offset

I have this method that lists database objects: ...
2
votes
2answers
8k views

Transaction in spring boot

I am using spring boot in my application. ...
3
votes
1answer
996 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
86 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 ...
7
votes
5answers
3k views
4
votes
2answers
19k views

Student Registration System

This application is a "Student Registration System" using JDBC with Oracle as part of our school project. It works as it stands right now. Questions: What is a better way to structure the project? ...
4
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
111 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 ...
2
votes
1answer
93 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 ...
3
votes
1answer
94 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 ...
-2
votes
1answer
100 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 ...
6
votes
4answers
646 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
135 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 ...
2
votes
1answer
258 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 ...
0
votes
1answer
591 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
616 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
7k 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 ...
2
votes
1answer
3k 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 ...
1
vote
0answers
1k 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: ...
26
votes
3answers
26k views

Connection pool implementation

I wanted to try out writing an minimalistic connection pool implementation (out of curiosity and for learning). Could you all please review the code and provide feedback? There are two classes (...
7
votes
3answers
35k views

Module for building swing tables

I have a module that builds swing tables based on an Object[][], then I have another module that queries an SQLite database and returns a ...
3
votes
3answers
4k views

Method to close a lot of closeable objects

I wrote a method that closes 3 closeable types: java.sql.Connection java.sql.PreparedStatement ...
3
votes
2answers
237 views

Designing DAOs that handle composite objects

Suppose I have following elementary DTOs, each DTO corresponding to a database table: class Event { String name } class Player { String name } DAOs for ...
4
votes
2answers
4k 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
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
98 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
245 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: ...
4
votes
2answers
96 views

JDBC connection and retrieval of info

If you are wondering why I ask, it is because I have numerous different methods all with very similar code (the only difference in the code in each method is what is between the generate ...
5
votes
2answers
1k views

Serialize/deserialize objects to and from database concurrently

I have a class which runs as spring bean in the container and its purpose is data persistence. In the overriden method ...
4
votes
1answer
132 views

GUI SQL interface for select insert and remove

This is my final project for my second Java class! I would like to get some feedback on it to see where and what I can improve. There are five class files: ...