JDBC connection for Sybase with authentication query

余生长醉 提交于 2019-12-10 17:45:29

问题


I have a datasource that connects to Sybase database. I need to execute the authentication statement (SET TEMPORARY OPTION CONNECTION_AUTHENTICATION='Company....) after I connect to the database.

Is there any way of executing this statement as part of the validationQuery in the JDBC connection param so that the connection is automatically authenticated?

ANSWER:

I have managed to get answer for this !!!

This can be done by setting it in the connection url with the below parameter

SQLINITSTRING=SET TEMPORARY OPTION CONNECTION_AUTHENTICATION='Company.......


回答1:


Maybe Sybase login triggers are something you could use. Here the steps i would do:

  1. Create a stored procedure which is executing your statement
  2. Create a new dedicated database login
  3. Assigne the login trigger to the newly created stored procedure.

More information about login triggers you find here: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.sag1/html/sag1/sag1804.htm



来源:https://stackoverflow.com/questions/12778338/jdbc-connection-for-sybase-with-authentication-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!