Questions tagged as 'jdbc'

2
answers

Screen to configure connection with Mysql

I am currently using the following code to execute connections with my DB public class ConexaoDAO { public Connection getConexao() { try { return DriverManager.getConnection("jdbc:mysql://ip:porta/tabela", "usuario", "s...
asked by 22.11.2016 / 14:58
2
answers

Is it possible to store user inputs by Scanner Class in a database?

IhaveanapplicationmadeinJava,andIneedtostoretheuser'scadastralinformationinthedatabase:cpf,password,name,address,phoneSystem.out.println("Digite seu CPF"); cpf = ler.nextLine(); System.out.println("Senha: "); senha = ler.nextLine();...
asked by 29.06.2016 / 16:07
1
answer

Error: Parameter index out of range (1 number of parameters, which is 0)

I'm trying to remove a data from the database, but the following error occurs:    Parameter index out of range (1 > number of parameters, which is 0) Can you help me? public void remove(Bean e) { try { PreparedStatemen...
asked by 07.07.2015 / 04:39
1
answer

"Column 'Value' not found." when fetching balance in query

I'm building an ATM simulator, with the Deposit, Draw, and Extract features functional. But I'm not getting the balance. I have the emitirSaldo() method that should receive the value calculated by the query. Here is the code: public...
asked by 12.03.2018 / 01:46
1
answer

Make connection in oracle 11c

I'm trying to connect to oracle 11c and the connection is not made. Give the error:    ES Error: Got one from a read call I'm testing the query in a servlet, I'm still not looking for the form. Let's see: package connection; import ja...
asked by 15.11.2016 / 15:54
1
answer

JSP Project with Database

I'm working on a JSP project with my driver's database not being recognized. I'm using the following method to connect to the bank. public ConnectionDB(){ try { Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc...
asked by 15.11.2016 / 01:02
2
answers

Is it necessary to put the element type inside the try?

When optimizing my JDBC code I started using a condition inside the try. /** Função PreparedStatement stmt */ public PreparedStatement stmt; /** Funçãoo ResultSet rs */ public ResultSet rs; /** Método LoginDao - construtor */ public Login...
asked by 20.08.2015 / 20:26
2
answers

Using the database connection class

It seems like a silly question but come on, I have some tables in my database and I need to query them, but they are not @Entity, I did not create the sources, the only way to do the queries would be with the Connection class. ? Would it be a go...
asked by 02.03.2015 / 18:26
1
answer

Error statement and executeUpdate SQL - NetBeans

try{ Class.forName(driver); Connection conn = DriverManager.getConnection(str_conn, usuario, senha); Statement stmt = conn.createStatement(); String sqlinsert ="insert into cheque (data_cheque,valor,repasse) values ("+...
asked by 30.01.2015 / 18:30
1
answer

Problem with database insertion

I have the following code on my system: public int insert_dependente(Dependente dependente) { ResultSet r; int result = 0; if (!(dependente == null)) { try { Connection conn = new Conexao().getConnection();...
asked by 18.05.2015 / 00:17