Questions tagged [jdbc]

11373 questions
1

votes
0

answer
174

Views

Pentaho Login Error using LDAP/JDBC Hybrid configuration

I've followed Pentaho (version 7) documentation on how to set LDAP/JDBC hybrid configuration: created the tables and filled them with the appropriate values then updated the configuration files as instructed. When trying to login to the PUC the following error is thrown: java.util.concurrent.Execu...
jamal_lib
1

votes
1

answer
180

Views

java.io.FileNotFoundException: (Access is denied) AND Cast Issue

When I am trying to save/update a file, I am getting the following errors 1/Error1: When I m trying to Update my User information , it appears this issue Part filePart = request.getPart('image'); InputStream inputStream = null; // input stream of the upload file if (filePart != null) { // prints o...
Emna H-B
1

votes
1

answer
261

Views

insert into select vs bulk insert

I have a table A, about 400k rows one day, I want to write java program to back up old data to another table, there are two ways: use jdbc to fetch data from table A, 500 rows one time for example, then concatenate sql like insert into table B values(value1, value2...),(value1, value2...),... then e...
hiway
1

votes
0

answer
225

Views

declaredParameters versus addDeclaredParameter SimpleJdbcCall

So I'm working with an Oracle database and a function as opposed to a stored procedure. I figured this was no big deal and carried on as I had with all my previous DAO's created for the stored procedures. This did not work. The difference is demonstrated below. Here's the function setup that works f...
Mike
1

votes
2

answer
920

Views

Kafka - ERROR Stopping after connector error java.lang.IllegalArgumentException: Number of groups must be positive

Working on setting up Kafka running from our RDS Postgres 9.6 to Redhift. Using the guidelines at https://blog.insightdatascience.com/from-postgresql-to-redshift-with-kafka-connect-111c44954a6a and we have the all of the infrastructure set up, and am working on fully setting up Confluent. I'm gett...
dragos_kai
1

votes
1

answer
306

Views

How to resolve NoClassDefFoundError for AutoloadedDriver40? [duplicate]

This question already has an answer here: Why am I getting a NoClassDefFoundError in Java? 21 answers I am new to Hadoop and Hive as well. I am trying to connect to Hive from Java by creating Java project and by adding all below required libraries $HIVE_HOME/lib/*.jar $HADOOP_HOME/share/hadoop/mapr...
Tharunkumar Reddy
1

votes
1

answer
30

Views

Batch execution is not happening for deletion operation

I am trying to delete rows from the database as a Batch update operation. I have written the below method to accomplish the task but when i execute, It does not delete the entries from the table. So the table remains the same. Please let me know if there is any bug in the code. public void removeFr...
1

votes
2

answer
497

Views

Connect to Sql Server on liberty using mssql-jdbc

I'm trying to connect to a Sql Server database from a liberty server. Doesn't work as I'm getting a 500 from the liberty server and the logs give me this error message: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: SQL Server...
mTv
1

votes
1

answer
443

Views

Cannot connect to MySql database from Eclipse : java/sql/SQLException

I have set up a database with MySql. I want to connect to it from Eclipse. I followed the same steps as mentioned in this link: https://www.zkoss.org/wiki/Setup_MySQL_DB_in_Eclipse So I am using this library for the driver: mysql-connector-java-5.1.45 whhich I think is correct The name of my databas...
bretondev
1

votes
1

answer
1.2k

Views

Downloading 7.0.7 - jconn-7.0.7.jar

I am trying to download jconnect-7.0.7.jar for Sybase Database from this URL [http://downloads.sybase.com/][1]. But getting error like the site is down. I searched a lot, but cannot find the jar anywhere. Could anyone let me know where I can get the jar?
Kavitha
1

votes
1

answer
74

Views

Query with NOW() in criteria behaves differently in psql vs. JDBC

I am executing following query in psql via console and getting output : select details from history_transactions ,history_operations where history_operations.transaction_id = history_transactions.id and type = 3 and created_at >= NOW() - INTERVAL '5 minutes' However when I call this code from my jav...
sweta
1

votes
1

answer
518

Views

How to specify Trust store and trust store type for Spark JDBC connection

I am new to Spark and we are currently using the spark-java to create orc files from Oracle database. I was able to configure the connection with sqlContext.read().jdbc(url,table,props) However, I couldn't find any way in the properties to specify the trustStore or trustStoreType. Can someone help...
Sai Kumar
1

votes
1

answer
215

Views

Oracle 1.8 CachedRowSet.populate error where select systimestamp from dual

I have a simple question... Why this code below is not working? JDK version: 1.8.0_92 Oracle DB version: 11.2.0.1.0 Oracle JDBC driver: ojdbc6.jar ---> I could not find this java code source :( String SQL = 'select systimestamp from dual'; Statement statement = null; ResultSet rs = null; try { sta...
Jefferson
1

votes
1

answer
64

Views

String value to PrepareStatement for TimeStamp comparasion

SELECT data from table using WHERE clause for TimeStamp. I would like to set a String value retrived from TextField to show filtered table. NOT WORKING: public ResultSet queryAlarms() throws SQLException String sql = 'SELECT * FROM BDCS.dbo.Alarms WHERE AlarmTime > ?'; PreparedStatement ps = connect...
einHarJar
1

votes
3

answer
272

Views

Kafka JDBC Connect query causes ORA-00933: SQL command not properly ended

I have this Oracle SQL query: SELECT * FROM (SELECT SO_ORDER_KEY,QUEUE_TYPE,SYS_NO, DENSE_RANK() OVER (PARTITION BY SO_ORDER_KEY ORDER BY SYS_NO DESC) ORDER_RANK FROM TSY940) WHERE ORDER_RANK=1; When running in SQL developer, it returns the desired result. For some reason when I use this query in...
Alex
1

votes
0

answer
71

Views

PSQLException index out of bound

I can't figure out why my PreparedStatement is throwing an error. Here is my function: public boolean updateMail(int id, String new_mail, boolean showMail) { String login = ''; String toUpdate = ''; boolean ret = false; try { req = cnx.prepareStatement('SELECT login FROM compte WHERE id = ?'); req.s...
M. Ozn
1

votes
0

answer
286

Views

Default Row Prefetch property is not working on connection object

I want to specify the number of rows to prefetch for connection pool object using connection properties to override the default row prefetch size (10). I have set the connection properties as mentioned below, but it is not reflecting while executing the query. Please check and let us know the solut...
yadam suresh Chand
1

votes
0

answer
182

Views

JDBC DB2 Driver Timer Threads stuck in BLOCKED state

I have a Java application hanging indefinitely, intermittently till the server is restarted Looking at thread dumps, I have no clue why one of the TimerThread is spin up by underlying JDBC DB2 driver and goes into BLOCKED state and Tomcat Thread goes into WAITING state The Timer thread 'Timer-140423...
JavaHopper
1

votes
0

answer
663

Views

java.lang.OutOfMemoryError: Java heap space when transferring data from jdbc to elasticsearch via logstash

I have a huge postgres database with 20 million rows and i want to transfer it to elasticsearch via logstash . I followed the advice mentioned here and I test it for a simple database with 300 rows and all things worked fine but when i tested it for my main database i allways cross with error: nar...
Fatemeh Moh
1

votes
0

answer
170

Views

Avoid Deadlock with MySQL ON DUPLICATE KEY UPDATE Spring JDBC

I am having some trouble avoiding deadlocking when doing an 'upsert' via Spring Boot/JPA and MySQL. I am calling the method in my service layer asynchronously so it is possible that a single request can call the upsert multiple times concurrently and I can also have many requests coming in concurren...
Gremash
1

votes
0

answer
49

Views

Insert April 1, 2017 into MySQL database using JDBC results in March 31, 2017

First I will just note that the server and database are both setup for the EST timezone. I say this because I see lots of comments about issues if the timezones are different, they are the same. That being said my code: LocalDate localDate = LocalDate.of(2017, 04, 01); java.sql.Date databaseDate = j...
Stephane Grenier
1

votes
2

answer
972

Views

Oracle stored procedure java.sql.SQLException: Invalid column type: 2012 (REF_CURSOR)

Oracle 11g, Java 8, ojdbc8/ojdbc7 stored procedure with OUT REF_CURSOR, e.g., create or replace procedure foo(employeeId IN number, c OUT SYS_REFCURSOR) AS BEGIN open c for select * from Employee where id = employeeId; END; From sqlplus, it works fine. JDBC call the procedure: CallableStatement stat...
Sunnyday
1

votes
1

answer
222

Views

Appropriate way to pass a dataset to Java from Oracle PL/SQL

I need to pass datasets from Oracle to Java through JDBC. How is it better to organize it so that everything works well and it would be convenient both for Java developers and PL/SQL developers to maintain the code in case of changing, for example, table column types? I see such variants: Pass the s...
archjkee
1

votes
1

answer
203

Views

GENERATED ALWAYS AS IDENTITY produces incorrect table schema with UCanAccess

I'm writing a program using JDBC/UCanAccess and I'm finding when I create one of the tables, instead of creating four columns with the DateTime format, it also applies the same format to the next column, displacing the other formats: CREATE TABLE Person ( Id INT NOT NULL PRIMARY KEY GENERATED ALWAYS...
user9380548
1

votes
0

answer
48

Views

sqlite JDBC metadata.getPrimaryKeys return info of foreign keys

sqlite JDBC metadata.getPrimaryKeys return info of foreign keys. e.g., create table Foo (id integer, bar_id integer, primary key(id), foreign key (bar_id) references Bar(id)) JDBC: DatabaseMetaData databaseMetaData = connection.getMetaData(); ResultSet rs = databaseMetaData.getPrimaryKeys('c:/test...
Sunnyday
1

votes
0

answer
462

Views

How to properly store and retrieve a microsoft word document from mysql database using Java in Netbeans

This is my sample design I have successfully stored a microsoft word document in my sql database (using longblob) using this code below: Attach button code: JFileChooser chooser = new JFileChooser(); chooser.showOpenDialog(null); File f = chooser.getSelectedFile(); String filename = f.getAbsolutePat...
Feljorim Dumoran
1

votes
0

answer
164

Views

jdbc driver Android studio net.sourgeforge.jtds.jdbc.Driver

I've been sitting with this problem for 2 weeks now and I hope 1 of you can help me with this. The following code I have for connecting with out database. package com.example.sunapp; import android.annotation.SuppressLint; import android.os.StrictMode; import android.util.Log; import java.sql.Conne...
Bellie
1

votes
2

answer
787

Views

IBM i DB2 JDBC Encryption using SSL

Remote server is an IBM i (7.1) with DB2 installed on it. I am trying to connect to this remote db2 database on IBM i machine via JDBC encrypted link using SSL from my windows machine, I am using jt400-6.7.jar. I can see that SSL is correctly configured on IBM i machine as I see the following in Dig...
yin yang
1

votes
0

answer
637

Views

org.h2.jdbc.JdbcSQLException: Column “column_name” not found

I have 3 entities: Order, Product and Consumer: @Entity @Table(name = 'PRODUCT') public class Brick { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @ManyToOne(fetch = FetchType.LAZY) Order order; // ... getters & setters } @Entity @Table(name = 'CONSUMER') public class Consume...
deviana
1

votes
0

answer
313

Views

Spring session jdbc with postgresql

I've got a springboot application and I'm trying to configure it to use spring jdbc session with a postgresql database. It works but: On application startup, it creates automatically tables and indexes in public schema, what is wrong. I've got already created both spring_session and spring_session_a...
cape
1

votes
0

answer
96

Views

Log4j JDBC with Apache Storm 1.0.1 not writing log statements

I am having issues using Log4J2 (2.1) in storm (1.0.1) with logging to jdbc appender. I have been following the Microsoft HDInsight doc Apache Storm develop java topology. Additional factors include using the Microsoft EventHubs (1.0.2) library for EventHubsSpout configuration, which have tended t...
Ben
1

votes
1

answer
378

Views

Proper Setup of jaybird/Firebird DataSource with HikariCP

I'm trying to build a successful connection to a Firebird DB running on Windows using Spring Data JPA, Hibernate and a HikariCP Connection Pool. I have gotten everything to run correctly on other JDBC compliant DBs (H2, Derby, MySQL, etc.) but when I switch my driver .jar over to Firebird I get: Ex...
blyons
1

votes
1

answer
264

Views

How best to handle Constraint Violations in Spring JDBC

What is considered the best/most correct way to handle a Constraint Violation in Spring JDBC? As a real example. I've got a users table that contains, amongst other things, columns of url_slug and email. Both of these are UNIQUE. When creating a new record, or updating an existing record, if I try t...
Graham
1

votes
1

answer
981

Views

Unable to connect to SQL Server via SSL using Spring JDBC

I'm trying to connect to SQL Server using from our application which uses Spring JDBC 4.2.5 release. We have the following settings: SQL Server - Is set to require SSL. In the application we have the following connection url: jdbc:jtds:sqlserver://;databaseName=;instance=;encrypt=true;trustServerCer...
apandey
1

votes
0

answer
19

Views

Set JDBC properties on play-framework application.config

I'd like to set some JDBC properties on the application.config. For example: useLegacyDatetimeCode=false&useUnicode=true&serverTimezone=UTC And this is my application.config. play { db.prototype.hikaricp { connectionTimeout = 30 seconds maximumPoolSize = 5 } } db { default { driver='org.mariadb.jdb...
kalin
1

votes
1

answer
222

Views

Oracle with PKI

I am trying to connect to Oracle using PKI. I follow this link http://www.oracle.com/technetwork/topics/wp-oracle-jdbc-thin-ssl-130128.pdf public static void main(String[] args) throws Exception { Class.forName('oracle.jdbc.driver.OracleDriver'); String addr = 'DESKTOP-BH1RKUF'; String service = 'or...
RMS User
1

votes
0

answer
655

Views

Set correct time zone for data from jdbc connection in Spring Boot microservice

In my Spring Boot microservice I have jdbc connection configured to MSSQL database. There are about 10 different queries and among the fields there are some timestamps. The server is located in Switzerland, all timestamps are in Swiss time. My service need to return UTC time but all data I get from...
Vitalii
1

votes
0

answer
139

Views

Java String insertion to MySQL field of type MEDIUMTEXT

I'm taking a string and inserting it into a mySQL database field of type MEDIUMTEXT. When I print it out, there is a bunch of '-' characters and whitespace surrounding a slightly corrupted version of my original text. Am I doing this wrong? Class.forName('com.mysql.jdbc.Driver'); Connection con =...
Moondaws1
1

votes
2

answer
989

Views

Cant connect to Mysql database from pyspark, getting jdbc error

I am learning pyspark, and trying to connect to a mysql database. But i am getting a java.lang.ClassNotFoundException: com.mysql.jdbc.Driver Exception while running the code. I have spent a whole day trying to fix it, any help would be appreciated :) I am using pycharm community edition with anacond...
rakesht
1

votes
0

answer
353

Views

Save entity with java.time.Instant property using NamedParameterJdbcTemplate with postgres driver

I am having issues saving my entity that has a Instant value using the NamedJdbcTemplate. I receive the exception listed below and I am trying to determine the best way to resolve this. Please advise. Can't infer the SQL type to use for an instance of java.time.Instant. Use setObject() with an expli...
Jesse Nelson

View additional questions