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
13 votes
2 answers
8k views

To what extent is MariaDB Java client a perfect replacement for MySQL JDBC (Connector/J)?

Premise: I ship a Java application which will make a JDBC connection to a MySQL database. (At the time of this writing it could be 5.1 or 5.5, but hopefully the question and answer don't rely heavily ...
mdahlman's user avatar
  • 347
12 votes
1 answer
2k views

Disable explicit commits in JDBC, detect them in SQL, or put the database in a readonly state

Background: I'm working on http://sqlfiddle.com (my site), and am trying to prevent one avenue of abuse possible there. I'm hoping that by asking about a problem I'm currently addressing, I don't ...
Jake Feasel's user avatar
11 votes
3 answers
14k views

Insert Speeds for large batches

In my application, my INSERTs seem to be taking a major chunk of the time. I have a large number of objects in memory (~40-50,000) which i want to insert into a table. Lets take a sample table ...
Aditya's user avatar
  • 211
10 votes
4 answers
48k views

Why does MySQL say I'm out of memory?

I was trying to execute a fairly large INSERT...SELECT in MySQL with JDBC, and I got the following exception: Exception in thread "main" java.sql.SQLException: Out of memory (Needed 1073741824 bytes) ...
Michael McGowan's user avatar
7 votes
2 answers
7k views

Is there any way to retrieve "Messages" in SQL Server through JDBC?

By "Messages" I mean the Messages tab in the following figure, which includes "Warning", "n rows affected" and in the figure below, the execution time. In JDBC, ResultSet class is used to retrieve the ...
zli89's user avatar
  • 907
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
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
6 votes
4 answers
18k views

Why decrease the wait_timeout configuration parameter in MySQL?

Question I'm working on an application that uses a connection pool in Apache Tomcat to communicate with MySQL. I was wondering why would you want to use a smaller wait_timeout than the default of 28,...
Usman Mutawakil's user avatar
6 votes
1 answer
30k views

Connection Reset by Peer: Socket Write Error

We have a vendor working on Java (JDBC) application saying they are getting the error Connection Reset by Peer: Socket Write Error They are insisting that the SQL Server (SQL Server 2012) is ...
SomeGuy's user avatar
  • 1,973
5 votes
2 answers
24k views

JDBC local MSSQL Server connection string

I have installed open source database management tool "dbeaver" and want to use it instead of Sql Server Management Studio. But there is a problem. I searched from the internet but somehow I could not ...
Omer's user avatar
  • 433
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
5 votes
2 answers
14k views

Session in "Sql*net message from client", but is active

I've Googled around, and my impression is that Sql*net message from client suggests the Oracle DBMS is waiting for the client to send new commands to the DBMS, and therefore any time spent in ...
RAY's user avatar
  • 191
5 votes
1 answer
1k views

Replacing a large object in PostgreSQL

What should one do when one wishes to replace a large object with a new large object. An example would be to update an uploaded file with a new version. One way would presumably be to create a new ...
beldaz's user avatar
  • 1,680
5 votes
3 answers
13k views

How to separate out individual sql statements from Oracle SQL script for execution from java code

I have Oracle DB 11g Enterprise Edition and I want to execute sql script from my java code. I am reading this sql script from a .sql file and the script contains statements such as create table, ...
Learner's user avatar
  • 151
5 votes
1 answer
2k views

Using SELECT to call a function in a jdbc migration

I'm looking to set up some Postgres/PostGIS migrations with clojure/jdbc. running side-effect functions with SELECT is proving to be an issue, with most migration libs eventually throwing the A ...
user3276552's user avatar
5 votes
2 answers
2k views

MySQL overhead of calling a Stored Procedure

Within Java, we access MySQL (v5.5.40) via JDBC -- a prepare statement, setting parameters then calling the stored procedure. It appears that every execute() has the overhead of 4 meta-calls (per ...
Slawomir's user avatar
  • 453
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 ...
Roberto Linares's user avatar
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
4 votes
2 answers
18k views

Configuring sqlnet.ora and tnsnames.ora on the client side

I have an application server talking to an Oracle database, using the Oracle instant client. We are troubleshooting a specific bug, and it was asked if I could add the following flags to to my sqlnet....
edinor's user avatar
  • 143
4 votes
1 answer
3k views

What do these parameters mean at the beginning of my SQL Server query plan?

I'm looking at query plan in SQL Server Mgmt Studio and I see something like this: (@P0 nvarchar(4000), @P1 nvarchar(4000)) Update... What does the type mean beside the parameters? For this example ...
Stephen__T's user avatar
4 votes
1 answer
33k views

Retrieving data from inner join using LIMIT and OFFSET

These are my two tables: table1 qid[PK] |gid[PK] |abcd | xyz | date ---------------+---------+---------+------+------------ 00001 | qwe | 54 | a | 1994-11-29 00002 ...
Ashwin's user avatar
  • 272
4 votes
1 answer
907 views

Access operator added by extension inside a schema

I am writing an application that uses postgres. Each microservice uses its own schema inside the database. So connect to the database schema I use this jdbc string: jdbc:postgresql://${db.host}/${db....
Patrick Cornelissen's user avatar
4 votes
3 answers
3k views

SET ROLE via parameterized query

In the very helpful response I received to a previous question, I am trying to write some JDBC code that first sets the role to a specific user before executing subsequent queries. On the safe side I ...
beldaz's user avatar
  • 1,680
4 votes
4 answers
4k views

Oracle 11g delete by unique key slow

We have been plagued by a deadlock issue for quite some time that relates to deletes and inserts on the same table. It happens sporadically, but had been increasing in frequency. It would manifest ...
Philip Tenn's user avatar
4 votes
1 answer
5k views

Proxy authentication for PostgeSQL

The following seems likely to be a fairly common situation, but I haven't seen any solutions. I have a PostgreSQL database containing views that are specific to the $user, in order to restrict data ...
beldaz's user avatar
  • 1,680
4 votes
1 answer
5k views

How does Sybase store datetime information?

We have a Sybase database that currently stores datetime values in some of the tables. If we move that server with the Sybase database to another country which is in another time zone, will the ...
Jasper Citi's user avatar
4 votes
2 answers
2k views

Database-agnostic stored procedure call passing array of name/value pairs

Background Looking to pass a set of name/value pairs into a stored procedure in a database-agnostic way, using JDBC. A database structure is defined as follows: CREATE TYPE array_parameters AS ( ...
Dave Jarvis's user avatar
3 votes
2 answers
3k views

Does Postgresql support different transaction isolation per connection?

I just discovered that H2 doesn't support concurrent connections using different transaction isolation levels. Meaning, changing the transaction isolation of one connection affects all other ...
Gili's user avatar
  • 999
3 votes
1 answer
1k views

Are there any good database management applications for JDBC/Java databases?

I am working with an Apache Derby/JavaDB database via JDBC. Before have I been working with MySQL and used phpMyAdmin as a good Database Management tool. Is there any good desktop application for ...
Jonas's user avatar
  • 32.6k
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
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
3 votes
1 answer
2k views

How to set IP segment and connection string with IPv6?

For this PostgreSQL configuration example: https://repmgr.org/docs/4.4/quickstart-authentication.html local replication repmgr trust host replication ...
rawmain's user avatar
  • 309
3 votes
1 answer
860 views

Does it make sense to upgrade to a newer PostgreSQL JDBC driver?

I would like to know if it could be possible to gain any performance benefits from upgrading the default PostgreSQL JDBC drivers from applications like Confluence or JIRA. Assume that you cannot ...
sorin's user avatar
  • 1,212
3 votes
1 answer
15k views

Oracle 11g hunting down the deadlock, maybe foreign key?

I am trying to understand why a deadlock occurs in my database. The trace tells me that two updates on the same table are locking. In table is the first table to be written to in an transaction, only ...
Franz Kafka'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
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
3 votes
2 answers
976 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
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
3 votes
2 answers
146 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 ...
Daniel Paczuski Bak's user avatar
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 ...
mhbrooks's user avatar
  • 131
3 votes
1 answer
35k views

JDBC pooling Oracle driver Socket read timed out [duplicate]

I run Java EE application on Glassfish server v3 together with Oracle 12 DB on the same machine under Windows Server 2012 64bit. I use latest ojdbc7 driver. Connection pool config: <jdbc-...
karolkpl's user avatar
  • 131
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 (...
Piero van Oordt'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
2 votes
1 answer
350 views

Accurate PG database size for comparing representations

I have a Java/JDBC program that takes a sample file and imports the data into the database, shredding it across multiple relations. The program does this multiple times for several different ...
beldaz's user avatar
  • 1,680
2 votes
1 answer
3k views

jdbc: does setAutoCommit(true) commits past executions?

I would like to execute some statements, and commit the entire batch at the end. I've tried the following approach: connection.setAutoCommit(false); // Don't commit for each statement int[]...
Adam Matan's user avatar
  • 11.5k
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
2 votes
3 answers
1k views

Transaction Isolation level different threads massive number of Writes

I have a lot of threads that writing to DB some data in two tables. tbl_raw_data and tbl_parsed_data where tbl_parsed_data have foreign key to tbl_raw_data. I also need the writing to be superfast. ...
yossico's user avatar
  • 167
2 votes
2 answers
22k views

Connect to Postgresql 9.2 from Eclipse Data Tools Platform

GOAL: My goal is to write sql code within Eclipse to query a Postgresql database. The reason I want to write my queries within Eclipse is to then write R or Python code to perform statistical analysis ...
David Kulpanowski'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
2 votes
2 answers
1k views

Oracle instant client

What is the difference between instant client and the original Oracle client? The Oracle client is almost 800MB and the instant client is not so much. I need to install oracle client, ODBC drivers and ...
tesla747's user avatar
  • 1,876