I am working on one JAVA + Hibernate project but currently, I saw one interface in my code (i.e. ReturningWork<Long>) which has one method called execute(java.sql.Connection). My question is what is the use of this ReturningWork interface? Answer As I explained in more details on my blog, you can use the ReturningWork and the Work interfaces to implement any logic
Tag: jdbc
LocalDateTime and SQL Server JDBC 4.2 driver
I’m trying to use new java.time classes with most recent version of Sql Server JDBC driver. As I read it should just work with methods: PreparedStatement.setObject() and ResultSet.getObject(). So I created sample code, and can’t get it work with ResultSets. I don’t know what I’m doing wrong here. This throws an exception: com.microsoft.sqlserver.jdbc.SQLServerException: The conversion to class java.time.LocalDateTime is unsupported.
Select database columns for a JDBC statement query
I try to execute this: but i get this result from my tomcat server logs: Please take note that I have inspected by database tables and the comment_desc is a column. In fact I try another column’s output string and I get a result. Answer If you only need those two columns you could do something like this: Try and
java.sql.SQLException: Unknown system variable ‘query_cache_size’
I have a app running with JDBC and get data from MySQL, but I can’t build it because of this error : I have file application.properties here Mysql workbench is 8.0 version Answer query_cache_size was removed in MySQL 8. Check the docs. It works with JDBC driver 5.1.44.
Invalid column name exception – JdbcPagingItemReader query with alias
Spring batch step fails when JdbcPagingItemReader query has a join and alias. It works fine when I remove the join and just do a simple query from employee table. Below is the code snippet that fails. Did anyone encounter such an issue ? Any help would be appreciated. spring-batch-core-4.0.1.RELEASE spring-boot-2.0.0.RELEASE Caused by: java.sql.SQLException: Invalid column name at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3965) ~[ojdbc6-11.2.0.3.jar:12.1.0.1.0] at
“NoClassDefFoundError: javax/xml/bind/DatatypeConverter” with SQL Server JDBC
I recently switched to intellij but I’m finding it hard to connect to my localDB. The same code worked on eclipse fine. Also I have already added the sqljdbc42.jar as a module dependency. Error produced: Any help would be greatly appreciated. I’ve also tried the overloaded DriverManager.getConnection(url, user, pass) method and same error. Answer For Java 9+ compatibility, you need
Can I specify *source* IP address for a JDBC connection?
I have a Java application that connects to a database with a JDBC driver. It happens to be a Postgres instance, but I’m looking for a general solution if it exist. The server on which the application runs has multiple IP address, all in the same subnet. The JDBC connection is established using the ‘primary’ IP of the server. I
Unable to connect to Phoenix using JDBC
I have a Hadoop Cluster set up with HBase and Phoenix and I’m trying to connect to Phoenix using JDBC, but I am sort of unable to get a successful connection. I want to use JDBC to connect using Python 3.x but as for simple test purposes I set up a connection using Java in Eclipse. I was originally using
Getting compile failure for maven build.. package COM.ibm.db2.jdbc.app does not exist
I am getting maven compile error package COM.ibm.db2.jdbc.app does not exist when I am trying to build my maven project with db2 jars and zips. The code compiles for db2 jars/zip in RAD. My nexus reposistory has the following files and dependencies defined and I am able to use them in my pom as well. This is the source code
Mapping SQL NUMERIC[10,0] to java type
I need to map NUMERIC[10,0] parameter type of a sybase stored procedure to a java type. What would be this type? Also, if you can help me define a regular expression for this NUMERIC[10,0] type I’ll be greatful. Answer Use Long as Integer is to short to map all possible values. Have a look at MAX_VALUE of both types.