Skip to content

Tag: jdbc

PrearedStatement executeUpdate() is not working

I’m new to JDBC and using the following code to update the row using MySQL JDBC driver. I have no idea why executeUpdate() is not updating the content in the database. Can anyone help me? Answer Your query string is wrong. It should be something like this: Look here for the proper syntax of update: Also if you want

Provide SSL certificate to SQL Server via JDBC

The Microsoft JDBC SSL documentation details the use of a Java keystore in order to specify a certificate bundle to use when validating the TLS connection. Is there a way to provide a certificate bundle without needing to store it within a JKS when connecting to a SQL Server database? Postgres seems to have a sslrootcert option which appears to

Mapping between DB2 XML CLOB data type and DB2 JDBC types are keep changing as upgrading to different JDBC versions

We were using v10.1 and recently we have upgraded it with the V11.1.4 FP5 driver for the z/OS Db2 systems. When we were using v10.1 the equivalent JDBC java class for DB2 XML CLOB was and now after upgrading it with V11.1.4 FP5 driver now, it changed to However in latest version v11.5 M7 FP0 it’s

Check if any value in list satisfies a condition

Suppose I have the following table called Seasons: … start_month end_month … 2 6 … 3 4 … … … I need to write a query which, for a given list of months, returns all the Seasons that satisfy the condition where at least 1 month in the list is: start_month <= month <= end_month. I’ve written this query as

Error while querying tables using hibernate

I am trying to query a table called student in MySQL. This is the structure: Here is the java code which I use to query: This is the error message: Here is the image of the referenced libraries: Insertion into table is working correctly. Only querying isn’t. What is the error here? Please comment if extra information is needed. UPDATE:

Result set is empty but query works in Postgres

I’m trying to get some results from Postgres into my Java application. As of now, I always used PreparedStatements with ResultSets to get data from my database in memory. But today my code refuses to work, although I use the same code as usual. Here is my piece of code: Here is the log: The ArrayList explicitCollectionsIds is empty/not filled

Compiling a function or procedure using JDBC removes all records from all_statements view

After I execute/compile a stored procedure/function, I query the all_statements view to extract the statements that were in the stored procedure/function like below: However, one of my applications run the following code: Whenever this code is run, the all_statements view is cleared. Even if I execute this same function like below: There are no new entries in all_statements showing the