Skip to content
Advertisement

Tag: jdbc

What is the purpose of the Hibernate ReturningWork interface?

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

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

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

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.

Advertisement