Questions tagged [jdbc]

Java Database Connectivity (JDBC) is a Java standard that provides the interface for connecting from Java to relational databases.

Filter by
Sorted by
Tagged with
1 vote
3 answers
8k views

Query is slow with JDBC parameters, fast with concatenated SQL

I have an application that can be run with either mysql or SQL Server. There is a query that runs in a reasonable time on mysql, but is very slow on SQL Server. My application uses hibernate, but this ...
Dana's user avatar
  • 111
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 ...
BBSings's user avatar
  • 11
0 votes
2 answers
2k views

Can any database table name support double quotes "?

I need to know whether any database supports double quotes as a part of their table name. I am especially interested in JDBC compliant databases. And if they do, can I please know how?
Anish Sharma's user avatar
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 ...
A5300's user avatar
  • 111
5 votes
1 answer
10k views

Keep H2 in-memory database between connections

I create and use a H2 database in-memory (no writing to storage) for demos and quick tests using this code in Java: Connection conn = DriverManager.getConnection( "jdbc:h2:mem:example_db" ) ; This ...
Basil Bourque's user avatar
3 votes
2 answers
5k views

Are the MariaDB and MySql drivers interchangeable when connecting to a MySQL backend Aurora cluster?

I saw a similar question asked before but I didn't get enough supporting information Does anyone know any new information on this? Can MariaDB connector (driver) be used instead of the MySQL ...
Hariharan Thavachelvam's user avatar
1 vote
1 answer
2k views

Can the new “SCRAM-SHA-256” password authentication mechanism in Postgres 10 and later work with any JDBC drivers?

Postgres 10 added support for a new password authentication mechanism, Salted Challenge Response Authentication Mechanism (SCRAM-SHA-256, see RFC 7677). Discussed by Michael Paquier. ➥ Can this ...
Basil Bourque's user avatar
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 ...
Jérôme B's user avatar
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'...
ieXcept's user avatar
  • 111
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, ...
Pepijn Schmitz's user avatar
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 ...
buræquete's user avatar
3 votes
2 answers
5k views

Check Java Driver version in clients from Db2 server

I have a Db2 database that is being used by many applications in different servers. I want to check from the Db2 server if the Java driver used in the different client applications is up-to-date. Is ...
AngocA's user avatar
  • 575
0 votes
1 answer
311 views

Having multiple ResultSets in parallel on same connection.. Will it cause any problem? [Mysql/Postgres] [closed]

I have tried out the following in my local machine using jdbc/mysql: step 1: conn = getNewConnection step 2: stmt1 = "new statement" using connection 'conn' step 3: stmt2 = "new statement" using ...
Dinesh Kumar's user avatar
1 vote
1 answer
536 views

"Error while processing statement" running a query finding unique values with multiple values in other rows

Is there anything wrong in the syntax of this query finding unique values with multiple values in other rows? Select Distinct Ss.`cd`, Ss.`cd` From nit.assrr As Ss Join ( Select `cd` ...
William Humphries's user avatar
0 votes
1 answer
734 views

What if a connection closes in the middle of a commit?

I have a few large CSV files to upload to an instance of SQL Server.(Nope, can't use SSMS) I'm using JDBC to read the CSVs line by line and insert the lines in a table in batches. Supposing my code is ...
Kartik Sayani's user avatar
1 vote
1 answer
2k views

sql server query execution plan via jdbc driver

is there a way to fetch the XML generated by the "Actual Execution Plan" in SQL server 2012 - 2014, but via JDBC driver for Java -- sqljdbc_6.0.8112.100_enu? (preferable forward compatible with 2016) ...
Herman vereycken's user avatar
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....
nilgun's user avatar
  • 111
0 votes
1 answer
930 views

Polling SQL Databases [closed]

Is there any way to poll for MySQL database changes using JDBC? I need exactly which changes happened (not a simple yes/no). I tried using a thread which executes every 15 seconds to check whether my ...
Sundar's user avatar
  • 9
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 ...
Andrew Hangsleben's user avatar
1 vote
1 answer
2k views

The server's DateStyle parameter was changed to ISO. The JDBC driver requires DateStyle to begin with ISO for correct operation

I use PostgreSQL 9.6.6 on CentOS Linux 7.4 and after upgrading the postgresql-jdbc package - # sudo yum update Failed to set locale, defaulting to C Loaded plugins: fastestmirror Loading mirror ...
Alexander Farber's user avatar
2 votes
1 answer
6k views

Validation query

By default for Oracle Databases validation query is "select 1 from dual". Tomcat says: ValidationQuery - If specified, this query MUST be an SQL SELECT statement that returns at least one row. ...
Dmitresso's user avatar
  • 123
1 vote
1 answer
3k views

Is there a JDBC Driver for Microsoft SSAS Tabular Databases?

Is there a JDBC Driver for Microsoft SSAS Tabular Databases? Is so where can they be downloaded?
Edmund's user avatar
  • 703
7 votes
1 answer
17k views

How do I use the `COPY` command with JDBC

So I've been working with postgre databases and I noticed that it throws an error sometimes when I try to read a csv file and copy to a table remotely. It works perfectly when I use a buffered reader ...
JCole's user avatar
  • 73
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 ...
Bug On the Loose's user avatar
2 votes
1 answer
2k views

What is the new JDBC 4.3 Connection Request feature with `beginRequest` & `endRequest` methods?

The JDBC 4.3 update arrived with Java 9 2017-10. Amongst its few changes is the new feature on Connection where the beginRequest and endRequest methods signals… Hints to the driver that a request, ...
Basil Bourque's user avatar
3 votes
1 answer
5k views

Compression function in Postgres

Using Java & JDBC I am storing Strings into a JSONB column in Postgres. When inserting this works great. When retrieving values, I am running low on memory in Java because I am retrieving ...
sixtyfootersdude's user avatar
0 votes
1 answer
6k views

Database Wrapper Design issue: No operator matches the given name and argument type(s)

I'm building a wrapper for DB access using AWS' Lambda functions Java, the issue I'm having is that Lambda parameters are JSON, thus typeless, so all incoming params are de-JSON'd into Strings, and ...
Gonzalo Vasquez's user avatar
1 vote
1 answer
19k views

IO Error: Got minus one from a read call [closed]

I am very new with Oracle, I have installed 11g 64 bit on my Windows 10. And only started the oracle database using emctl start dbconsole. I have the following code to be connected to my database, ...
Yahya Hassanzadeh's user avatar
0 votes
2 answers
2k views

JDBC Connection on Current Primary Database After Switchover: ORA-01033 encountered

We are using Oracle Data Guard and currently testing Disaster Recovery scenarios, which is starting the application after switching over from the Primary Database to the Secondary Database. I am ...
Derek Carlos's user avatar
1 vote
1 answer
2k views

java.sql.SQLRecoverableException: No more data to read from socket

When I use java code to insert data to oracle,the following information appeared: java.sql.SQLRecoverableException: No more data to read from socket at oracle.jdbc.driver.T4CMAREngine....
user125604's user avatar
0 votes
1 answer
123 views

Disallowing MariaDB query cache except from webserver (JDBC)

I have an application server (Play Framework), webserver (Caddy), and database server (MariaDB with InnoDB) that are running on a single machine for now. The database is used in two ways: client ...
Douglas Myers-Turnbull's user avatar
3 votes
1 answer
7k views

Can I set PostgreSQL "stringtype=unspecified" behavior as default?

I am trying to get Hibernate to save Java enum fields as enum columns in PostgreSQL 9.6. If I map the fields as @Enumerated(STRING), Hibernate naively uses the enum name as the column contents. This ...
chrylis -cautiouslyoptimistic-'s user avatar
1 vote
1 answer
7k views

oracle 11g Grant on dbms_lock not persisting [closed]

I am using oewizard from swingbench to create an order-entry like schema on oracle 11g. When I run the wizard I get the following errors: ORA-01031: Cannot grant execute on dbms_lock to soe: ...
AjB's user avatar
  • 119
4 votes
1 answer
32k views

how to solve Invalid usage of the option NEXT in the FETCH statement [duplicate]

I am using jtds 1.2.2 driver with SQL Server 2008. Below is the query I tried to execute SELECT * from AM_API FETCH NEXT 10 ROWS ONLY Anyway after executing above query I got below error Caused ...
lakshman's user avatar
  • 263
6 votes
2 answers
6k views

datetime fractional seconds

I am reading the description of the datetime datatype from Sybase ASE 15.7 documentation: datetime columns hold dates between January 1, 1753 and December 31, 9999. datetime values are accurate to ...
Marcus Junius Brutus's user avatar
2 votes
3 answers
1k views

How do I cast varchar to macaddr without changing client code

I have a dedicated DB Server with Debian Jessie and Postgresql 9.4 Client: A is a Tomcat Java app which use torque with a JDBC driver connecting to the DB Server. Issue: on Updating a row with a new ...
Dennis Nolte's user avatar
1 vote
1 answer
205 views

Restrict executeQuery in Java from data manipulation in an Oracle database

I am developing a query browser in Java where I want to restrict users from manipulating data. So I am using executeQuery as I searched many questions and all are answered as executeQuery is used to ...
DnA's user avatar
  • 111
1 vote
1 answer
524 views

How to achieve federation using JDBC?

I want to achieve federation using following commands through JDBC. connect to SIGCAP_M user db2sigcp using db2sigcp ; drop wrapper drda; create wrapper drda ; UNCATALOG NODE XYZ; CATALOG TCPIP ...
shivrajk's user avatar
2 votes
1 answer
2k views

Postgresql on AWS RDS JDBC Connection Refused, psql connection succeeeds

I have an Amazon RDS Postgres instance running. I can see the data from my local machine (whitelist office IP) and our web app can connect (running on EC2 instance). On that EC2 instance, these ...
clay's user avatar
  • 131
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; //...
toing_toing's user avatar
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 (...
Air's user avatar
  • 171
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(...
humkins's user avatar
  • 207
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 ...
Siddharth Trikha's user avatar
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 = "...
user824276's user avatar
1 vote
1 answer
65 views

How monitor TEMP space allocation for a particular object type like Clob\Blob

I am new to Oracle and i wanted to know if there is a way to monitor Clob\Blob objects allocation in Oracle Temp Space. With JDBC 4.0, we have clob.free() and blob.free() methods and i want a way to ...
VishalDevgire's user avatar
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 ...
knowledge's user avatar
  • 121
1 vote
1 answer
6k views

DB2 SQL error: SQLCODE: -805, SQLSTATE: 51002

I am doing a batch process which fetches rows from table 50000 times. The query is: SELECT * FROM <table name> WHERE <condition; this changes for each iteration(50000)> This batch ...
padippist's user avatar
  • 113
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 ...
Mark Meyers's user avatar
0 votes
1 answer
1k views

SQL Server doesn't send intermediate SSL certificates

I am connecting to SQL Server (2008 R2) over open Internet and properly encrypting the connection is essential. I have COMODO certificate with two intermediate certificates between root CA and server ...
Robert Važan's user avatar
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 ...
scott's user avatar
  • 71