Questions tagged [apache-commons-dbutils]

Apache Commons Dbutils is a toolkit that simplifies the usage of the Java Database Connectivity (JDBC) API.

Apache Commons DbUtils is a component of the Apache Commons project. Apache Commons DbUtils is library that simplifies JDBC programming and is open source software distributed under the Apache License, Version 2.0.

86 questions
0
votes
1 answer

How can I make my java code compatible with all the tables in database from which I need to extract the data and then writing it back to Excel file

There is a database (northwind) on my machine and I have to write a code in java so as to extract the data from the table (Customers) stored in the database. If this was only specific to Customers table then I would have done it but I want to make…
Shahroz Saleem
  • 109
  • 1
  • 10
0
votes
0 answers

Apache dbutils Java cannot get String value

QueryRunner qr = new QueryRunner(C3P0Util.getDataSource()); qr.update("DELETE FROM course_access " + "WHERE user_id = ? " + "AND course_id NOT IN (?)", user_id, courseIdList); String user_id = "2" String…
EastLord
  • 1
  • 3
0
votes
1 answer

Apache DBUtils QueryRunner returning ids from wrong column in insert

I am using Apache DBUtils Long rowId = queryRunner.insert(sql, new ScalarHandler(), params); My table schema is CREATE TABLE abc ( userid bigint, api_key text, key_id integer NOT NULL DEFAULT…
user4906240
  • 605
  • 1
  • 6
  • 20
0
votes
0 answers

batch insert to two tables with relation and auto id

I have two tables: CREATE TABLE transaction ( id bigserial PRIMARY KEY, transactiondataid bigint, baseamount integer, pricelistamount integer, trxamount integer, ... ); CREATE TABLE transactiondata ( id bigserial PRIMARY KEY, …
badera
  • 1,495
  • 2
  • 24
  • 49
0
votes
1 answer

Where does this query comes from?

I have a web application that runs in Tomcat, it connects to a Oracle DB through a DataSource. I've been dealing with some weird behavor, because the connection pool gets full even if there are no users connected and as soon as the application…
0
votes
1 answer

Getting an exception when query oracle with Dbutils

Codes: QueryRunner queryRunner = new QueryRunner(); connection = JdbcUtils.getConnection(); String sql = "SELECT id,name,address,phone FROM customer WHERE name LIKE ?"; List list = queryRunner.query(connection,sql,new…
lteagle
  • 1
  • 1
0
votes
0 answers

Unable to execute Mysql query using DButils and Datasource

I am unable to execute Mysql query using datasource along with DButils This is my datasource class package com.log.in; import java.io.FileInputStream; import java.io.IOException; import java.sql.SQLException; import java.util.Properties; import…
ath j
  • 347
  • 2
  • 12
0
votes
0 answers

name matching with escape sequence in commons dbutils

I am using dbutils QueryRunner on a product table to get (ID, Name) from the table where the query is as follows: select ID, NAME from PRODUCT where NAME LIKE ? LIMIT 5; I am getting ERROR 203 (22005): Type mismatch. BOOLEAN for null Query while…
Mouzzam Hussain
  • 449
  • 3
  • 8
  • 20
0
votes
1 answer

Commons DBUtils Oracle 11g Prepared Statement - Insert statement

I am unsing Commons DBUtils Oracle 11g Prepared Statement to insert values in my database. My syntax resembles the following: insert into tablename (col_names) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) I have 10 columns. I am using ? to fill params at…
user1079065
  • 2,085
  • 9
  • 30
  • 53
0
votes
1 answer

How to design method handling a Collection in Java based on the class type passed?

I query a database and get a Bean class, which returns ArrayList. However I public static ArrayList getBeanList(){ String sql = "...."; ArrayList beanList = DBUtil.getBeanList(sql, new ConfDetailsBean()); …
parishodak
  • 4,506
  • 4
  • 34
  • 48
0
votes
1 answer

Apache DBUtils - Why need resultsethandler for Insert?

I run an insert statement using Apache DBUtils. However, I am not sure why I have to include ResultSetHandler for this case: String theQuery = QueryGenerator.insertintoStats(); ResultSetHandler dummyHandler = new…
dmachop
  • 824
  • 1
  • 21
  • 39
0
votes
0 answers

apache commons dbutils malformed sql

I am using QueryRunner to fetch some records from the DB seems like commons dbutils will produce malformed sql :ACCOUNT_NUMBERIKE accountList = run.query("SELECT DISTINCT ACCOUNT_KEY, ACCOUNT_NUMBER FROM V_ACCOUNT WHERE ACCOUNT_NUMBER like ?…
JavaSheriff
  • 7,074
  • 20
  • 89
  • 159
0
votes
2 answers

Java : cannot get String value by Apache dbutils

Here is a test program I wrote with Apache dbutils : public static void main(String[] args) { Connection conn = null; String url = "jdbc:mysql://localhost:3306/bacula"; String driver = "com.mysql.jdbc.Driver"; …
hawarden_
  • 1,904
  • 5
  • 28
  • 48
0
votes
1 answer

Apache dbutils vs Hibernate

What are the pros and cons of using Apache Db Utils vs Hibernate ? How it will affect performance of program ?
user3134221
  • 73
  • 2
  • 9
0
votes
2 answers

QueryRunner Insert method Return Type

I am using Apache Commons DBUtils according to QueryRunner#insert method in its documentation, insert return the generic type of ResultSetHandler. I have a BR_Author object for my project. BR_Author.java import…
erhun
  • 3,549
  • 2
  • 35
  • 44