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

33 questions
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
  • 9
0
votes
1 answer

Error executeUpdate,You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use

I tried to add a record do MariaDB database use Sql2o with IntelliJ All fields have type String and in Database have type varchar. But I got the error below (java.sql.SQLSyntaxErrorException) Error in executeUpdate, You have an error in your SQL…
LeeHari
  • 31
  • 7
0
votes
1 answer

Do I need to close sql2o queries

A few months back I learned that when working with java.sql.connection I needed to close PreparedStatements and ResultSet to prevent memory leakage, as explained here However I recently started working with a new team that uses org.sql2o.connection…
LeedMx
  • 424
  • 4
  • 19
0
votes
1 answer

Sqlite-JDBC update with LIMIT clause?

I am trying to use the update query with the LIMIT clause using sqlite-JDBC. Let's say there are 100 bob's in the table but I only want to update one of the records. Sample code: String name1 = "bob"; String name2 = "alice"; String updateSql =…
HashTables
  • 392
  • 2
  • 7
  • 22
0
votes
0 answers

Any Solution for this I have already Added autoReconnect = true?

{ "message": "Internal Server Error: Database error: The last packet successfully received from the server was 89,722,963 milliseconds ago. The last packet sent successfully to the server was 89,722,964 milliseconds ago. is longer than the…
ukdev
  • 25
  • 1
  • 7
0
votes
2 answers

How to name a composite class like this?

Our team are using Spring Boot 2 with sql2o as db library. In the paste in our services, for trivial methods, we simply call the repository and returns the model. For example, if I have a Supplier table, I had in the service @Override public…
Marco Sulla
  • 15,299
  • 14
  • 65
  • 100
0
votes
0 answers

RepositoryException: org.sql2o.Sql2oException: Database error: No results were returned by the query

I am using postgres sql as database and java for backend. I am using sql2o with java code as shown below. public Category insertCategory(Category category) { // TODO Auto-generated method stub System.out.println(category.getName()); …
coder12349
  • 437
  • 2
  • 12
  • 25
0
votes
1 answer

how do you detect createUpdate() fails?

public Connection executeUpdate() { long start = System.currentTimeMillis(); try { this.logExecution(); PreparedStatement statement = this.buildPreparedStatement(); this.connection.setResult(statement.executeUpdate()); …
user1126515
  • 1,133
  • 3
  • 17
  • 34
0
votes
1 answer

How to set up Tomcat for one Database Connection per Request

I have a Sparkjava app which I have deployed on a Tomcat server. It uses SQL2O to interface with the MySQL-database. After some time I start to have trouble connecting to the database. I've tried connecting directly from SQL2O, connecting through…
Philippe
  • 1,715
  • 4
  • 25
  • 49
0
votes
2 answers

How to get data from SQL with sql2o?

I'm trying to get data from mySQL to List in java using sql2o lib. But for some reason I just fail to understand how to use it properly (it looks like). Here is the faulty code: List returning = new ArrayList(); String date =…
Kristi
  • 3
  • 3
0
votes
0 answers

Is there a way to intercept database output (dbms_output) with sql2o?

I am using sql2o with Oracle database in a Java-based project. Often in my sql queries I use dbms_output.Put_line('A message...') in order to track what is going on. Is there a way to intercept this output with sql2o so I can pass it on to my logs?…
JDelorean
  • 631
  • 13
  • 26
0
votes
1 answer

Sql2o keep returning a same set of data although query is different

I am new to using SQL2O with MySQL, but I am having a weird problem, where different queries return same results. Is SQL2O returning me cached results? My code looks like this: String sql = "SELECT * " + "FROM report_A" + …
Deric Dominic
  • 57
  • 1
  • 11
0
votes
1 answer

How to retrieve a java object from table that has Geometry type using sql2o

I'm using sql2o to map PostgreSQL rows to java objects. I have a table that has a column of type POINT and a java model with two Doubles, both representing latitude and longitude. To save an object in database I'm doing something like this: public…
user3762200
  • 447
  • 1
  • 6
  • 17
0
votes
1 answer

When Using sql2o, what is the org.sql2o.converters.ConverterException?

I am using the .executeScalar() method from the sql2o .jar file. I am getting this exception when using an Employee POJO, when I use .executeScalar(Employee.class) I am getting: org.sql2o.converters.ConverterException: No converter registered for…
0
votes
1 answer

Fill foreign key in database based on auto increment from other table

I have two tables. The first table patienten has an auto increment id. One "patienten" has multiple "gebit". idPatient is the foreign key from the two tables. patienten: gebit: Now i want to fill the "gebit" table but i keep getting errors. My…
Skupaj
  • 83
  • 9