Questions tagged as 'jdbc'

1
answer

Error DataBase Locked Sqlite / Java

I have the following problem: in an insert that I am trying to perform, I do not know if it is an error in the database or something in the programming in java, however every time I try to perform an insert of the client table I get the error: p...
asked by 24.12.2016 / 18:24
1
answer

How do I set a char in a PreparedStatement?

My FuelType variable is a char how to set this in the PreparedStatement? PreparedStatement ps = conexao.prepareStatement(sql); ps.setString(1, veiculo.getTipoCombustivel());     
asked by 02.06.2015 / 19:18
1
answer

Error "The resultSet is closed" with PreparedStatement

I'm getting this when I'm traversing a ResultSet and get other ResultSet s: public class BpaDetDao extends DaoAbstract<BpaDetBean> { public static final String // TODO Colocar campos no select SQL_SELECT =...
asked by 29.06.2015 / 22:20
1
answer

How to organize the CRUD methods for each table?

I would like to know how best to organize the CRUD (create, read, update, delete) methods of each class in Java. An example, to get better at understanding: Suppose we have the Funcionario , Cliente and Produto classes....
asked by 10.06.2015 / 19:33
1
answer

Check if the field is null in java and mysql

How do I check if a database field is populated or is null? Do you have a ResultSet method that does this? In case it is a date field. PreparedStatement ps = connection.prepareStatement("SELECT * FROM tarefas"); ResultSet result = p...
asked by 22.09.2017 / 00:40
2
answers

I'm having trouble trying to list data from a mysql table

Manufacturing Class import java.sql.Connection; import java.sql.DriverManager; public class Fabrica { public Connection getConexao() { Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver");...
asked by 19.09.2017 / 22:45
1
answer

Processing SQL statements with JDBC

I'm trying to use JDBC, but having difficulties with proper language use. I would like to pass the sql code down to java, and I need help with SELECT. Regarding the variables sql1, sql2, sql3 and the use of their respective where ... (for me...
asked by 19.11.2016 / 01:00
1
answer

DB oracle Closed Connection

Introduction I'm developing an application and I have to add data to an oracle database that is local. Using JDBC I make the connection try (Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@" + conexao + ":1521:xe", "system...
asked by 16.09.2014 / 23:08
1
answer

Java / SqlServer transaction divided into several methods

I have a method that executes multiple Prepared Statements , only two of them in methods of other classes. In my method, I have the object connection , and if you want to start a transaction, I have to do: connection.setAutoCommit(...
asked by 07.11.2014 / 10:22
1
answer

Ways to get bank values with ResultSet

Ways to get Java database values (JDBC). public static Connection getConnection(){ /* 1. Faz a conexao com a base de dados */ /* 2. Retorna qual banco ira trabalhar */ Connection connection=null; try {...
asked by 20.06.2015 / 00:47