Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Trying to access array offset on value of type bool in /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758

Warning: Cannot modify header information - headers already sent by (output started at /home/feltexco/public_html/felix/wp-content/plugins/google-maps-ready/modules/options/models/options.php:16) in /home/feltexco/public_html/felix/wp-includes/rest-api/class-wp-rest-server.php on line 1758
{"id":519,"date":"2014-03-23T22:25:33","date_gmt":"2014-03-24T01:25:33","guid":{"rendered":"http:\/\/www.feltex.com.br\/felix\/?p=519"},"modified":"2015-01-25T23:56:23","modified_gmt":"2015-01-26T01:56:23","slug":"jdbc-conectar-banco-dados-via-odbc","status":"publish","type":"post","link":"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/","title":{"rendered":"JDBC: Conectar com Banco de Dados via ODBC"},"content":{"rendered":"

JDBC: Conectar com Banco de Dados via ODBC<\/H1><\/p>\n

Ol\u00e1 amigos!
\n Hoje iremos aprender como realizar uma conex\u00e3o com o Banco de Dados atrav\u00e9s de ODBC – Open Database Connectivity. Essa forma de conex\u00e3o \u00e9 muito simples, pois nossa aplica\u00e7\u00e3o n\u00e3o precisa ter: Driver de conex\u00e3o com o Banco, o nome do banco, o usu\u00e1rio ou a senha. Isso tudo fica configurado no ODBC. Ent\u00e3o Conectar com Banco de Dados via ODBC \u00e9 como fazer utiliza\u00e7\u00e3o de um datasource externo \u00e0 nossa aplica\u00e7\u00e3o.<\/p>\n

Muito simples mesmo! Parece at\u00e9 magia, mas \u00e9 TECNOLOGIA!
\n<\/p>\n

\u00c9 importante deixar claro para voc\u00ea leitor que a partir da vers\u00e3o do Java 8<\/strong>. N\u00e3o ser\u00e1 mais poss\u00edvel utilizar este tipo de conex\u00e3o. Ent\u00e3o conectar com Banco de Dados via ODBC \u00e9 uma possibilidade vi\u00e1vel apenas nas vers\u00f5es at\u00e9 o java 7.<\/p>\n

\r\npackage br.com.feltex.bancodados;\r\n\r\nimport java.sql.Connection;\r\nimport java.sql.DatabaseMetaData;\r\nimport java.sql.DriverManager;\r\nimport java.sql.ResultSet;\r\n\r\npublic class ConexaoODBC {\r\n\r\n\tpublic static void main(String[] args) {\r\n\r\n\t\ttry {\r\n\t\t\tClass.forName(\"sun.jdbc.odbc.JdbcOdbcDriver\").newInstance();\r\n\t\t\tConnection con = DriverManager.getConnection(\"jdbc:odbc:MeuODBC\",\r\n\t\t\t\t\t\"\", \"\");\r\n\t\t\tDatabaseMetaData d = con.getMetaData();\r\n\t\t\tResultSet rs = d.getTables(null, null, \"%\", null);\r\n\t\t\twhile (rs.next()) {\r\n\t\t\t\tSystem.out.println(rs.getString(3));\r\n\t\t\t}\r\n                        rs.close();\r\n\t\t\tcon.close();\r\n\t\t} catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}\r\n}\r\n<\/pre>\n

Abra\u00e7os e bons estudos! E vida que segue!
\n

Links relacionados <\/H2><\/p>\n

Exemplo completo com JSF Primefaces + Hibernate + MySQL<\/a><\/p>\n

JDBC: Conectar com Banco de Dados SQLServer<\/a><\/p>\n

JDBC: Conectar com Banco de Dados via ODBC<\/a><\/p>\n

JDBC: Conectar com Banco de Dados PostgreSQL<\/a><\/p>\n

JDBC: Conectar com Banco de Dados Microsoft Access<\/a>
\n
JDBC: Aprenda a conectar com Banco de Dados MySQL<\/a><\/p>\n

N\u00e3o se esque\u00e7a de curtir este post nas redes sociais. D\u00ea a sua contribui\u00e7\u00e3o social e ajude o autor:<\/H2><\/p>\n","protected":false},"excerpt":{"rendered":"

JDBC: Conectar com Banco de Dados via ODBC Ol\u00e1 amigos! Hoje iremos aprender como realizar uma conex\u00e3o com o Banco de Dados atrav\u00e9s de ODBC – Open Database Connectivity. Essa forma de conex\u00e3o \u00e9 muito simples, pois nossa aplica\u00e7\u00e3o n\u00e3o …<\/p>\n

JDBC: Conectar com Banco de Dados via ODBC<\/span> Read More »<\/a><\/p>\n

<\/p>\n","protected":false},"author":1,"featured_media":1832,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[5,1],"tags":[],"yoast_head":"\nJDBC: Conectar com Banco de Dados via ODBC<\/title>\n<meta name=\"description\" content=\"JDBC: Conectar com Banco de Dados via ODBC. Aprenda uma forma diferente de acessar banco de dados em Java.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JDBC: Conectar com Banco de Dados via ODBC\" \/>\n<meta property=\"og:description\" content=\"JDBC: Conectar com Banco de Dados via ODBC. Aprenda uma forma diferente de acessar banco de dados em Java.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/\" \/>\n<meta property=\"og:site_name\" content=\"Aprenda Java\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/feltex.br\" \/>\n<meta property=\"article:published_time\" content=\"2014-03-24T01:25:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-01-26T01:56:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/03\/ODBC.png\" \/>\n\t<meta property=\"og:image:width\" content=\"512\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andr\u00e9 F\u00e9lix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#website\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/\",\"name\":\"Aprenda Java\",\"description\":\"Cursos de java, SQL e Engenharia de Software\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.feltex.com.br\/felix\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#primaryimage\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/03\/ODBC.png\",\"contentUrl\":\"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/03\/ODBC.png\",\"width\":512,\"height\":512},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#webpage\",\"url\":\"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/\",\"name\":\"JDBC: Conectar com Banco de Dados via ODBC\",\"isPartOf\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#primaryimage\"},\"datePublished\":\"2014-03-24T01:25:33+00:00\",\"dateModified\":\"2015-01-26T01:56:23+00:00\",\"author\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069\"},\"description\":\"JDBC: Conectar com Banco de Dados via ODBC. Aprenda uma forma diferente de acessar banco de dados em Java.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"JDBC: Conectar com Banco de Dados via ODBC\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069\",\"name\":\"Andr\\u00e9 F\\u00e9lix\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.feltex.com.br\/felix\/#personlogo\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g\",\"caption\":\"Andr\\u00e9 F\\u00e9lix\"},\"sameAs\":[\"http:\/\/www.feltex.com.br\"],\"url\":\"https:\/\/www.feltex.com.br\/felix\/author\/andre.felix\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JDBC: Conectar com Banco de Dados via ODBC","description":"JDBC: Conectar com Banco de Dados via ODBC. Aprenda uma forma diferente de acessar banco de dados em Java.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/","og_locale":"pt_BR","og_type":"article","og_title":"JDBC: Conectar com Banco de Dados via ODBC","og_description":"JDBC: Conectar com Banco de Dados via ODBC. Aprenda uma forma diferente de acessar banco de dados em Java.","og_url":"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/","og_site_name":"Aprenda Java","article_publisher":"https:\/\/www.facebook.com\/feltex.br","article_published_time":"2014-03-24T01:25:33+00:00","article_modified_time":"2015-01-26T01:56:23+00:00","og_image":[{"width":512,"height":512,"url":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/03\/ODBC.png","type":"image\/png"}],"twitter_misc":{"Escrito por":"Andr\u00e9 F\u00e9lix","Est. tempo de leitura":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/www.feltex.com.br\/felix\/#website","url":"https:\/\/www.feltex.com.br\/felix\/","name":"Aprenda Java","description":"Cursos de java, SQL e Engenharia de Software","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.feltex.com.br\/felix\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-BR"},{"@type":"ImageObject","@id":"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#primaryimage","inLanguage":"pt-BR","url":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/03\/ODBC.png","contentUrl":"https:\/\/www.feltex.com.br\/felix\/wp-content\/uploads\/2014\/03\/ODBC.png","width":512,"height":512},{"@type":"WebPage","@id":"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#webpage","url":"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/","name":"JDBC: Conectar com Banco de Dados via ODBC","isPartOf":{"@id":"https:\/\/www.feltex.com.br\/felix\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#primaryimage"},"datePublished":"2014-03-24T01:25:33+00:00","dateModified":"2015-01-26T01:56:23+00:00","author":{"@id":"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069"},"description":"JDBC: Conectar com Banco de Dados via ODBC. Aprenda uma forma diferente de acessar banco de dados em Java.","breadcrumb":{"@id":"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.feltex.com.br\/felix\/jdbc-conectar-banco-dados-via-odbc\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"JDBC: Conectar com Banco de Dados via ODBC"}]},{"@type":"Person","@id":"https:\/\/www.feltex.com.br\/felix\/#\/schema\/person\/1e49f842c6254b4561b66ccf573c2069","name":"Andr\u00e9 F\u00e9lix","image":{"@type":"ImageObject","@id":"https:\/\/www.feltex.com.br\/felix\/#personlogo","inLanguage":"pt-BR","url":"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d2d9cc82cab40245e6f803982b1448e6?s=96&r=g","caption":"Andr\u00e9 F\u00e9lix"},"sameAs":["http:\/\/www.feltex.com.br"],"url":"https:\/\/www.feltex.com.br\/felix\/author\/andre.felix\/"}]}},"_links":{"self":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/519"}],"collection":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/comments?post=519"}],"version-history":[{"count":9,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/519\/revisions"}],"predecessor-version":[{"id":1767,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/posts\/519\/revisions\/1767"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/media\/1832"}],"wp:attachment":[{"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/media?parent=519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/categories?post=519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.feltex.com.br\/felix\/wp-json\/wp\/v2\/tags?post=519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}