All Questions
730 questions
0
votes
3
answers
79
views
How to get the number of rows written by CSVPrinter?
My code runs a SELECTstatement, and saves the entire ResultSet into a file with a single call to CSVprinter.printRecords(resultSet).
This works very nicely except, I'd like to know, how many records ...
0
votes
0
answers
28
views
Delete a specific record in JDBC ResultSet rs without going over record by record on rs
If you already have read record in a Java JDBC Resultset rs, suppose it has columns username, id, rollnum, now you want to delete record from Reseultset where username = ‘user1’, can you do it without ...
1
vote
1
answer
68
views
Why should I close a CachedRowSet object? [duplicate]
I have a CachedRowSet object in Java. Since CachedRowSet objects are disconnected from the DB, is there a need to close them, or put them in try-with-resources blocks? My IDE is suggesting I should.
...
-1
votes
2
answers
72
views
How to perform a select by sections since it contains many records using Java?
I have a table which contains approximately 100,000 records, I did a SELECT to obtain the total number of records because it can vary, I need to consult the table and obtain all the records of 4 ...
0
votes
1
answer
71
views
How RowSet works java?
I am trying to understand the internal workings of RowSet.
How does it set the properties data and create a connection?
RowSetFactory factory = RowSetProvider.newFactory();
JdbcRowSet jdbcRowSet = ...
1
vote
0
answers
78
views
Understanding of result memory for impala jdbc driver
I have written below code that get result set using prepared statement. We are using impala DB with jdbc driver.
private void writeToCSV(File resultFile, ResultSet resultSet) throws IOException, ...
0
votes
0
answers
42
views
How to access a column by name from ResultSet of an INNER JOIN - duplicate column names? [duplicate]
Using JDBC and SQLite, the ResultSet obtained from a SELECT with an INNER JOIN may contain duplicate column-names, e.g.
SELECT A.id, B.id FROM A
INNER JOIN B ON (A.id=B.ref)
How can I get the A.id ...
0
votes
0
answers
85
views
java.sql.SQLException: Provider com.sun.rowset.RowSetFactoryImpl not found
I've asked a question on how to retrieve data from ResultSet before closing the connections.
JDK Version: jdk1.8.0_201
CachedRowSet class is suggested in an answer by someone in the above mentioned ...
1
vote
1
answer
307
views
Retrieve data from ResultSet before closing the Connections
I've created a method to fetch details from Database which returns an object of ResultSet by executing a callableStatement.
I want to close the Connection & CallableStatement. For performing this ...
0
votes
1
answer
366
views
JDBC- Will the Prepared Statement instantiated in try block and not accessible in finally block be closed once Conn is closed in finally block
It is said that when we close connection object, the preparedstatement, resultset everything gets closed. In existing project code I found that PreparedStatement is not closed explicitly and also it ...
0
votes
1
answer
31
views
Database call clarification on rs.getString("columnName")
we know using Jdbc driver we connect to DB , and rs.next() points to cursor , my question is when we read each columns data using rs.getString("position of column/name of the column),
My Question ...
0
votes
2
answers
605
views
How to convert list of PreparedStatements to addbatch and execute at once
I have an Insert query where the values are changing dynamically but the table remains the same. I am trying to set the values for those fields using getObject setObject. Once setted when i tried to ...
0
votes
0
answers
64
views
SQLException: Closed Resultset : next error
I ran this query but after a while, I got Closed Resultset error. I'm sure the query is running in the database (I have checked the oracle side).
public static void migrateMessagesToElastic(Long ...
0
votes
1
answer
183
views
How to use jdbc ResultSet of a SQL 'select *' query to create and populate a 2 dimensional array as a truth table
I am trying to select the entire contents of a MSSQL Server table populated with int values to serve as a 'truth table'. The goal is to select the entire SQL table, and populate it in Java as a 2 ...
1
vote
2
answers
520
views
Java ResultSet.getString() for Date field skips millisecond
I am using ojdbc8 version 21.3.0.0 and am retrieving the Date column in Oracle as a string.
I was expecting the string to be printed as 2021-01-21 00:00:00.0 but it prints as 2021-01-21 00:00:00 , so ...