cancel
Showing results for 
Search instead for 
Did you mean: 

setting CONNECTION_AUTHENTICATION in hibernate

Former Member
4,145

I am developing an application using hibernate.when I try to set the "CONNECTION_AUTHENTICATION" signature via hibernate,it is returning error "node to traverse cannot be null".am i missing something.could you please help me to understand,how to set CONNECTION_AUTHENTICATION in hibernate...

VolkerBarth
Contributor
0 Kudos

I'm not familiar with Hibernate but I guess you should either be able to embed the SET TEMPORARY OPTION statement

  • in a call executeUpdate method on a JDBC statement or
  • add the InitSting connection parameter to the JDBC connection string - cf. this doc page:

Authentication statement execution

Accepted Solutions (0)

Answers (1)

Answers (1)

jeff_albion
Advisor
Advisor

Which JDBC driver are you using with Hibernate - jConnect or the SQL Anywhere JDBC driver?

  • jConnect: As per the jConnect documentation, there is a connection property SQLINITSTRING that can be set on the connection. This is then configured via the Hibernate hibernate.connection.SQLINITSTRING property:

    cfg = new Configuration()
             .setProperty( "hibernate.connection.SQLINITSTRING", "SET TEMPORARY OPTION connection_authentication='Company=MyCo;Application=MyApp;Signature=0fa55159999e14d818e...'");
    

The JDBC URL is specified as usual.

  • SQL Anywhere JDBC: This is set via the InitString connection property on the JDBC URL:

    cfg = new Configuration()
             .setProperty( "hibernate.connection.url", "jdbc:sqlanywhere:UID=dba;PWD=sql;SERVER=demo;InitString=SET TEMPORARY OPTION connection_authentication='Company=MyCo;Application=MyApp;Signature=0fa55159999e14d818e...'");
    

These properties can also be set via the hibernate.cfg.xml file, as usual.