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.
32,119
questions
0
votes
0
answers
10
views
org.postgresql.util.PSQLException: This ResultSet is closed
When I am trying to print the row values from a table in a PostgreSQL database using JDBC with this code
static Connection c = null;
static Statement statement = null;
static Scanner sc = new Scanner(...
-1
votes
0
answers
13
views
Exit from ssh connection on Macos Monterey terminal
I made a connection to my server with ssh. Now, after the connection ended (in theory) my terminal always says that i'm connected in the mysql server.
How can i restore my terminal? I tried with the ...
0
votes
0
answers
10
views
Why performance of splicing update sql is better than using batch executor?
The row of table is 20 millions, the row of waiting to update is 10k. Splicing update SQL like that UPDATE xx SET a = x WHERE id = x;UPDATE xx SET a = x WHERE id = x;UPDATE xx SET a = x WHERE id = x; (...
0
votes
0
answers
14
views
Unknown character set index for field '255' received from server is still there with matching encoding in url for 8.0.29 mysql connector
This error while making connection to the mysql database.
Class.forName("com.mysql.jdbc.Driver");
String user = "root";
String password = "password";
String url =...
0
votes
2
answers
27
views
Keeping ResultSet of a JDBC query in a class attribute vs. simply returning it
I'm working on a connection manager class at the moment which will be called multiple times. Its purpose is to establish a connection and return results as a result set, but i have some questions ...
0
votes
1
answer
26
views
Spring app connects to in-memory H2 db instead of file based
I am trying to create a local database in disk and connect to it. Basically I want jdbc.h2.file, not jdbc.h2.mem. This is how I set up the application.properties.file
spring.jpa.hibernate.ddl-auto = ...
1
vote
1
answer
36
views
Spring Data JDBC skip locked
I'm trying to acquire row lock with SKIP LOCKED modifier using Spring Data JDBC.
When use JPA (Hibernate) you can achieve that by using hint @QueryHints({@QueryHint(name = "javax.persistence....
0
votes
2
answers
34
views
Cannot connect to mysql database from popsql with my vscode
#java code for connection with jdbc
import java.sql.*;
public class abc {
public static void main(String args[])throws Exception{
# my driver which i am using
String url = "jdbc:mysql://...
0
votes
1
answer
20
views
No jdbc driver for mysql 8.0.28
How to get the JDBC driver for mysql 8.0.28 the website has installer only. Does they removed it? How to get the driver for this version?
0
votes
0
answers
12
views
Update specific row on Oracle/Sql Db using jdbc via Databricks
I have an use case where I want to update specific row, by any identifier/where clause conditions and update that record on Oracle or SQL Server from databricks.
As i use spark.read.format("jdbc&...
0
votes
0
answers
30
views
Updates from Oracle dbms is not showing up in Java [duplicate]
I am trying to learn to connect a database to a Java program and I encounter an issue that all the entries I provided from my Oracle client are not showing up in my JDBC program
import java.sql.*;
...
0
votes
0
answers
17
views
kettle7.1 connect to mysql ERROR The driver has not received any packets from the server
I'm studying Pentaho Data Integration 7.1 to connect to MySQL, but I got the error as follows:
Error connecting to database [1] :org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred ...
0
votes
0
answers
18
views
pyspark dataframe databricks - issues with the performance - write to JDBC
I need to write pyspark dataframe to the Azure SQL database. Df has 300 000 000 records and the jdbc connector is not able to do it in a short time.
Dataframe is a select from delta table and join ...
0
votes
0
answers
11
views
How to store public and private key generated by RSA in java to Postgres sql
public static void keyPairProducing() throws NoSuchAlgorithmException, FileNotFoundException, IOException, SQLException {
File pFile = new File("public.key");
File prFile = ...
1
vote
1
answer
38
views
Spring Boot JPA/JDBC batching findById works but findOneByX not working
I am using Spring Boot JPA, I have enabled batching by ensuring the following lines are in the my application.properties:
spring.jpa.properties.hibernate.jdbc.batch_size=1000
spring.jpa.properties....
0
votes
0
answers
17
views
Logstash jdbc input with postgresql - jdbc_fetch_size ignored?
I am ingesting a large amount of data from postgresql and am trying to get jdbc_fetch_size working properly. Before this I used redshift and it was working very well. Logstash memory would stay around ...
0
votes
1
answer
13
views
Parameterizing postgis geometry query
I'm trying to query whether any of a set of polygons (passed in at runtime) intersects with a set of polygons stored in the database in the "enclosing_polygons" field, which is a ...
1
vote
1
answer
32
views
Database column time is getting converted to local timezone
I've a Postgres SQL database with one column storing the time with timezone in UTC. In my Quarkus app I've defined the Entity as following:
public class Data {
@Column(name = "created_at"...
-2
votes
0
answers
60
views
Preventing the SQL injection in Statement
I am working on a legacy project and the project had done the auditing recently. Facing an issue with SQL Injection. The have try to resolve it with StringEscapeUtils.escapeHtml5
String n=...
0
votes
1
answer
22
views
Will DB connection leakage cause too many inactive session in Oracle?
I was assigned a task about fixing too many inactive session in Oracle database which used in our Java application. We found there was java method which didn't close the JDBC connetion. I know this ...
0
votes
0
answers
15
views
Connect Hive JDBC to linux server - Failed to detect a valid hadoop home directory
I am writing a java code to connect Hive server (Linux) using HIVE JDBC.
Here is the code
class TestHiveJdbc {
public static void main(String[] args) throws SQLException {
...
1
vote
0
answers
88
views
JDBC Driver - how to pass null datetime2 value as parameter to native query?
After updating from JTDS to MSSQL JDBC driver (version 10.2.0.jre8 - hibernate 4.3.11.Final) I'm encountering the following error when trying to pass a null value within a datetime2 parameter used ...
0
votes
0
answers
10
views
IlegalStateException: Cache already created: 'database-code'
I have a spring boot application where I use mssql-jdbc to connect to my sql-server database and I am using Hikari connection pool. There is a line of code in my application which creates a ...
0
votes
0
answers
24
views
Hibernate error when executing JDBC statements - unexpected token 'UNIQUE'
I searched around and the only similar StackOverflow thread doesn't address what I'm looking for.
I have defined an auxillary database object in Hibernate like so:
<database-object>
<...
0
votes
0
answers
14
views
Upgrading to TLS 1.2 causing TCP/IP connection issues with JDBC
Since upgrading to TLS 1.2 my JDBC connection is failing. I checked the error and have ensured that
An instance of SQL Server is running on the host and accepting TCP/IP connections at the port
...
0
votes
0
answers
40
views
For SqlServer please explicitly choose either sqlserver16 or sqlserver17 as the platform via DatabaseConfig.setDatabasePlatformName
I am working on Java Play Framework template 2.8.13 with sbt 1.6.2 and Scala 2.13.8 and I come from an upgrade play from 2.1.5 to the mentioned. The problem is when I try to connect to SQL Server (SQL ...
0
votes
1
answer
36
views
Java-Integration with JDBC - No suitable driver found for jdbc:mysql error
I am relatively new to Java.
Need to use Java with JDBC. I currently try to connect to the database local on my machine.
This is a part of training which is very important to me now.
I am using Java ...
0
votes
2
answers
52
views
Spring boot MySQL request return null when it shouldn't
I'm making a rest API for an App I'm creating,
I have a MySQL database and I'm using Springboot.
I coded this
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import java....
0
votes
0
answers
38
views
AS400 JDBC Driver - help needed [duplicate]
On Window 10 OS, I am attempting to complete a sample java code that I got online, below is the code. I am not using fancy IDE, just plain old notepad.
import java.sql.*; ...
0
votes
0
answers
22
views
Sqoop import Oracle Number datatype
In Oracle, a table contains column defined as Number(without precision and scale), and actual values in this column could be integer or decimal.
When using sqoop in informatica to import oracle table ...
0
votes
0
answers
15
views
How to mock jdbcTemplate.query(query.toString(), resultSet -> {});
My Repository code:
jdbcTemplate.query(query.toString(), resultSet -> {
PartGroup partGroup = new PartGroupMapper().mapRow(resultSet, resultSet.getRow());
partGroup....
0
votes
0
answers
18
views
Elastic Search / Logstash run command after import
I'm using logstash (with jdbc-input) to import documents from DB (MariaDB) to Elastic Search, sheduled every 5 minutes.
The duration of that run depends on the number of docuemnts added since the last ...
0
votes
0
answers
20
views
Why does resultSet.next() hang when using streaming query
JDBC connection hangs at executing rs.next()
I found the answer here, but it doesn't work in my code;
My query will return 12150 rows of data;
When select * is used, only 12125 rows of data are ...
0
votes
0
answers
14
views
Transfer data from S3 to Oracle DB with JDBC
I have a data set in parquet saved on s3, I would like to save them on Oracled DB on AWS. Is there a way to transfer the data without passing the schema of all table?
0
votes
1
answer
60
views
How to connect to an ODBC data source from Spring Boot? [duplicate]
I am developing a Spring Boot application that polls data from a legacy ODBC data source and inserts it into a MS SQL Server database.
I need to connect to DSN that is using Progress OpenEdge driver.
...
0
votes
0
answers
6
views
Redshift jdbc using ping federation
I've set up idp ping and redshift according to the instructions on https://aws.amazon.com/blogs/big-data/federating-single-sign-on-access-to-your-amazon-redshift-cluster-with-pingidentity/, but on ...
0
votes
0
answers
29
views
How to populate an ArrayList as a property inside a class using jdbc?
I have a frame which has two JComboBoxes and a Rent Button. One ComboBox contains an arraylist of a class called Movie. The other ComboBox contains an arraylist of a class called Member which has a ...
2
votes
2
answers
45
views
How to change id column type already registered in the database
I'm trying to change my Id column type from int to bigInt because the records are too big and I'm getting an error if I try to store more records but I'm not sure if it's safe to just alter the table ...
0
votes
0
answers
11
views
Why does my method with @Query to perform a PostMapping or save me generate an error type: java.sql.SQLException: Not a navigable ResultSet
I am trying to perform a CRUD with JPA and mysql through @Query, for this in my database I have a stored procedure that registers me in a table.
When I hit the service from the postman, it generates a ...
0
votes
1
answer
54
views
How do I use @Query in a Micronaut Data repository to do an aggregation query where the results have more than one column?
I completed this tutorial: https://guides.micronaut.io/latest/micronaut-data-jdbc-repository-gradle-java.html
I then added code to the completed, working tutorial to try to do a custom SQL query for a ...
-1
votes
0
answers
19
views
How to visualize data from apache hive in UBUNTU with POWER BI [closed]
I need the steps to follow to establish a connection between Power BI and Hive.
I have Apache Hive in ubuntu 20.04 on oracle Virtualbox and power BI in windows 11.
I first installed ODBC Driver then I ...
-3
votes
1
answer
36
views
java.sql.SQLException: No value specified for parameter 9
I just want to ask what I can do or a solution to this problem?
[enter image description here]` private void update_buttonActionPerformed(java.awt.event.ActionEvent evt) {
try{
String ...
0
votes
1
answer
32
views
Spring boot jooq dao trouble
I'm new to Java and Spring and I am doing my first rest service. I've encountered a problem to which I cannot find an answer.
I generated entities using Jooq with pojos and daos
<plugin&...
0
votes
1
answer
27
views
Not able connect database using JDBC
I am trying to connect with my SQL server in databricks notebook with JDBC using spark sql.
val jdbcHostname = "database.windows.net"
val jdbcPort = 1433
val jdbcDatabase = "Database1&...
0
votes
0
answers
36
views
Can't access MySQL database from exe but works fine in IDE and jar
I have a small GUI application that is supposed to access a local MySQL database. It works fine from my IDE and jar file but once I use the jpackaging tool to turn it into an exe it does not connect ...
0
votes
0
answers
30
views
How to delete table records on cascade without the program freezing?
this is my delete button method, it takes the college name as a primary key and deletes it so the whole record gets deleted. However, it can't be deleted because this table COLLEGE is the parent table ...
-1
votes
0
answers
32
views
T-SQL to convert data stored in Scientific Notations back to original data type of VARCHAR [duplicate]
A data file with millions of records has been imported into a SQL Server table. One of the columns in data file is of text data type with values in this column to be integers only. The corresponding ...
0
votes
1
answer
38
views
Spring Boot and H2 Table Population Error: org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL
I am having trouble getting an H2 In Memory database to populate. The idea here to have the BuildingCode which is unique as a primary key and id.
I get the following class level errors:
org.hibernate....
-1
votes
0
answers
17
views
Getting 'com.android.tools.r8.internal.Hc: Sealed classes are not supported as program classes' when trying to load Microsoft SQL Server JDBC
I'm using android studio to connect to a Microsoft SQL Server and I can't use the JDBC for JDK 17. It just appears with the following error message:
'com.android.tools.r8.internal.Hc: Sealed classes ...
0
votes
0
answers
31
views
Retrieve clob data using apache camel
I am polling clob column using apache camel as below.
<route>
<from uri="timer://timer1?period=2m" />
<setBody>
<simple>
...