Questions tagged [jdbc]
Java Database Connectivity (JDBC) is a Java standard that provides the interface for connecting from Java to relational databases.
49
questions with no upvoted or accepted answers
5
votes
1
answer
1k
views
Measure Performance for INSERT, UPDATE and DELETE commands on DB2
I have a DB2 database with a table for daily transactions, which is cleared to a history table at the end of the day, every day.
I insert rows to this table via java-JDBC INSERT commands and they ...
3
votes
2
answers
986
views
How do I run a database heavy query over jdbc without timing out (Oracle)?
For one of our applications (Pentaho Data Integration), we need to run queries through the oracle jdbc. Some of these queries are computation expensive and can take an hour or more to return any rows ...
3
votes
1
answer
1k
views
Why would a query return oracle.sql.NUMBER@[hex value] in place of a numeric value?
I'm seeing some odd behavior in an Oracle 11gR2 database. When I select from a particular table, using SQL Developer, certain rows of the result set include non-numeric results in a NUMBER column (...
3
votes
2
answers
148
views
Causing ORA errors in a program using JDBC. How can I find what's causing them?
So I'm building a java app to interface with the company's database. Whenever it causes an ORA error, it just prints something like the following to system output:
ORA-00911: invalid character
Is ...
3
votes
0
answers
2k
views
MySQL SSL using MariaDB JDBC Driver
We have the following setup:
Ec2 instance running a jboss server with mariadb (1.1.7) datasources setup to connect to an rds instance running MySQL 5.6.21.
We would like to turn on SSL on for this ...
3
votes
0
answers
311
views
Unable to Update on SQL Server 2008 R2
This is a bit strange so bear with me please.
After installing a new SQL Server 2008 R2 on a new server (Windows 2012 Standard) just like the production one, I tried to connect my web aplication (...
2
votes
0
answers
876
views
Connection to Azure SQL from Java
I try to connect to Azure SQL with MS JDBC driver:
import java.sql.*;
public class ExampleSQLJDBC {
public static void main(String[] args) {
// Setting.
String connectionUrl = "...
2
votes
0
answers
118
views
JDBC Statement vs. Prepared Statement SQL Injection
as far as I understand a "normal" JDBC Statement which is created via
conn.createStatement()
is prone to SQL-Injection. A prepared statement protects from such attacks. So why/when should I use a ...
2
votes
0
answers
18
views
JDBC - maximum allowable cursors - how do I see my open statements?
I've got some resource leaking and I'm trying to find what's causing them. I think I have some statements or resultsets that aren't being closed properly. Is there any way to see all of the cursors ...
2
votes
0
answers
1k
views
Is there a way to detect if there is an uncommitted transaction in H2?
I am using an H2 database with JDBC to create a connection with setAutoCommit(false).
I am currently programatically checking whether or not there is an uncommitted transaction, but I was wondering ...
2
votes
0
answers
158
views
Wanted: Android versions of JDBC drivers for common RDMBSes
I've got a Java-based application library I'm trying to port to Android. The package presently supports:
Oracle
Informix
DB2
Postgres
Sybase
...And can easily be configured to use any other SQL92 ...
1
vote
0
answers
74
views
is it possible to set specific timezone for session in mariadb connector/j
I 'm trying to use timezone setting with mariadb connector/J version 3.x.
In the documentation,in Timezone consideration, it says:
'a timezone': connector will set connection variable to value. ...
1
vote
1
answer
188
views
Can JDBC Oracle file stream blob inserts be speeded up?
I have these four different ways by which I am inserting some file data into an Oracle database using JDBC and PreparedStatements.
Approach A
ps.setBytes(1, fileDataInByteArray);
Approach B
Blob ...
1
vote
0
answers
392
views
Oracle 19c: Sql.Recovarable.Exception [Error 17410]
We get an exception while making this call from our backend to the database:
select f.*
from T t
inner join CATEGORY Category
on Category.ID1 = t.ID1
where Category.ID2 = ? and t.ID3 = ? and Category....
1
vote
0
answers
816
views
Debugging connection leak in postgres instance in RDS
Trying to debug a connection leak in postgres database instance in RDS
SELECT * FROM pg_stat_activity;
Running the above query shows around 500 sessions, but all of them have wait_event_type Client ...
1
vote
0
answers
102
views
Metadata retrieval query executed for every invocation of ResultSet.updateRow in PostgreSQL JDBC driver
I'm using an updatable ResultSet, where I want to update the columns directly in the ResultSet and commit (for performance and avoiding complex rollback logic). For this, I do the following -
Create ...
1
vote
0
answers
395
views
JDBC can't use the current primary database by setting multiple hosts
node1: 192.168.0.1 as primary
node1: 192.168.0.2 as standby
The JDBC string is setting as this:
<url>jdbc:postgresql://192.168.0.1:5432,192.168.0.2:5432/mydb</url>
Using repmgr doing ...
1
vote
0
answers
163
views
Support for JDBC 4.2?
As far as I can tell, the jcc driver shipped with 11.5 (https://www.ibm.com/support/pages/db2-jdbc-driver-versions-and-downloads) still uses JDBC 4.1. Any rumours of, if a later fixpak will switch to ...
1
vote
0
answers
161
views
Is there a way to open an encrypted Oracle Database wallet through weblogic JDBC drivers?
I encrypted a column in an Oracle 12c database using the TDE method, The said column was being used in my application, The column becomes unavailable due to the Database wallet being closed.
To open ...
1
vote
0
answers
180
views
SQL JDBC upgrade from v6.0 to v7.2 causes java.lang.NullPointerException in *some* stored procedure returned recordsets
I am developing a java application onWindows 10 using Eclipse Oxygen and SQL JDBC v7.2 and java 1.8 update 202. My code runs fine when I use SQL JDBC v6.0 (sqljdbc42.jar Jan 2017 and java 8), but ...
1
vote
0
answers
715
views
Improve parallel running of bulk copy insert and stored procedures
I have a Java message listener, which upon receiving a message starts bulk inserting thousands of records into a table. After that it calls a few stored procedures sequentially that make some updates ...
1
vote
0
answers
105
views
How do Master / Slave JDBC URL handle broken MySQL Slave?
I own the following classical MySQL 5.7 set-up :
one master server
one slave server
The master => slave link is done though GTID. I'm monitoring the link by querying show slave status on the slave ...
1
vote
0
answers
2k
views
How to connect to Postgres on localhost with URL: "jdbc:postgresql://database:5432/db123"
I am able to connect to a postgres 10 instance on my local Win10 machine with pgAdmin 4 and "localhost" as a hostname, but when I change the hostname to "database" I cannot connect. How to fix it?
I'...
1
vote
1
answer
4k
views
timestamp with timezone issue with TZR vs TZH:TZM
I have a Hibernate with Oracle JDBC based application inserting/updating into the following column;
COLUMN_A TIMESTAMP WITH TIME ZONE DEFAULT systimestamp NOT NULL
but while it automatically appends ...
1
vote
0
answers
10k
views
org.postgresql.util.PSQLException: This connection has been closed. error for long running transactions
We are getting "org.postgresql.util.PSQLException: This connection has been closed." on one of our deployments for only long running transactions (more than a few minutes):
Caused by: org.hibernate....
1
vote
0
answers
2k
views
Oracle APEX 5.1 connect to remote db using JDBC and query data
I have only used db links to get access to remote db so far. Now I have to find a way to use JDBC to connect to remote db and get data. Can someone guide me what all things would I need to ask the ...
1
vote
0
answers
1k
views
Set table name to variable in postgresql
I am trying to set the tablename dynamically in a postgresql query executed through a jdbc connection. Here is my code:
PreparedStatement query1 = null;
Connection conn = null;
//...
1
vote
0
answers
2k
views
LISTEN/NOTIFY pgconnection goes down java?
I am using PostgreSQL DB and applying it's LISTEN/NOTIFY functionality. So my listener is at my AS (Application Server) and I have triggers configured on my DB such that when CRUD operations are ...
1
vote
0
answers
47
views
MySQL/JDBC: Can a commit on server get missed on client?
I am wondering about when conducting a transaction of one or two updates/inserts from a JDBC client to MySQL Server over the network...
In the event of losing the network during the commit, can I get ...
1
vote
0
answers
1k
views
sql taking < 1 sec to run in sql developer, 37 on the application side
As the title says, we have a big discrepency between a sql query we're running from our java application (jdbc thin client) and the same query run in sql developer.
I clear the cache of the query ...
1
vote
1
answer
807
views
oracle DB connection - hostdef extension doesn't exist
I am trying to connect to an Oracle DB through ERwin, yet I keep getting this error message:
I know that the DB exists, as my coworkers are accessing it. The Username and Password are also correct, ...
0
votes
0
answers
31
views
Why, MariaDB user allowed host IP address also allows a virtual machine on the host with NAT network adapter
The MariaDB user specifies an allowed IP address in the Host column of the mysql.user table. So, it only allows logging in from the host with the specified IP address. And MySQL has the same design.
...
0
votes
0
answers
62
views
JDBC connection to MariaDB over SSL/TLS
I have an application that I'm trying to connect to MariaDB with a JDBC driver over SSL. I have set the following parameters in the custom.cnf of my MariaDB server:
ssl_ca=/certs/ca-cert.pem
ssl_cert=/...
0
votes
1
answer
121
views
Execute Permission Denied on Stored Procedure using Microsoft JDBC Driver and Windows Authentication
I have a Microsoft SQL Server database that I use Stored Procedures to read/write data to through a Integration Engine in this case InterSystem IRIS.
Originally I was using a local server user to do ...
0
votes
0
answers
75
views
MySQL Connection String settings
I'm using the following options in my connection string:
autoReconnect true
autoReconnectForPools true
cacheCallableStmts true
cachePrepStmts true
useCompression true
useSSL true
...
0
votes
1
answer
714
views
Java PostgreSQL library seems to convert dates to local time zone automatically
PostgreSQL 14.6
Ubuntu 22.04
I am using postgresql-42.5.4.jar which I downloaded from pgJDBC. I use this library to get data from a database and display it on a website running locally. The web server ...
0
votes
1
answer
39
views
Oracle CACHE and STORAGE IN ROW behaviour
We have a Java Spring boot application that writes 20 million plus rows in a table with 2 blob columns in a batched manner into an Oracle 21c DB.
We are using JDBC batch insert for fast inserts.
...
0
votes
1
answer
2k
views
Unable to connect with JDBC after MySQL upgrade from 5.7 to MySQL 8.0
We use java application client to transfer database table data to a third party server. With MySQL 5.7 it was working fine. After upgrade to MySQL 8, it started to show errors. First thing we did was ...
0
votes
1
answer
52
views
NDB Cluster Read and Write Process multiple Access
When using the MySQL NDB Cluster distributed database, the following general problem has arisen: To insert a new Record / Row, the last row in the database should be read, see if it is compatible with ...
0
votes
1
answer
479
views
Why does my JDBC keep setting session variables?
I'm looking at the Performance Insights for MySQL Aurora on AWS and among the top queries I see:
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ
SET SESSION TRANSACTION ISOLATION LEVEL READ ...
0
votes
1
answer
2k
views
Unable to connect to an Oracle 12c Docker container
I'm working on a project with Oracle, and using a Oracle XE 11 container for testing. But recent developments have ended up with me running up against a brick wall: I need larger table names. ...
0
votes
1
answer
148
views
how do I use sa to access local sql server database with jdbc
I have a new local sql server database, running hypothetically on port 48000. In SQL Server Management Studio under the name of the computer\MSSQLSERVER01, Security, Logins I clicked sa, properties ...
0
votes
0
answers
1k
views
Slow insert on conflict do nothing for Postgres 13
I'have rather odd case.
I have a "cache" table in Postgres and I need to insert 100K - 1M records in parallel from different sources. Sources can try to insert duplicated data (by Primary ...
0
votes
0
answers
3k
views
PostgreSQL disconnection session time
I have a simple app which supports just GET & POST using JDBCTemplate, in tomcat configuration (context.xml) is set where it can find the Database like below:
<Resource name="jdbc/MYDB" auth="...
0
votes
0
answers
65
views
Oracle - Is it possible for the results of a transaction not to be visible to a subsequent transaction?
We're having a strange problem with a flaky integration test. This is using Java/JDBC against an Oracle 12 database. The test does this, in pseudocode:
transaction 1 {
insert into order (id, ...
0
votes
1
answer
67
views
Need a better way to insert non-existent values in referenced table during insert/update in referencing one
I'm looking for the best way to insert data into MariaDB with JDBC. Please take a look at the following schema
CREATE TABLE color (
id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(...
0
votes
0
answers
2k
views
Postgres Public Synonym Issue
PostgreSQL ver 9.4.5. Linux OS.
Application: Web Based
Platform:
App Server (java) --> jdbc call --> Database Server (PostgreSQL)
I do know that PostgreSQL does not support the public ...
0
votes
0
answers
2k
views
How to enable SSL in MySQL on Windows?
I'm a student doing a project which uses JDBC and MySQL (on Windows).
I have an application with connects to a MySQL server on a remote host.
To have a secure connection, I found this : http://www....
-1
votes
1
answer
502
views
executing SQL query with temp tables using 1.6jdk
I created a batch to run a query that has temp tables as the below example
IF OBJECT_ID ('tempdb..#TEMP1') IS NOT NULL
DROP TABLE #TEMP1
select *
into #TEMP1
from cutomer
IF OBJECT_ID ('tempdb..#...