I have prepared statement like select * from books where author = ? and theme = ? and i cant figure out what to do, if user select option “any author” or “any theme”, what should i set to prepared …
Tag: java
Get the all unique permutation and combinations of ‘where clause conditions’ for my table in SQL Server
I would like to see all possible unique scenarios of my data in a table. I can give the Input like Operators=[<,>,=,……] Operands=[mode, StartDate,EndDate,…..] I am expecting the result like 0 and 1/1/2018<1/12/2018 0 and 1/1/2020=1/1/2020 1 and 1/1/2018>5/5/2015 1 and 3/8/2015<…
Creating entity for database
For example, I have database with table book (id, title, themeId, authorId), table author (id, name) and table theme (id, name). I dont know, should i create entity exactly like in database (and then i will have problems with join queries): or create something like this: in second case i will have problems if…
Retrieving pictures from MySQL using Java
I have a question related to retrieving files from MySQL using JDBC. I managed to save a .png file from my desktop & retrieve it successfully, but I can’t read the file. It shows that the format …
I’m using JavaFX and my combobox doesn’t want to populate from an sql database
What I’m trying to do is have my combobox get populated with AgentID’s from my travelexperts database when the app loads. I think the problem is somewhere in the controller class. I don’t get any …
How to translate millis to date and group by month and year in Jooq?
I have the following SQL which works as expected: I’m trying to recreate these SQL in Jooq, but I don’t know how to create a Date object from the milliseconds I have as creation_date in my database. Answer A common confusion when writing SQL GROUP BY is the logical order of SQL operations. While s…
JDBC, Prepared Statement getInt() returns 0
In my DB every question has a valid questionID (primary Key) and categoryID (foreign Key to category table). The problem is: in the Result Set for every question both IDs are 0 instead of what’s written in the DB. All other arguments are filled out correctly. Edit 1 Here is the original code (in the pos…
JOOQ: How to create MockResult for stored procedure with out parameters?
When using the JOOQ MockDataProvider what is the correct way to build a MockResult for stored procedures? The examples I’ve found show how to return results for tables and views by creating a result and record from generated table definitions and then returning them. For stored procedures I’m not …
How to implement pagination by nextPageToken?
I am trying to implement pagination using nextPageToken. I have table: CREATE TABLE IF NOT EXISTS categories ( id BIGINT PRIMARY KEY, name VARCHAR(30) NOT NULL, parent_id …
I’m trying display severeal lines from a database in NetBeans, but only one line appears
I’m currently having to do a code where, when ran, connects to a database and displays all the grades of a student after putting in their appropriate SSN. The main obstacle I’m running into is that once I put in the SSN it’ll only bring one of the grades rather than all. Is there something w…