Questions tagged as 'jdbc'

1
answer

Use a ResultSet in java to print a whole table on the screen

I know that with resultSet we can do several things with a SELECT done in some table. For example: I know we can get a table and print its contents, listing which columns we want with methods like: getString and getInt. Conection con = ..........
asked by 30.01.2018 / 00:22
1
answer

Error in SQL Server connection with Java in Resteasy API

I'm using the Microsoft 6.0 JDBC driver in a one-time project API using Java (JRE 1.8) with resteasy using Eclipse Oxygen and Tomcat 7 (I tried with other versions and presented the same behavior). My connection code is as follows: public cl...
asked by 11.12.2017 / 14:57
2
answers

JDBC, query returns false but saves in bank

I'm running the following function in java: public boolean insert(User user) throws SQLException{ String sql = "insert into usuarios (nome, email, senha) values (?,?,?)"; PreparedStatement instruction = this.connection.prepareS...
asked by 11.05.2017 / 15:53
1
answer

Problem in performing a Java language INSERT

Hello everyone, I have a problem that I think should be very easy but as I am new to it, it is not rs, I have an insert to perform in a class called ClienteDAO follow the code below: public class clienteDAO { public void Create(clie...
asked by 23.12.2016 / 20:03
1
answer

How do I know if the cpf field does not exist in the database?

Example of what I'm trying to do: vRS = sql.executeQuery(); while(vRS.next()) { nome = vRS.getString("nome"); cargo = vRS.getString("cargo"); } What I want to do is when the registry does not exist to di...
asked by 21.10.2016 / 18:17
1
answer

Error inserting JDBC data

I'm having the following problem, I want to insert the data from my expense table but some error occurs with my foreign key, what can it be?    expensea: Can not add or update child row: a foreign key constraint   fails ( trabalhoviagemd...
asked by 04.07.2015 / 04:09
1
answer

How to make a control class for JDBC crud

How do I make a control class for a list method of my crud? The method of my dao class will return all the data set that have the same city. But this error occurs in my main class: DaoclassmethodpublicList<ViagemBean>getListaDestin...
asked by 03.07.2015 / 21:04
2
answers

Bringing an Object to a ResultSet

I'm having trouble getting data from a Java search, I'm using PostgreSQL and JDBC database for persistence, public List<Tapete> listarTapetes() { PreparedStatement state = null; ResultSet rs = null; try{ String sql =...
asked by 05.11.2014 / 23:52
1
answer

Get record with SQL JDBC specifications

Hello, good afternoon. I'm having to develop a Java system with MySql. It's simple, just part of the backend, but I'm pushy and had not run querys with java before hehe. The system is the following, the basics: I have a database with a table...
asked by 10.05.2018 / 18:40
1
answer

doubt with open and close connection

I would like your help with the connection below, when I close I have the following error, am I doing it correctly? with regard to opening and closing the connection? My pool public class MysqlConnectionPool { private final DataSource dataS...
asked by 02.01.2018 / 21:04