JRruby, Sybase JDBC and DBI - fetching column name with the AS clause issue

久未见 提交于 2019-12-03 21:53:18

I would guess that it's a bug in DBI, since the JDBC drivers have presumably been put through the mill for years. You may want to contact DBI folks to see if they have a suggestion.

Spasm

I can confirm it is the Sybase drivers. Using the jTDS (v1.2.5) from http://jtds.sourceforge.net/ I can get all the column names correctly defined in my query and can confirm that the original issue is NOT DBI

If anyone who is following this wondered how I got jtds working with DBI under jRuby please take a look at one of my former questions - it did take some time - and DBI is a little funny when specifying the URL use

dbi:Jdbc:jtds:sybase://<host>:<port>/<db>

Please note the capital J for Jdbc

I hope this saves someone a lot of time ;-)

Sybase 6.0 JDBC drivers has some "interesting" behavior dealing with aliases. The resultSet.findColumn method will fail on a table column name lookup if an alias is defined.

There are some properties you can set on the connect to change some of these behaviors or just use the JTDS drivers.

http://manuals.sybase.com/onlinebooks/group-jc/jcg0600e/prjdbc/@Generic__BookTextView/1072;pt=1072;uf=0

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