{"id":632,"date":"2021-03-03T16:33:02","date_gmt":"2021-03-03T08:33:02","guid":{"rendered":"https:\/\/nj.transwarp.cn:8180\/?p=632"},"modified":"2024-10-29T15:45:44","modified_gmt":"2024-10-29T07:45:44","slug":"linux-odbc%e8%bf%9e%e6%8e%a5inceptor","status":"publish","type":"post","link":"https:\/\/kbwp.transwarp.cn\/?p=632","title":{"rendered":"Linux ODBC \u8fde\u63a5 Inceptor"},"content":{"rendered":"<h3>\u6982\u8981\u63cf\u8ff0<\/h3>\n<hr \/>\n<p>\u672c\u6587\u8bb0\u5f55 linux \u73af\u5883\u4e0b\uff0c\u5b89\u88c5 odbc \u9a71\u52a8\uff0c\u914d\u7f6e odbc \u6570\u636e\u6e90\uff0c\u4ee5\u53ca\u5982\u4f55\u7528 odbc \u9a71\u52a8\u8fde\u63a5 Inceptor \u7684\u6b65\u9aa4\uff1b<\/p>\n<h3>\u8be6\u7ec6\u8bf4\u660e<\/h3>\n<hr \/>\n<h4>1\u3001\u5b89\u88c5\u5e76\u914d\u7f6e Driver Manager<\/h4>\n<p>\u7531\u4e8eLinux\u7cfb\u7edf\u6ca1\u6709\u63d0\u4f9bODBC Driver Manager\uff0c\u9700\u8981\u81ea\u884c\u4e0b\u8f7d\uff1a<\/p>\n<pre><code class=\"language-shell\">wget ftp:\/\/ftp.unixodbc.org\/pub\/unixODBC\/unixODBC-2.3.12.tar.gz<\/code><\/pre>\n<p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u7f16\u8bd1\u5e76\u5b89\u88c5 driver manager\uff0c\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"language-shell\">tar -xvzf unixODBC-2.3.12.tar.gz\ncd unixODBC-2.3.12\/\n.\/configure --sysconfdir=\/etc\nmake\nmake install<\/code><\/pre>\n<p>\u914d\u7f6e\u73af\u5883\u53d8\u91cfPATH\u548cLD_LIBRARY_PATH\uff0c\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"language-shell\">export PATH=\/usr\/local\/bin:${PATH}\nexport LD_LIBRARY_PATH=\/usr\/local\/lib\/:${LD_LIBRARY_PATH}<\/code><\/pre>\n<p>\u6d4b\u8bd5driver manager\u662f\u5426\u5b89\u88c5\u6210\u529f\uff0c\u8fd0\u884codbcinst -j\uff0c\u8f93\u51fa\u6837\u4f8b\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-shell\"># odbcinst -j\nunixODBC 2.3.12\nDRIVERS............: \/etc\/odbcinst.ini\nSYSTEM DATA SOURCES: \/etc\/odbc.ini\nFILE DATA SOURCES..: \/etc\/ODBCDataSources\nUSER DATA SOURCES..: \/root\/.odbc.ini\nSQLULEN Size.......: 8\nSQLLEN Size........: 8\nSQLSETPOSIROW Size.: 8<\/code><\/pre>\n<p><strong>\u6b64\u5904\u8981\u786e\u4fdd\uff1a<\/strong><br \/>\nDRIVERS \u7684\u503c\u4e3a <strong><code>\/etc\/odbcinst.ini<\/code><\/strong>\uff1b<br \/>\nSYSTEM DATA SOURCES \u7684\u503c\u4e3a <strong><code>\/etc\/odbc.ini<\/code><\/strong><\/p>\n<h4>2\u3001\u5b89\u88c5\u5e76\u914d\u7f6eODBC\u9a71\u52a8<\/h4>\n<h5>\u4e0b\u8f7d\u5e76\u5b89\u88c5\u9a71\u52a8<\/h5>\n<p>1.\u4e0b\u8f7dLinux ODBC\u9a71\u52a8\u7a0b\u5e8f\uff0cmanager \u7684 inceptor \u670d\u52a1\u9875\u9762\uff0c\u5982\u4e0b\u56fe\u3002\u9009\u62e9\u5bf9\u5e94\u5e73\u53f0\u7684\u5b89\u88c5\u5305\uff0c\u5176\u4e2d Centos 6 \u548c Centos 7 \u5747\u53ef\u4f7f\u7528 <strong><code>inceptor-connector-odbc-x.x.x-1.el6.x86_64<\/code><\/strong><br \/>\n<img decoding=\"async\" src=\"\/wp-content\/uploads\/2021\/03\/image-1616739472349.png\" alt=\"file\" \/><br \/>\n<img decoding=\"async\" src=\"\/wp-content\/uploads\/2021\/03\/image-1616739599971.png\" alt=\"file\" \/><\/p>\n<p>2.\u5b89\u88c5\u9a71\u52a8\uff0c\u4ee5CentOS 6 64\u4f4d\u4e3a\u4f8b\uff0c\u5b89\u88c5rpm\u5305\uff1a<\/p>\n<pre><code class=\"language-shell\">rpm -ivh inceptor-connector-odbc-*.x86_64.rpm --nodeps<\/code><\/pre>\n<p>3.\u62f7\u8d1d\u914d\u7f6e\u6587\u4ef6\uff0cInceptor ODBC \u76f8\u5173\u7684\u914d\u7f6e\u6587\u4ef6\u5305\u62ec\u4e09\u4e2a\uff0c\u5b89\u88c5rpm\u5305\u540e\uff0c\u914d\u7f6e\u6587\u4ef6\u4f1a\u88ab\u653e\u7f6e\u5728<strong><code>\/usr\/local\/inceptor\/<\/code><\/strong>\u4e0b\uff1a<\/p>\n<ul>\n<li>\/usr\/local\/inceptor\/log4cplus.properties <\/li>\n<li>\/usr\/local\/inceptor\/odbc.ini <\/li>\n<li>\/usr\/local\/inceptor\/odbcinst.ini<\/li>\n<\/ul>\n<p>\u8bf7\u5c06\u8fd9\u4e09\u4e2a\u6587\u4ef6\u62f7\u8d1d\u5230 \/etc\/ \u76ee\u5f55\u4e0b\u8986\u76d6\u539f\u6709\u7684\u914d\u7f6e\u6587\u4ef6\u3002\u8fd9\u4e09\u4e2a\u6587\u4ef6\u7684\u4f5c\u7528\u5206\u522b\u5982\u4e0b\uff1a<\/p>\n<p><strong>odbcinst.ini<\/strong> \u63cf\u8ff0\u4e86 ODBC \u9a71\u52a8\u540d\u5b57\u548c\u9a71\u52a8\u7a0b\u5e8f\u7684\u5173\u7cfb\uff1a<\/p>\n<ul>\n<li><strong>[ODBC]<\/strong> \u6307\u5b9aDriver Manager\u4fe1\u606f\uff1aTrace = Yes \u8868\u660e\u5f53\u524d\u72b6\u6001\u6253\u5f00 Driver Manager \u7684\u65e5\u5fd7\uff0c\u65e5\u5fd7\u7684\u4f4d\u7f6e\u4e3a \/tmp\/odbc-driver-manager.log\u3002\u8fd9\u91cc\u6211\u4eec\u5efa\u8bae\u4fee\u6539\u4e3aNo\uff0c\u5426\u5219\u540e\u671f\u6709\u53ef\u80fd\u56e0\u4e3a \/tmp\/odbc-driver-manager.log \u6587\u4ef6\u8fc7\u5927\u5360\u7528\u6839\u76ee\u5f55\u3002<br \/>\nTrace \u503c\u4fee\u6539\u4e4b\u540e\uff0c\u9700\u8981\u91cd\u542f\u5e94\u7528\u624d\u80fd\u751f\u6548\uff08\u56e0\u4e3a\u6bcf\u6b21\u8fde\u63a5\u6570\u636e\u5e93\u65f6\uff0c\u5e94\u7528\u7a0b\u5e8f\u4f1a\u91cd\u65b0\u52a0\u8f7dODBC\u7684\u914d\u7f6e\u4fe1\u606f\u3002\uff09\u3002<\/li>\n<li><strong>[Transwarp Inceptor ODBC Driver]<\/strong> \u6807\u7b7e\u4e0b\u7684 Driver \u5b57\u6bb5\u6307\u5411 ODBC \u7684\u9a71\u52a8\u4f4d\u7f6e \/usr\/local\/lib64\/libODBC4HiveServer2.so<\/li>\n<\/ul>\n<p><strong>odbc.ini<\/strong> \u6587\u4ef6\u63cf\u8ff0\u4e86 DSN \u7684\u914d\u7f6e\u4fe1\u606f<\/p>\n<p><strong>log4cplus.properties<\/strong> \u4e3a ODBC log \u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<h4>3\u3001\u914d\u7f6eInceptor ODBC<\/h4>\n<p>\u5728\u4f7f\u7528 ODBC \u9a71\u52a8\u8fde\u63a5 Inceptor \u6570\u636e\u5e93\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u914d\u7f6e ODBC \u6570\u636e\u6e90\u540d\u79f0\uff08DSN\uff09\uff0cDSN\u5b9a\u4e49\u4e86\u8fde\u63a5\u6570\u636e\u5e93\u6240\u9700\u7684\u5404\u79cd\u914d\u7f6e\u53c2\u6570\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u5e94\u7528\u4e2d\u4f7f\u7528DSN\u4e0e\u6570\u636e\u5e93\u4ea4\u4e92\uff0c\u907f\u514d\u4e86\u5728\u5e94\u7528\u4e2d\u5355\u72ec\u5b9a\u4e49\u5404\u4e2a\u53c2\u6570\u3002DSN\u5206\u4e3a\u7528\u6237DSN\u3001\u7cfb\u7edfDSN\u3001\u6587\u4ef6DSN\uff0c\u7528\u6237\u53ef\u4ee5\u6839\u636e\u64cd\u4f5c\u7cfb\u7edf\u548cODBC\u9a71\u52a8\u9009\u62e9\u4e0d\u540c\u7684\u65b9\u5f0f\u3002<\/p>\n<h5>ODBC\u6570\u636e\u6e90\u540d\u79f0\u6982\u89c8<\/h5>\n<p>DSN\u5b9a\u4e49\u4e86\u8fde\u63a5\u6570\u636e\u5e93\u6240\u9700\u7684\u5404\u79cd\u914d\u7f6e\u53c2\u6570\uff0c\u901a\u5e38\u6709\u5982\u4e0b\u53c2\u6570\uff1a<\/p>\n<ul>\n<li>Data Source Name\uff1aDSN\u7684\u540d\u79f0\uff0c\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u6839\u636e\u540d\u5b57\u6307\u5b9a\u67d0\u4e00\u4e2a\u5177\u4f53\u7684DSN\u3002<\/li>\n<li>Description\uff1aDSN\u7684\u63cf\u8ff0\u4fe1\u606f\u3002<\/li>\n<li>Host\uff1a\u6570\u636e\u5e93\u7684IP\u5730\u5740\u3002<\/li>\n<li>Port: \u7aef\u53e3\u53f7\uff0c\u9ed8\u8ba4\u4f7f\u752810000\u3002<\/li>\n<li>Database\uff1a\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u5b57\uff0c\u9ed8\u8ba4\u8fde\u63a5default\u6570\u636e\u5e93\u3002<\/li>\n<li>Inceptor Server Type\uff1a\u6307\u5b9a Inceptor Server \u7c7b\u578b\uff0c\u4eceTDH 4.7\u7248\u672c\u5f00\u59cb\uff0c\u4ec5\u652f\u6301 Inceptor Server 2\u3002<\/li>\n<li>Mechanism\uff1a\u5141\u8bb8\u4e09\u79cd\u8ba4\u8bc1\u65b9\u5f0f\uff0cNONE\u3001LDAP \u548c Kerberos\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u8fb9\u4ee5 LDAP \u8fde\u63a5\u4e3e\u4f8b\u914d\u7f6e DSN\uff0c\u5176\u4ed6\u65b9\u5f0f\u53ef\u4ee5\u53c2\u8003 ODBC \u8fde\u63a5\u624b\u518c<\/p>\n<pre><code class=\"language-shell\">[transwarp-hs2-ldap]\nDescription = LDAP test\nDriver = Transwarp Inceptor ODBC Driver\nServer = tdh522-183\nHive = Hive Server 2\nHost = 192.168.31.183\nPort = 10000\nDatabase = default\nUser = hive\nPassword = 123456\nMech = LDAP\n[transwarp-hs2-kerberos]\n[transwarp-hs1]\n[mysql]<\/code><\/pre>\n<p><strong>PS<\/strong>\uff1a<strong>[transwarp-hs2-ldap]<\/strong> \u6807\u7b7e\u4e0b\u914d\u7f6e\u4f7f\u7528 LDAP \u6a21\u5f0f\u4e0b\u7684 Inceptor Server 2 \u7684 DSN\u3002<\/p>\n<h4>4\u3001\u9a8c\u8bc1<\/h4>\n<p>\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u6d4b\u8bd5ODBC\u9a71\u52a8\u662f\u5426\u6b63\u786e\u5b89\u88c5\u548c\u914d\u7f6e\uff1a<\/p>\n<pre><code class=\"language-shell\"># \u547d\u4ee4\u8fde\u63a5\u683c\u5f0f isql {DSN\u540d\u79f0} {\u7528\u6237\u540d} {\u5bc6\u7801}\nisql transwarp-hs2-ldap hive 123456<\/code><\/pre>\n<p>\u8fde\u63a5\u6210\u529f\u7ed3\u679c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2021\/03\/image-1730188096666.png\" alt=\"file\" \/><\/p>\n<h4>5\u3001\u5e38\u89c1\u9519\u8bef\u89e3\u51b3\u65b9\u6cd5<\/h4>\n<ol>\n<li>\n<p>\u5982\u679c\u8fde\u63a5\u9519\u8bef\uff0c\u8bf7\u53c2\u8003 <a href=\"?p=5609\">ODBC \u8fde\u63a5 inceptor \u914d\u7f6e\u8fc7\u7a0b\u5e38\u89c1\u95ee\u9898<\/a> \u5c1d\u8bd5\u4fee\u590d\u3002<\/p>\n<\/li>\n<li>\n<p>kerberos\u8ba4\u8bc1\u4e0b\u62a5\u9519SASL Other: GSSAPI Error: Unspecified GSS failure.  Minor code may provide more information (No Kerberos credentials available (default cache: FILE:\/tmp\/krb5cc_0))<\/p>\n<p>\u9700\u8981\u5728yum install krb5-libs krb5-workstation krb5-server\u4e4b\u540e\uff0c\u5c1d\u8bd5 kinit \u4efb\u610f\u79df\u6237\uff0c\u751f\u6210\u4e00\u4e2a\/tmp\/krb5cc_0\u6587\u4ef6\uff0c\u4e0d\u53ef\u4ee5\u901a\u8fc7 touch \/tmp\/krb5cc_0 \u8fdb\u884c\u6784\u9020\uff0c\u4f1a\u62a5 Bad format in credentials cache (filename: \/tmp\/krb5cc_0)) \u7684\u9519\u8bef\u3002<\/p>\n<\/li>\n<li>\n<p>\u5176\u4ed6\u9519\u8bef\u548c\u5f02\u5e38\u53ef\u4ee5\u901a\u8fc7 log4j \u4e2d\u914d\u7f6e\u7684\u65e5\u5fd7\u8def\u5f84\u8fdb\u884c\u5206\u6790\uff0c\u6bd4\u5982\/ tmp\/odbc-driver-manager.log\u4ee5\u53ca\/tmp\/odbc.log<\/p>\n<\/li>\n<\/ol>\n<h4>6\u3001\u5177\u4f53\u4f7f\u7528\u6848\u4f8b<\/h4>\n<h5>Python<\/h5>\n<p>\u4f7f\u7528 Python\uff1a<\/p>\n<pre><code class=\"language-python\">import pyodbc\ncnxn = pyodbc.connect(\"DRIVER={Transwarp Inceptor ODBC Driver};DSN=transwarp-hs2-ldapp\")\ncursor = cnxn.cursor()\nresult = cursor.execute(\"show databases\").fetchall()\nprint(result)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/nj.transwarp.cn:8180\/wp-content\/uploads\/2021\/03\/image-1730187992202.png\" alt=\"file\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981\u63cf\u8ff0 \u672c\u6587\u8bb0\u5f55 linux \u73af\u5883\u4e0b\uff0c\u5b89\u88c5 odbc \u9a71\u52a8\uff0c\u914d\u7f6e odbc \u6570\u636e\u6e90\uff0c\u4ee5\u53ca\u5982\u4f55\u7528 odbc \u9a71 ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/kbwp.transwarp.cn\/?p=632\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-632","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"acf":[],"_links":{"self":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=632"}],"version-history":[{"count":5,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/632\/revisions"}],"predecessor-version":[{"id":14590,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=\/wp\/v2\/posts\/632\/revisions\/14590"}],"wp:attachment":[{"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kbwp.transwarp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}