Questions tagged [sql2o]

Sql2o is a small Java framework that makes it easy to execute SQL statements on your JDBC compliant database from Java.

About

Sql2o is a small Java library, with the purpose of making database interaction easy. When fetching data from the database, the ResultSet will automatically be filled into you POJO objects, kind of like an ORM, but without the SQL generation capabilities.

Links

35 questions
25
votes
7 answers

Shared Transaction between different OracleDB Connections

After several days passed to investigate about the issue, I decided to submit this question because there is no sense apparently in what is happening. The Case My computer is configured with a local Oracle Express database. I have a JAVA project…
Tonino
  • 951
  • 9
  • 22
4
votes
1 answer

How to save a UUID as binary(16) in java

I have a table TestTable with columns ID as binary(16) and name as varchar(50) I've been trying to store an ordered UUID as PK like in this article Store UUID in an optimized way I see the UUID is saved in database as HEX (blob) So I want to save…
Maximus Decimus
  • 4,175
  • 19
  • 55
  • 83
3
votes
2 answers

Are there any ways to map the result set at sql2o as generics?

I'm writing database client using sql2o library. There are a lot of data access objects in my project, so I supposed to have lot of similar functions for getting access to the tables. For example, for class Persons. public List
7duck
  • 191
  • 1
  • 11
3
votes
1 answer

Error while inserting in sql2o

I want to create table and insert some values into it. I'm trying to do it using H2 database and sql2o framework at the code below: public class Main { private static final String DB_DRIVER = "org.h2.Driver"; private static final String…
Amir
  • 862
  • 2
  • 10
  • 26
2
votes
1 answer

sql2o - select query removing trailing spaces from VARCHAR coulmn

using sql2o (https://github.com/aaberg/sql2o) when selecting a VARCHAR column that has trailing spaces (for example "some value ") the return value is "some value" when selecting from mysql cli the result contains the trailing spaces cant find…
Nimrod007
  • 9,075
  • 8
  • 43
  • 68
2
votes
2 answers

SQL query performance, archive vs status change

Straight to the point, I've tried searching on google and on SO but cant find what I'm looking for. It could be because of not wording my searching correctly. My question is, I have a couple of tables which will be holding anywhere between 1,000…
AlyxEsson
  • 93
  • 9
2
votes
1 answer

sql2o with SQLite in Java NoInitialContextException

I've got the following code snippet so far: Sql2o sql2o = new Sql2o("jdbc:sqlite:test.db"); try (Connection connection = sql2o.open()) { for (Column column : connection.createQuery("SELECT * FROM sometable").executeAndFetchTable().columns()) …
linkD
  • 99
  • 12
2
votes
1 answer

How do i access and print out data with sql2o

So i have code block similar to this: public class Task { private Long id; private String description; private Date dueDate; // getters and setters here public List getAllTasks(){ String sql = "SELECT id, description, duedate " + …
HashTables
  • 312
  • 2
  • 4
  • 20
1
vote
2 answers

Not Able to Connect JDBC-Hikari To my Micronaut App

Error I am Getting after running sudo ./gradlew run : Task :run FAILED 12:03:13.440 [main] ERROR com.zaxxer.hikari.HikariConfig - Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader…
ukdev
  • 15
  • 6
1
vote
2 answers

sql2o unable to delete on oracle DB

I am trying to use sq2o in a project. It works well under MSSQL but has issues with deleting when switched to Oracle DB 12c public void delete(final String x, final String y) { final String query = "DELETE FROM XXX WHERE columnx = :x AND…
Maciej
  • 431
  • 1
  • 9
  • 15
1
vote
1 answer

Mapping Object fields that do not contain a unique identifier in a relational database

I have an object of type Reward that is a field within a Card class. I am attempting to store the Card class within the database. The other fields within Card are not a problem for database persistence, so for brevity we will only concern ourselves…
Armin Naderi
  • 33
  • 1
  • 6
1
vote
1 answer

Java,Spark,Sql2o,H2: Could not acquire a connection from DataSource - IO Exception

I want to create an API using Java Maven, with Spark and H2 database and Sql2o library. This is the full Error message: Exceptionorg.sql2o.Sql2oException: Could not acquire a connection from DataSource - IO Exception: "java.io.IOException: The…
Claudiu Haidu
  • 685
  • 3
  • 10
  • 21
1
vote
1 answer

Sql2o with postgres, No results were returned by the query

The other questions I've found with this title all deal with non-SELECT queries. I'm using Java 8, Sql2o 1.5.4, and postgresql 9.5.3. My UserService looks like: public class UserService { private final PGService pgService; public…
saarrrr
  • 2,164
  • 13
  • 24
1
vote
3 answers

foreign key always stays null

I need a bit of assistance in getting a connection between my two tables These are the tables where "idPatient is the foreign key" I fill the table "tanden" like this public void addTandenToDatabase(int id, int fdi, String voorstelling, String…
Skupaj
  • 83
  • 8
1
vote
2 answers

retrieve MySQL auto increment in Java

I'm trying to retrieve idPatient from the database but i keep getting errors, idPatient is auto increment. But i don't know if that's what causing the problem. This is the code i'm trying public List getPatientsFromDatabase() { String…
Skupaj
  • 83
  • 8
1
2 3