Skip to content
Advertisement

Tag: jdbc

Unable to retrieve data from database through JDBC query

I trying to make a connection to my DDBB in order to print all the columns from a table but I keep getting Null. I have checked the connection parameters and everything seems correct. I’m thinking that maybe there is something wrong with my query statement: Answer I managed to solve the problem by adding the MySQL Connector to the

How to select by DATE type in jdbc using oracle DB?

In my Database created_date colum of data type is DATE and I want to select by DATE type in jdbc using ORACLE database, but when I run this method like this , I have getting this error. How to solve this problem? I have tried many things, but coludn’t solved. Answer The main problem here is that you are binding

What is the correct SQLException / spring data exception for missing permissions

I just noticed that when you try to execute a query that does not have required permissions (only tested on a mysql 5.7 database using the mysql-connector-java v8 driver) it is translated to a org.springframework.jdbc.BadSqlGrammarException. This is because the mysql driver itself throws a java.sql.SQLSyntaxErrorException. For instance: java.sql.SQLSyntaxErrorException: INSERT command denied to user ‘myuser’@’127.0.0.1’ for table ‘mytable’ Is this correct

JOOQ Setup Oracle with Maven Code Generation

I am trying to setup an Oracle database with JOOQ on Maven for Code Generation. Currently trying to connect with Oracle Database JDBC. https://www.jooq.org/doc/2.6/manual/code-generation/codegen-configuration/ The following example from resource is Postgresql. What is the syntax for Dependencies for Oracle setup? Answer Newer versions of ojdbc are now on Maven Central, too, e.g. Please refer to Oracle’s documentation for more information.

Get Timestamp in specific format

I have a timestamp saved in Azure SQL Database in the format of 2004-09-23 10:52:00. When I fetch the value, I am using sqlrowset where I am using getString(“last_updated_user”) and getting output like this “2004-09-23 10:52:00.0”. When I tried using getTimeStamp(“last_updated_user”), I am getting in microseconds. Can someone help me on formatting it to “2004-09-23 10:52:00” based on some in-built

Communication link failure in mysql jdbc driver

I’am not able to establish connection with mysql from java using this code It’s throwing me this error The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. The driver has not received any packets from the server. No appropriate protocol (protocol is disabled or cipher suites are

BigQuery TableResult casting options

How can I cast the TableResult to the following format List<Map<String, Any>> Map contains the columns and its value respectively. Multiple rows are added to the list. I tried something like this, but it throws an error -> com.google.cloud.bigquery.TableResult cannot be cast to java.util.List How can we replicate something similar to jdbc template. For example with jdbc template we can

How to reset a JDBC Connection object?

How to reset a JDBC Connection object (that is, a java.sql.Connection object)? I have explored the concept of connection pooling. When a connection pool is used, a Connection object can be recycled. But how can a connection pool recycle a Connection object? I think that a connection needs to be “reset” (for example, if it is in a transaction, then

Advertisement