NetSuite Data Provider - Online Help
NetSuite Data Provider
Questions / Feedback?

Caching Metadata

For each query you wish to perform, the driver must rely on the metadata or schemas that describe the tables queried. If the metadata is not present, the driver establishes a separate connection with the live data source to retrieve the metadata before querying the data. This process can be slow and expensive, especially if multiple tables need to be queried.

The solution is to cache table metadata. Instead of retrieving the metadata fresh for each table per each query, caching the metadata locally stores the metadata that describes the table. Thus, the metadata from the live data source need be fetched only once.

Enable Caching Metadata

To enable this feature, simply set the CacheLocation and CacheMetadata in your connection string, and the RSSBus JDBC Driver for NetSuite handles the rest automatically. The driver will cache the metadata the first time it is needed and use it onwards.

Update the Metadata Cache

Altering the schema on the live data source - for example, in the event a column is added or dropped - is not reflected automatically in the local metadata cache. Delete the cache file if you expect your data definitions to have changed. By default, the metadata cache is located in %AppData%\RSSBus.

Cache Metadata from Code

The following code can be used to build the metadata cache. This is especially useful in using the Object-Relational Mapping Framework (e.g. Hibernate).


Connection conn = DriverManager.getConnection("jdbc:netsuite:Cache Location=C:\\rssbus.netsuite.db;AutoCache=True;Account Id=XABC123456;Password=password;User=user;Role Id=3;Version=2013_1;Location=C:\\myfolder\\;");
DatabaseMetaData table_meta = conn.getMetaData();

ResultSet rs=table_meta.getTables(null, null, "%", null); 

while (rs.next()) {
  String tableName = rs.getString("TABLE_NAME");
  System.out.println("Cached metadata for table: "+tableName);
  ResultSet cols = table_meta.getColumns(null, null, tableName, null);
  while(rs.next()){
  }
}
System.out.println();
System.out.println("All tables cached.");
conn.close();

 
 
Copyright (c) 2015 RSSBus, Inc. - All rights reserved.
Build 1.0.5577.0