Questions tagged [java]

Use ONLY if Java is directly relevant to the question and likely to be the source of your problem, not just because you're using a Java library to connect to a database. Java is an object-oriented language and runtime environment. Java programs can run unchanged on most platforms in a Virtual Machine called the JVM. If you have a general programming question about Java, please ask it on Stack Overflow instead.

Java is a programming language and runtime environment which allows programs to run unchanged on most platforms.

Most questions about Java should be directed to Stack Overflow, but if the question is more about using Java to access a database or using Java from within a database, then it could be on topic here.

Background

Java was originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM) regardless of computer architecture. Java is a general-purpose, concurrent, class-based, object-oriented language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java is currently one of the most popular programming languages in use, particularly for client-server web applications, with a reported 10 million users.

Principles

There were five primary goals in the creation of the Java language:

  1. It should be "simple, object-oriented and familiar"
  2. It should be "robust and secure"
  3. It should be "architecture-neutral and portable"
  4. It should execute with "high performance"
  5. It should be "interpreted, threaded, and dynamic"

Versions

Major release versions of Java, along with their release dates:

JDK 1.0 (January 23, 1996)
JDK 1.1 (February 19, 1997)
J2SE 1.2 (December 8, 1998)
J2SE 1.3 (May 8, 2000)
J2SE 1.4 (February 6, 2002)
J2SE 5.0 (September 30, 2004)
Java SE 6 (December 11, 2006)
Java SE 7 (July 28, 2011)
Java SE 8 (March 2014)
Java SE 9 (September 2017)
Java SE 10 (March 2018)
248 questions
13
votes
1 answer

MySQL Commited data not seen to select query

Context: The framework used is Spring and all queries are run with JdbcTemplate. Mysql Server version is 5.6.19. The table is an InnoDB table and defaults like auto commit and isolation level repeatable-read is set. Problem: An Insert happens…
Ahmed Aeon Axan
  • 131
  • 1
  • 7
11
votes
3 answers

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 CREATE TABLE bill ( id BIGINT(20) PRIMARY KEY, amount…
Aditya
  • 211
  • 1
  • 2
  • 5
10
votes
2 answers

Add function parameter to SQL query WHERE clause

I have a web application in java and it uses a query. I don't want to write the query into Java, so I made a function: CREATE OR REPLACE FUNCTION testFunc(inputs text) RETURNS TABLE(...) AS $$ SELECT .... FROM ... JOIN ... where true …
Hans
  • 239
  • 1
  • 3
  • 9
10
votes
1 answer

Do Oracle databases use Java internally?

My question is fairly simple. Is Java used internally by Oracle in their DBMSs?
Boris Pavlović
  • 203
  • 2
  • 7
9
votes
1 answer

How to UPDATE a SQLITE Column with an INNER JOIN on TWO FIELDS

How can I translate this query to SQLite: UPDATE Table_1 INNER JOIN Table_2 ON (Table_1.Field1 = Table_2.Field1) AND(Table_1.Field2 = Table_2.Field2) SET Table_1.Field3 = Table_2.Field3 This is what I have tried. UPDATE Table_1 SET Field3 =…
NetCollector
  • 93
  • 1
  • 1
  • 3
9
votes
2 answers

Why does Oracle use a different byte length than java for the supplementary unicode character chipmunk?

I have java code trimming a UTF-8 string to the size of my Oracle (11.2.0.4.0) column which ends up throwing an error because java and Oracle see the string as different byte lengths. I've verified my NLS_CHARACTERSET parameter in Oracle is…
agradl
  • 211
  • 2
  • 6
8
votes
1 answer

Return ResultSet with column names from functions

I have the following postgresql Function: CREATE OR REPLACE FUNCTION readMessage(messageFor INT, qid INT = NULL, ctxt INT = NULL, messageFrom INT = NULL, byTimeStamp BOOLEAN = FALSE) RETURNS SETOF message AS $$ DECLARE sql varchar; BEGIN sql…
gjain
  • 183
  • 1
  • 4
8
votes
3 answers

Bulk database update/insert from CSV file

I am implementing application specific data import feature from one database to another. I have a CSV file containing say 10000 rows. These rows need to be inserted/updated into database. There might be the case, where couple of rows may present in…
Narendra Verma
8
votes
2 answers

Oracle 11g: performance improvements of inserts

I have a table of 500 millions of rows (and growing) I did the following to improve performance of inserts: On database side: dropped all indexes and constraints disabled logging On application side: switched from JPA managed entities to native…
adrift
  • 375
  • 2
  • 4
  • 8
7
votes
2 answers

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 "Results". Is there any way to get all the…
zli89
  • 917
  • 2
  • 11
  • 18
7
votes
3 answers

How to view contents of table in mysql-workbench

Hi everyone am fairly new to mysql, I made a java program that stores data in mysql database. I am using this tool called mysql-workbench that can create databases, tables and much more. What I wanted to do is to view all the contents of the table I…
dimas
  • 171
  • 1
  • 2
  • 5
6
votes
2 answers

Postgresql 9 speeding up indexed inserts (JPA)

I have an application which generates a lot of data which needs to be inserted quickly (something around 13million records). I use JPA 2.0/Hibernate with Postgres 9.1, and I managed to achieve quite a good performance (around 25k inserts per second)…
6
votes
1 answer

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 works the first time, but then the database seems…
Basil Bourque
  • 11,188
  • 20
  • 63
  • 96
5
votes
1 answer

duplicate key violates unique constraint when using multi-threading

I am using ExecutorService with a fixed thread pool of 50, and a fixed database connection pool of 50, using HikariCP. Each worker thread processes a packet (a "report"), checks if it is valid (where each report must have a unique unit_id, time,…
JohnMerlino
  • 1,939
  • 5
  • 20
  • 21
5
votes
3 answers

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, create type, alter table, drop type, drop procedure,…
Learner
  • 151
  • 1
  • 1
  • 2
1
2 3
16 17