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

learn more… | top users | synonyms

5
votes
4answers
347 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 ...
1
vote
1answer
29 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 ...
2
votes
1answer
33 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
101 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
46 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: ...
1
vote
1answer
57 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 ...
1
vote
1answer
133 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
137 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: ...
0
votes
0answers
57 views

Updated version of app which does CRUD on a database table

A while ago I created my first Java application. I tried to follow the MVC pattern. I posted my code for review and with the answers I got I did more research and rewrote my code. I gave every ...
2
votes
1answer
356 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
275 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
86 views

Java REST WS function calling DB taking lot of time

I have a REST WS in Java using jersey that connects to 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 in ...
2
votes
1answer
231 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 ...
0
votes
0answers
108 views

Ingest data from an RDBMS to Hadoop Hive database using Sqoop

Context: The below code will run a series of steps in an ETL workflow. I would like the code to be reviewed to avoid memory bottlenecks and null pointer exceptions etc. UseCase: Ingest the data from ...
1
vote
1answer
52 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
134 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
53 views

Library of news articles

I have a library of news articles. Each story is unique by id. ...
1
vote
1answer
67 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
57 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 ...
4
votes
1answer
87 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: ...
4
votes
2answers
63 views

SQLite UPDATEs for persons and a subclass

I am using Java with SQLite and I am wondering if I am in the right track onto writing good code i.e. more or less reusable: SQL scheme: ...
5
votes
2answers
286 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
2answers
989 views

Creating and deleting employees in a database

I've been learning Java Database Programming for like 2 days, I read theory at first. Now decided to get stuck in. I just wanted a few pointers. I am using JavaDB (Netbeans Service) should I be ...
4
votes
1answer
1k views

Loading the JDBC driver jar dynamically from external location

I have a small project in which I get the URL, username, password, and driver from a text file and I have to fire a query on the database by dynamically reading the jar file in a predefined directory, ...
1
vote
1answer
369 views

Method to Return a Hibernate Session

Can this method be improved?: ...
3
votes
1answer
3k views

MySQL Java in JTable

This is an assignment posted here. (Part-B) The aim here is to create a GUI in which the user can search for and insert data into a particular table of a MySQL database. Is this an appropriate ...
3
votes
3answers
3k views

Realizing a SQL ResultSet into a Map in Scala

I am trying to realize a java.sql.ResultSet into a map, in Scala. ...
1
vote
1answer
794 views

JavaSE client: is this how to get a new JPA EntityManager each time? (DAO)

This class functions, in that the program can be left open for hours and it will still reconnect to the database when the user prompts for a CRUD operation. I've read about DAO, and some other ...
2
votes
1answer
884 views

Multi-parameter search using JDBC PreparedStatement

I want to create multi parameter search using JDBC prepared statement so as to prevent SQL injection attack and improve performance. As I couldn't find the best way to do it on the net. I've tried ...
2
votes
1answer
3k views

Basic CRUD DAO using JDBC to access my database

I have a basic CRUD DAO using JDBC to access my database. I using a connection pool to get a connection in each method and then execute my commands. In some scenarios for update ...
3
votes
3answers
1k views

Method to close a lot of closeable objects

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

Inserting tables with foreign key

How can I improve this method that adds data to three tables in the database? The tables are: UserTable UserInfoTable ...
4
votes
1answer
542 views

Converting JDBC to CSV

One of my first ever Jython scripts lets me get comma-separated values out of an RDBMS: ...
5
votes
1answer
817 views

More efficient way to make a Twitter status in a string of just words

I am making an application where I will be fetching tweets and storing them in a database. I will have a column for the complete text of the tweet and another where only the words of the tweet will ...
4
votes
1answer
636 views

Connection to a database, do I need to create a new one and close it everytime?

I currenctly have a class which does several requests to a database with several methods (called from main method) sharing this pattern : ...
3
votes
1answer
562 views

Design considerations for classes/methods using JDBC to ensure resources closed correctly

In reviewing code in our application, I see a tension between what makes a convenient design for methods accessing database data versus coding to ensure that the JDBC resource objects are closed ...
16
votes
3answers
15k 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 (...
2
votes
1answer
123 views

How to hide implementation of JDBC while processing large query in client's code?

I have client's methods that processes a large SQL query. I wouldn't like to do that through getting whole query result to memory, but process it in batches. It entails with exposing JDBC API to ...
3
votes
1answer
1k views

Getting list from an Oracle database and storing it in an object

I have two admin groups - VCS, and VPN. For each group, I need to get the list of all the people in that group, along with their IDs. What is the best way to do this? Could you please suggest if it ...
5
votes
2answers
161 views

Table model code style

This is my table model code style: ...
3
votes
2answers
194 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 ...
1
vote
1answer
746 views

Generic DB Value Getter

I'm trying to see if there is a better way to do this when I just need one column with one row. Do not mind the lack of use of a prepared statement, I will put it in. ...
2
votes
1answer
551 views

Am I using appropriate methods in this login system?

I have had to do a crash course in JSP, Servlets, and JDBC. I decided to attempt a Login System. I'm unsure if my use of try/catch is appropriate and if I am closing database connections correctly. ...
3
votes
2answers
8k 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
804 views

Finding potential thread safety issues and race conditions in my multithreading code

I am working on a project in which I have two tables in a different database with different schemas. So that means I have two different connection parameters for those two tables to connect using JDBC-...
2
votes
2answers
212 views

Inserting into a database using JDBC

I am trying to insert into a database using JDBC and each thread will be inserting into the database. I need to insert around 30-35 columns. I wrote a stored procedure that will UPSERT into those ...
3
votes
2answers
165 views

Inserting into database columns

I am trying to insert into a database using JDBC and each thread will be inserting into the database. I need to insert into around 30-35 columns. I wrote a stored procedure that will UPSERT into those ...
0
votes
2answers
343 views

How to optimize this SQL delete

I want to optimize the performance of this SQL query. If I populate this hashtable with one million keys the query will take around minute. How I can optimize this Java method for faster execution? <...
7
votes
3answers
34k 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 ...
4
votes
1answer
567 views

Execute multiple query from a text file

I am just wondering if this is a correct way to execute multiple query from a text file. ...