Questions tagged [JDBC] (102)

1
answer

How to register the URL for the DB connection, if I connect to it via VPN?

Porubay VPN and connect to Microsoft SQL Server Management Studio to the database. How correctly to register the url of the connection in the program?
daphnee.Littel94 asked April 8th 20 at 02:58
1
answer

How to save a file stored in the database as VARBINARY?

Our database files are stored as varbinary. Tell me the ways how it can be removed from the request and store it in the program that then can be converted back to a file.
Kevin_Kilback asked April 8th 20 at 02:46
1
answer

Whether the application makes the database queries?

Hello! There is a java program which is using JDBC connecting to a MySQL database. The connection is hardly something different from 98% implementations: private static Connection createConnection() { try { Class.forName(controllerDB); } catch (ClassNotFoundException e) { e.printStackTrace(); } Connection connection =...
Jennie.Harvey asked April 8th 20 at 02:10
2
answers

How to fix Can't use query methods that take a query string on a PreparedStatement?

Want to add a new value, but there is a bug though, if you go to the table itself, the values shown: org.postgresql.util.PSQLException: Can't use query methods that take a query string on a PreparedStatement. at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:95) at M2.main(M2.java:22) Error ...
jaiden_Sipe asked April 7th 20 at 09:29
2
answers

Not connected connection = getConnection(URL, USERNAME, PASSWORD);. How to connect a database to the environment?

Mounts the database. If you zakamentuj line connection = getConnection(URL, USERNAME, PASSWORD);, everything works. Can't understand what the error is. PS pattern as it was fucking darkness of errors, working with multiple directories, but the fix does not work<?xml version="1.0" encoding="UTF-8"?> <project xmlns=...
Lorenza_Larson asked April 4th 20 at 13:04
1
answer

What error java.sql.SQLException: No suitable driver found for jdbs:mysql://localhost:3306/mydbtest?

The full text of the output in the console: com.mysql.cj.jdbc.Driver@6267c3bb Driver registered successfully The connection is not established java.sql.SQLException: No suitable driver found for jdbs:mysql://localhost:3306/mydbtest at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702) at java.sql/java.s...
Amina_Mann asked April 4th 20 at 01:27
1
answer

How to maintain a connection with the current table H2 database?

Good day ! I'm only familiar with the H2 database and here is the question. Here a connection is created:Connection connection=null; try{ Class.forName("org.h2.Driver"); connection= DriverManager.getConnection("jdbc:h2:~/test"); System.out.println("Connection ok"); Statement stat = connection.createStatement(); stat...
Tristian18 asked April 2nd 20 at 17:34
2
answers

Error when adding record to mysql database Java jdbc?

Hello everyone, I'm a beginner learning java was faced with a problem, namely when adding a record to a mysql error occurs. The code itselfprivate void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try { String name = jTextField1.getText(); Statement statement = con.createStatement(); String query = "INSERT...
dustin asked March 25th 20 at 11:32
1
answer

Error when calling a method getImportedKeys?

Guys, Hello! Need to foreign key.Class.forName("org.postgresql.Driver"); Connection connection = DriverManager.getConnection(configDataBase.getUrl(), configDataBase.getName(), configDataBase.getPassword()); Statement statement = connection.createStatement(); ResultSet rsSql = statement.executeQuery("select * from table_nam...
Devan49 asked March 24th 20 at 10:59
1
answer

Why not JdbcTemplate executes query with parameters?

The task is to write a parameterized SQL query using JDBC and Template'. Create a table:jdbcTemplate.execute(" CREATE TABLE test (id BIGINT PRIMARY KEY, test_id VARCHAR(50));"); Declare the parameters:Map<String, String> parameters = new HashMap(); parameters.put("test_id", "test"); Update:jdbcTemplate.update( "INSE...
Wade_Spin asked March 24th 20 at 10:58