Questions tagged as 'jdbc'

1
answer

JDBC SQLite - Java

Good afternoon, How do I make the connection to SQLite DB? I made the connection class like this. package model; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class Conexao { public st...
asked by 31.07.2014 / 18:27
1
answer

How to convert java.util.Date to java.sql.Date keeping hours, minutes and seconds?

I'm doing a Java program. In it I get a date of type java.util.Date , but I need it in java.sql.Date so I can insert it into the database. But on that date, I have hour, minute and second and I would like to insert with all this dat...
asked by 03.11.2017 / 21:24
1
answer

Problem in calling DriveManager.getConnection?

I'm studying Java with database and I'm doing a few examples. On the PC with Windows I used a code and it worked, there was no problem, I now use Linux and the same code is giving error when calling the% with% of DriveManager.getConnectio...
asked by 23.01.2017 / 13:50
1
answer

Profile network java (jdbc)

What tool can I use to evaluate the response time of a request (jdbc) Ex: query = "SELECT * FROM v$version WHERE banner LIKE '%Oracle%'"; ResultSet rs = stmt.executeQuery(query); // linha de cima ⋀ // quanto tempo demorou nesse meio ? // l...
asked by 07.03.2016 / 20:16
1
answer

What is Context and Generated Keys?

I would like to know what exactly is the context of class connection (I have already seen methods in relation to this as getConnectionFromContext , or something like this) and Generated Keys as the PreparedStattion constant:...
asked by 18.10.2015 / 19:10
1
answer

java.lang.NullPointerException Error in JDBC Connection with WS + Postgres

I'm creating a WS that connects to a PostgreSQL DB and performs a query on a single table. I try to run it locally, but the problem is when I run the application it gives the following error:    HTTP 500 Status - Internal Server Error   ...
asked by 04.09.2014 / 16:40
1
answer

Foreign keys in java

I'm having a bit of trouble implementing the foreign keys in my example. Can anyone help me mount the DAO class? CidadeDAO.java public class CidadeDAO { private final Connection connection; public CidadeDAO() { try {...
asked by 25.03.2015 / 13:17
2
answers

Test without "messing up" (adding data) to the database

I'm having trouble doing integration testing. I test my database functions. My web application does not use any framework database connection and I am not able to do tests without messing up my database. I would like to know how to test wit...
asked by 29.01.2016 / 19:26
0
answers

Error for importing JDBC from sqlServer with Maven

In my web java application, I needed to add a connection to a sql server database, so I put it as maven dependency as described below: <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>...
asked by 06.08.2018 / 17:00
1
answer

Why does my DriverManager return null pointer?

PostgreSQL 9.4 I run my class Noticias() . Within method public static void main() of class Noticias() the call is made from a getConexao() method; When I run pagecontroller?=p=noticias in the browser...
asked by 20.06.2015 / 19:44