Questions tagged as 'jdbc'

1
answer

JDBC + mysql remote connection error

Introduction I'm developing a java program that can change the database connection, I have 1 local bank (127.0.0.1:3306) and a remote bank (192.168.25.75:3306) that would be a my computer, I made the connection using jdbc. connDb.java im...
asked by 15.09.2014 / 02:43
2
answers

Simple authentication example with level without hibernate and spring

I would like a simple example of user authentication. I already have the table in the database, which contains the user data and the level (Administrator, common user). As I'm running out of time to tinker with Hibernate and Spring, I want...
asked by 21.05.2014 / 04:59
2
answers

How to check if user has already been registered in the database?

How can I check if a user is already registered? For example, when registering a user check if the login has already been saved in the database. DAO looked like this: public boolean validarLogin (String login) throws SQLException, ClassNotFoun...
asked by 15.02.2018 / 20:20
2
answers

Date Value 0000-00-00 can not be used in java Date

First of all, yes, I already added ?zeroDateTimeBehavi‌​or=convertToNull in the connection URL, the problem is that in the query the date zeroed does not come null and always releases the following Exception: java.sql.SQLException: Valu...
asked by 11.04.2017 / 14:22
2
answers

Search a table in MySQL with Java

I'm having trouble trying to fetch something from the table, I'm a newbie so I did it the way I know. Button code: livros.setPesquisarLivro(txtLivro.getText()); try { modelo.setNumRows(0); for (ObjetoLivro c : livroDAO....
asked by 16.01.2017 / 14:23
2
answers

Use method changes java

How do I make change in the database using the method changes in a ClassAlertFoundation. Do I use the gets and sets of the template to change the data? Do I need to use the SearchId (int id) method to return an object? //pesquisa pelo id e ret...
asked by 17.08.2016 / 21:17
2
answers

Is it possible to make two Selects in a Try?

try { Connection lig = DriverManager.getConnection("jdbc:mysql://localhost/gym", "root", "0000"); PreparedStatement inst = lig.prepareStatement("SELECT * FROM produtos_has_historico WHERE Produtos_idProdutos AND Historico_idHistorico");...
asked by 25.05.2015 / 12:16
1
answer

Problem to add values in JDBC

The console gives me the following error:    FUNCTION workday. SUM does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Can only sql be in my prepareStatement, help me! Dao method publi...
asked by 04.07.2015 / 01:21
1
answer

Incremental key

People, I'm doing a web service with Java + Postgres. I set my table in Postgres as follows: CREATE TABLE usuario ( id serial NOT NULL, nome character varying(40), idade integer, CONSTRAINT usuario_pkey PRIMARY KEY (id) ) WITH ( OIDS...
asked by 16.03.2015 / 01:18
0
answers

Java - error: can not find symbol - Even with created object

I created these two classes: Equipment.java class Equipamento{ private int id; private String nome; private String local; public void setId(int id){ this.id = id; } public void setNome(String n){ this.nome = n;...
asked by 24.08.2018 / 18:18