Quantcast
Channel: Zoho Reports API
Viewing all articles
Browse latest Browse all 71

MetaData-java :: Version2.8

$
0
0

Zoho Reports Metadata

Currently you can obtain the Zoho Report's metadata using the JDBC Driver. Follow the below links to get started.

Sample:

The following code snippet shows the list of databases created by the demouser in Zoho Reports.

import java.util.*;
import java.sql.*;
import java.net.URLEncoder;
import java.io.*;
public class Zoho_GetCatalogs
{
private static final String APIKEY= "bfc2f00820f07f1be4fe97594c590b42";//<your key>
private static final String USER = "demouser";//<your user name>
private static final String PASSWORD = "demouser";//<your password
private static final String DB_NAME= "DEMODB";//<your db name>
private static final String TABLE_NAME="demotable";//<your table name>
public static void main(String args[]) throws Exception
{
Connection conn = null;
Statement stmt = null;
ResultSet catalogs = null;
try
{
Class.forName("com.zoho.cloudsql.jdbc.ZohoReportsDriver");
Properties conProps = new Properties();
conProps.put("ZOHO_API_KEY",APIKEY);
conProps.put("user",USER);
conProps.put("password",PASSWORD);
conn = DriverManager.getConnection("https://reports.zoho.com/api"
+ "/" + URLEncoder.encode(USER,"UTF-8")
+ "/" + URLEncoder.encode(DB_NAME,"UTF-8"),
conProps);
DatabaseMetaData dmd = conn.getMetaData();
catalogs = dmd.getCatalogs();
if(catalogs != null)
{
while(catalogs.next())
{
System.out.println(catalogs.getObject("TABLE_CAT"));
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if (catalogs != null){try { catalogs.close(); } catch (Exception e){ e.printStackTrace();}}
if (stmt != null){try { stmt.close(); } catch (Exception e){ e.printStackTrace();}}
if (conn != null){try { conn.close(); } catch (Exception e){ e.printStackTrace();}}
}
}
}

Loading into third party tools:

This document describes the way to get connected with your Zoho Reports database via thrid party tools that support JDBC drivers. To know more about JDBC drivers, kindly visit this page:http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/index.html

The following would be required to setup the connection (write to us at support@zohoreports.com, if you need any assistance)

  • Load the drivers: Generally the connection wizard will have an option to load the drivers. For Zoho Reports, you have to select the files (ZohoReportsAPIClient.jar, ZohoReports_CloudSql_1_0.jar, csv.jar, commons-codec-1.3.jar, commons-httpclient-3.0.1.jar, commons-logging-api.jar)
  • JDBC Driver: Specify com.zoho.cloudsql.jdbc.ZohoReportsDriver
  • Database URL: http://reports.zoho.com/api/<username>/<db_to_connect> (ex: http://reports.zoho.com/api/demouser/SalesDB)
  • UserID: your Zoho Reports' username
  • Password: your Zoho Reports' password
  • ZOHO_API_KEY: <YOUR_ZOHO_API_KEY>.
  • You may have to specify the proxy information (PROXYSERVER, PROXYPORT, PORTUSERNAME, PROXYPASSWORD) if you are connecting through proxy server.

Viewing all articles
Browse latest Browse all 71

Trending Articles