Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: DBD::JDBC craziness

by basiliscos (Pilgrim)
on Apr 05, 2014 at 11:46 UTC ( [id://1081235]=note: print w/replies, xml ) Need Help??


in reply to DBD::JDBC craziness

I can advice you just to check whether the required methods work in pure java, i.e. write an simple java cli-app, that checks available tables and databases. Here is a small snapshots of java-code, that queries for DB-meta information using JDBC.

import java.sql.Connection; import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; private static DataSource getDataSource(){ String login = "root", pwd = "kne"; String url = "jdbc:mysql://localhost:3306/test"; BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName("com.mysql.jdbc.Driver"); ds.setUsername(login); ds.setPassword(pwd); ds.setUrl(url); return ds; } private static Object show(ResultSet rs, String title) throws Exce +ption{ Object r = null; System.out.println("[showing " + title + "]"); ResultSetMetaData rsmd = rs.getMetaData(); while(rs.next()){ for(int c = 1; c <= rsmd.getColumnCount(); c++){ String name = rsmd.getColumnName(c); Object value = rs.getObject(c); System.out.println(name + " : " + value); if(r == null){ r = value; } } } System.out.println(); return r; } public static void main(String[] args) throws Exception{ DataSource ds = getDataSource(); Connection con = ds.getConnection(); DatabaseMetaData dbMetaData = con.getMetaData(); ResultSet catalogs = dbMetaData.getCatalogs(); String catalog = (String)show(catalogs, "catalogs"); ResultSet schemas = dbMetaData.getSchemas(); String schema = (String)show(schemas, "schemas"); ResultSet tables = dbMetaData.getTables("test", null, "", null +); show(tables, "tables"); System.out.println("ok"); }

So, you should validate, that JDBC driver you provide, actually works, and supports metainformation retrieval. As altenative you can download SQuirrelSQL, attach your jdbc-drivers for Phoenix, and check, that it actually works.

So, it might be, that HBase or Phoenix, or JDBC driver does not support some operations. Only after assertion of that, you should look at perl's DBD::JDBC

PS. Too much bridges/layers!

Replies are listed 'Best First'.
Re^2: DBD::JDBC craziness
by spragues (Initiate) on Apr 08, 2014 at 19:29 UTC

    thank you. for sure the phoenix jar file provides the getMetaData method. And like you say just way too many layers going on here.

    so i guess that begs the question. if a jdbc driver exists how does one go about actually writing a legitimate perl driver that leverages it, say in this case, DBD::Phoenix?

    something tells me - PUNT! :(

    thanks again for responding!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1081235]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-25 08:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found