Connect to Mapd using "spring-boot-starter-jdbc"


#1

I’m having trouble connecting to MapD using spring JDBC:
@Autowired
private JdbcTemplate jdbcTemplate;

when I make the injection above, it returns the following errors:

main] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata : Unable to determine Dialect to use [name=MapD DB, majorVersion=0]; user must register resolver or explicitly set ‘hibernate.dialect’

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]


#2

Hi,

MapD is not being recognized by Spring, so it cant determine the dialect to use.

Can you describe a little about your use case for MapD from a Spring frame work?

You could probably tell it to use postgres as the dialect and see where that takes you.

Regards


#3

Hi, I have been able to solve the dialect problem, but I have problems with the insert command. The mapD does not support setValues. Do you know how I can solve it?

public interface PreparedStatementSetter {

/ **

  • Set parameter values on the given PreparedStatement.
  • @param ps the PreparedStatement to invoke setter methods on
  • @throws SQLException if SQLException is encountered
  • (ie there is no need to catch SQLException)
  • /
    void setValues (PreparedStatement ps) throws SQLException;

}


#4

Hi,

It is up to you to create the code for the setValues in the Spring framework as I recall from working with Spring before.

SetValues() is not a JDBC api as far as I recall. This i something between you and your ORM normally.

As an aside, this will not be a good way to add a lot of records to MapD, singleton INSERT is the least performant of all data ingestion paths.

Reards