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
1
vote
1 answer

Get autoincremented generated key with apache dbutils without Statement

I don't use Statement to execute queries. The methods look like public static int insertIntoUserTable (String username, String password) { String query = "insert into user (username, password) values (?, ?)"; QueryRunner run = new…
sandkeks
  • 179
  • 1
  • 11
1
vote
1 answer

Using DbUtils QueryRunner doesnt close database connections

Im using DbUtils library with QueryRunner class to run my queries. From my underestanding of DbUtils docs I dont need to worry about closing connections. However for some reason it does not close my connections automaticly or even manually. Here is…
Selfcoded
  • 95
  • 2
  • 8
1
vote
1 answer

Apache DBUtils queryRunner - where in clause

I am trying to work on retrieving multiple records from a list using queryrunner interface on SQL Server database. Seems that the interface throws error while the normal method works. private void testMethod() throws Exception { List
dmachop
  • 824
  • 1
  • 21
  • 39
1
vote
2 answers

Apache DbUtils : Handling multiple result sets returned from Stored Procedure

I have a problem with using DbUtils to retrieve the results from a Stored Procedure in SQL Server. The stored procedure when executing in SQL Server Management Studio is returning two separate result sets when executed for a specific input value,…
AnkeyNigam
  • 2,810
  • 4
  • 15
  • 23
1
vote
3 answers

Commons DBUtils Oracle 11g Prepared Statement

im working with oracle database 11g release 2, and im using apache commons dbutils v1.6, with JDK 8 and tomcat 8.0.30. so im using the QueryRunner and its method and everything works fine if i just concat my variables in text like this query.query…
lacripta
  • 112
  • 3
  • 15
1
vote
1 answer

Apache DButils column mapping on insert/update?

Apache DBUtils' BeanHandler can conveniently map data into a bean when using SELECT queries. However, it does not seem to be able to do the same when writing data, so I need to use an error-prone way: newid = qRunner.insert("insert into…
Arthur
  • 1,478
  • 3
  • 22
  • 40
1
vote
1 answer

Getting a List of Dates from Apache Commons DBUtils

I am trying to get a list of dates from a table using Apache Commons DBUtils. This kind of query works well with Strings and my own POJOs, but for some reason does not work on java.sql.Date's. CALENDAR_DATE in PUBLIC_HOLIDAYS is a valid date…
rjdkolb
  • 10,377
  • 11
  • 69
  • 89
1
vote
0 answers

DbUtils excute insert sql with datatime column always has xx:xx:00 result

When I use DbUtils to insert SQL with a datetime column in MySQL), I always get a result like 2015-03-25 17:35:00, when the desired result is 2015-03-25 17:35:20, any ideas? This is the SQL I'm using: update user set last_changed=date_add(now(),…
hello man
  • 11
  • 2
1
vote
2 answers

Is it possible in mySql to insert a column that is a mathematical function of two other columns?

Specifically, I'd like to insert a third column (c3) that equals c1 divided by c2 rounded to the nearest integer. I've looked at mySql cookbooks and skimmed through O' Reilly's introduction, but I've yet to see anything that would suggest this is…
1
vote
2 answers

How can Prepared Statements be used with Apache DBUtils?

How can Prepared Statements be used with Apache DBUtils? It seems that most of the methods for org.apache.commons.dbutils.* expect string arguments. It's surprising that there isn't a method that accepts PreparedStatements.
CodeFinity
  • 1,142
  • 2
  • 19
  • 19
1
vote
1 answer

How to use Apache DbUtils to fetch one to many associations and parent-child type associations?

Can somebody explain a way to fetch one to many associations and parent-child type associations using Apache DbUtils? I tried searching but could not find one example for one to many association? Also the documentation on the DbUtils page also…
Paddy
  • 3,472
  • 5
  • 29
  • 48
0
votes
2 answers

How do I populate database values into an existing object model?

I have a model instance already, it's a basic POJO, how can I populate it (by issuing a SELECT) with the values using dbutils by calling the setters which are named to match the table column names? So BasicRowProcessor should match, I just don't…
Flavius
  • 13,566
  • 13
  • 80
  • 126
0
votes
1 answer

BeanListHandler handles db column Timestamp as millseconds (epoch)

I have database column which is Timestamp. The source system (we have no control), inserts data in the format yyyy-MM-dd HH:mm:ss.SSS into this column. I use a BeanListHandler in dbutils to map the row which includes this column to a bean. All other…
Sijo Kurien
  • 95
  • 2
  • 10
0
votes
0 answers

Unable to type in dropdown of dbutils.widgets.dropdown()

In the AWS databricks widgets.dropdown, I'm unable to type input in the dropdown box: I'm unable to find the reason of this type of behaviour.
0
votes
0 answers

Apache Commons DBUtils MapListHandler to get List> How do you save to CSV using Apache Commons CSV

public List> getReport() { Connection connection = createConnection(); List> sqlReport = new ArrayList<>(); if (connection == null) { return sqlReport; } try { …
trilogy
  • 1,738
  • 15
  • 31