Most voted "jdbc" questions
Java Database Connectivity or JDBC is a set of classes and interfaces (API) written in Java that send SQL statements to any relational database.
Learn more…213 questions
Sort by count of
-
1
votes1
answer310
viewsError while trying to delete with DELETE method using web service Rest in Java
I created a Web Service REST in Java. All operations are working except that of DELETE which returns the following error: HTTP DELETE method: @DELETE @Path("excluir/{idpromocao}") public void…
-
1
votes1
answer420
viewsSqlexception error while trying to connect to database
I am creating a project with JDBC. When I run the code it gives the following error message: Exception in thread "AWT-Eventqueue-0" java.lang.Runtimeexception: java.sql.Sqlexception: No suitable…
-
1
votes1
answer512
viewsFirst() and next() methods do not work in Resultset, even when editing parameters
I need to do two iterations on the same ResultSet. For that I did the following: I set parameters in a Statement to make the cursor editable, according to my connection class constructor: public…
-
1
votes2
answers1752
viewsHow to verify if user has already been registered in the database?
How can I check if user is already registered? For example, when registering a user check if the login has already been saved in the BD. DAO was like this: public boolean validarLogin (String login)…
-
1
votes1
answer45
views"Column 'Value' in found." when fetching balance in query
I’m building an ATM simulator, with the features of Deposit, Withdraw and Extract are functional. However, I’m not getting the balance. I have the method emitirSaldo() which must receive the value…
-
1
votes2
answers69
viewsSearch is not performed after connecting to the Java database
I’m trying to run a database search using java code, but I can’t. The database is connected, but the search is not performed. I created two classes, one that has the class with the connection…
-
1
votes1
answer38
viewsDifferent results with the same SQL statement
Talk programmers(as), quiet? I’ve done a lot of research not to repeat questions here, but I really don’t understand why the SQL statement works on Mysql Workbench and the Java/JDBC SQL string…
-
1
votes1
answer973
viewsJava - error: cannot find Symbol - Even with created object
I created these two classes: Java equipment. class Equipamento{ private int id; private String nome; private String local; public void setId(int id){ this.id = id; } public void setNome(String n){…
-
1
votes1
answer237
viewsJava: Error while recovering data from Resultset, even though query is correct
My problem is this: I am making a Java application integrated with the H2 database. I do a query via PreparedStatement and saved in a ResultSet. So far so good, no Exception is generated. In the…
-
1
votes1
answer291
viewsStatement or Preparedstatement, for what reason avoid using Statement
What problems can happen if I use Statement instead of Preparedstatement on the JDBC connection to the database //Code using Preparedstatement, setting query values through methods Connection con =…
-
1
votes1
answer47
viewsFalling in catch while trying to establish a connection
I’m using Netbeans and can’t establish a connection. I added . postgre jar (postgresql-42.2.5.jar) in the lib folder and tested the connection in the Netbeans tab (Service > database), ok worked.…
-
1
votes1
answer69
viewsI am starting in java and am having the error java.lang.Nullpointerexception
ERROR: Exception in thread "main" java.lang.NullPointerException at br.com.drogaria.dao.FabricanteDAO.excluir(FabricanteDAO.java:33) at br.com.drogaria.dao.FabricanteDAO.main(FabricanteDAO.java:64)…
-
1
votes1
answer114
viewsI have a Java class where one of the attributes is an Arraylist of another object. How to bring this from the database?
I have a java object that looks like this: public class Objeto1 { private int id; private int nome; private ArrayList<Objeto2> lista; //construtor e Getters e Setters } How do I get this list…
-
1
votes0
answers299
viewsRun Spring Boot project without Datasource and Jdbctemplate
I have a project Java with Spring Boot that has to be mult-tenacy and for that I’m trying to use the Flyway to execute the migrate() by an endpoint passing the data needed to connect to a specific…
-
1
votes0
answers1296
viewsjava.sql.Sqlrecoverableexception: ES error: Connection closed by the other end, Authentication lapse 0 ms
I have a simple Java application that makes a JDBC connection in an Oracle database, follow the source. public class Main { public static void main(String[] args) { try { Connection conn =…
-
1
votes0
answers57
viewsIs it possible to run 2 querys at the same time without creating a FUNCTION?
I have a problem where I need that when creating a new "location" on my system, automatically I need my "Room" table to have the "id_status" that is part of another changed table. This would be…
-
0
votes1
answer439
viewsOffline database
I’m creating a program that uses a database on file. I was told that the Sqlite is for this, I can create database with it and access by file. In that case, would I use the SQL or JDBC library to…
-
0
votes0
answers60
viewsNo suitable driver found (Mas o driver esta la !)
Guys, I made a first application through the Caelum site in Java EE, a calendar, and all right, all right, fine, I added contacts to MYSQL quietly in the Java part of the workbook, the JDBC driver…
-
0
votes2
answers4842
viewsBringing an Object for a Resultset
I’m having trouble bringing the data of a Java survey, I’m using Postgresql and JDBC database for persistence, public List<Tapete> listarTapetes() { PreparedStatement state = null; ResultSet…
-
0
votes1
answer34
viewsError while running this page
import android.app.*; import android.content.*; import android.os.*; import android.util.*; import android.view.*; import android.widget.*; import java.util.*; import org.apache.http.*; import…
-
0
votes1
answer685
viewsHow to List more than one bank line in a Listview using JDBC?
How to list more than 1 database data using JDBC on a Listview on Android? I have in a user 13 lines, and would like to recover the 13 and not just 1. Below the code I use: import android.os.Bundle;…
-
0
votes2
answers261
viewsPreparedstatement is not working
Code I’m using PreparedStatement i = conexao.prepareStatement("INSERT INTO teste VALUES (player='teste', level_1=0, level_2=0, level_3=0, level_4=0, level_5=0, level_6=0, level_7=0, level_8=0,…
-
0
votes1
answer522
viewsHow to run a . jar using java jdbc on another machine
I’m a beginner in java, I made an application using the netbeans native database. Gero the file jar, and in the machine I made the application the jar runs normally, but when I put this jar on…
-
0
votes1
answer56
viewsIs it possible to cancel a JDBC connection?
I’m using the following code in a Thread: try { Class.forName("org.postgresql.Driver"); DriverManager.setLoginTimeout(60); conexao = DriverManager.getConnection(url,usuario,senha); }catch(Exception…
-
0
votes0
answers40
viewsNo Session found for Current thread
I am having trouble performing a test to add a user with profile! My problem is the method addUser. Code of the test class: public class AddUser { public static void main(String[] args) {…
-
0
votes0
answers165
viewsEncoding problems in java
I have a classic encoding problem, I’ve done several tests, but nothing solved. The problem only occurs with data brought from the database in Sql Server, with the text fixed on the screen ta…
-
0
votes1
answer269
viewsJava mysql JDBC connection
I have a problem following this video lesson: I seem to follow what he tells me to do but the line goes red and wrong: con = DriverManager.getConnection("jdbc:mysql://127.0.0.1/videoAulaJDBC",…
-
0
votes1
answer156
viewsHow to 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 record does not exist to…
-
0
votes1
answer633
viewsMaturity of dates
I have this code that validates the dates of a card and puts in the table: @SuppressWarnings("nls") public static ObservableList<String> getPagaVenci1(TableView<PersonC> jtc, String sq4,…
-
0
votes1
answer470
viewsNullpointerexception Selectonemenu [JSF + PRIMEFACES]
On a JSF page about a car shop, I first select the brand of the car and then choose the model. However, when selecting an item from the first "Hyundai" menu, it gives NullPointerException and I…
-
0
votes1
answer43
viewsHow to limit a JDBC connection to only do "select" queries?
I wish my JDBC connection didn’t make queries that can make changes to tables (Insert, delete, update, drop). There’s some way this can be done?
-
0
votes2
answers725
viewsSolution of exceptions Serviceexception and Failed to execute Goal org.codehaus.mojo:exec-Maven-plugin:1.2.1:exec?
The following error is occurring: Serviceexception and Failed to execute Goal org.codehaus.mojo:exec-Maven-plugin:1.2.1:exec? I have already changed the name of the Provider from…
-
0
votes1
answer31
viewsInsert date in bd with JDBC Google Script
I am trying to write several data in the database (Mysql), but in the data of the date type the following error: Unable to find setTimestamp(number,string) method. (line 32, file "Code") The code…
-
0
votes2
answers1212
viewsFigure out which column would be truncated (date would be truncated)
good evening! When trying to enter a record in Sqlserver through my application I am getting a truncated data message. The problem is that there are many columns that this screen fills and I have no…
-
0
votes2
answers240
viewsJDBC, query returns false but saved in database
I am running the following java function: public boolean insert(User user) throws SQLException{ String sql = "insert into usuarios (nome, email, senha) values (?,?,?)"; PreparedStatement instruction…
-
0
votes0
answers110
viewsDoubt about data distribution between classes
I have a class called Socio who asks for his name, phone number... and I devised methods getters and setters. And another class called DadosDoUsuario who will ask for the information to fill out the…
-
0
votes1
answer140
viewsError to popular jtable with database
I have to make a client registration application in JAVA, I am using eclipse. The problem is in the method listarCli(), because when I comment on this method the error does not appear. The error is:…
-
0
votes1
answer66
viewsJava type incompatibility
String query = "INSERT INTO codigos(Nome,Codigo) VALUES( '"+nome+"','" +codigo+ "')"; rs = st.executeUpdate(query); rs is a resulset, st is a statement, an error appears to say that there is an…
-
0
votes1
answer683
viewsProblem reading property file
I created a propertie file for the database to read this file from there but the console presents me the following error: Erronull\properties\conexao.propertie (O sistema não pode encontrar o…
-
0
votes2
answers37
viewsHow to run a . sql file containing a Procedure (oracle) in Java
I have this script inside a file named xxx.sql how do I create Procedure through a call within java code? DECLARE PROCEDURE P_GERA_LOG(P_TEXTO IN VARCHAR2) IS BEGIN…
-
0
votes1
answer4099
viewsHow to list data from a Mysql database using the Java List (jdbc) method?
I’m having trouble trying to list the data. Exception in thread "main" java.lang.Nullpointerexception at modelo.Dao.getLista(Dao.java:111) at principal.Main.listarViagem(Main.java:161) at…
-
0
votes1
answer864
viewsHow 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 mistake happens in my main class: Method of…
-
0
votes1
answer238
viewsError inserting JDBC data
I’m having the following problem, I want to enter the data from my expense table but some error happens with my Foreign key, which may be ? background: Cannot add or update a Child Row: a Foreign…
-
0
votes2
answers1040
viewsError connecting to Mysql database in Java
Connection code: package br.bent.jdbc; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Connection; public class Conexao { private static Conexao conexao; public static…
-
0
votes1
answer49
viewsWhy a Stored Procedure generates different results if run in Workbench and Java with JDBC
I have a Stored Procedure in Mysql that is working normally when running from Workbench, but by running this same procedure in Java/JBDC I am getting wrong values and different from those obtained…
-
0
votes0
answers573
views -
0
votes0
answers100
viewsError connecting to Sqlserver using JAVA JDBC
I’m using the sqlserver lib and my connection class is down here: public class conexao{ //sqlsever private static final String USUARIO2 = "usuario"; private static final String SENHA2 = "senha";…
-
0
votes1
answer203
viewsWhy don’t you put it in the database?
Why does the following database entry code not work? The code reaches Joption "arrived!" private void btnCadastroActionPerformed(java.awt.event.ActionEvent evt) { String sql = "INSERT INTO…
-
0
votes1
answer670
viewsJDBC connection on AZURE server with SSL encryption
I’m having trouble connecting via JDBC in the AZURE Sqlserver database using encryption. My connection string is as follows: jdbc:sqlserver://servidor.database.windows.net:1433;…
-
0
votes1
answer57
viewsProblem with TIMER insertion in Mysql table using JDBC
Personal talk! I have the following problem and I am looking for the best possible solution. The following code when running a time is saved in the tAtual (current time) string and sent to the…