Joel Brown's Weblog

« Previous month (Dec 2005) | Main | Next month (Feb 2006) »

http://blogs.sun.com/jfbrown/date/20060126 Thursday January 26, 2006

Creator 2 3rd party DB Driver Support

Creator ships with DB drivers that we support.  Recent MySQL drivers are also supported.


But what about other drivers?


Here's how to determine if your driver works:


Add a datasource using your driver and database.  See the Tutorials page for  Creating Database Server Types and Data Sources.


In the servers pane, open up your data source node and see if you can see any tables.


If that works, pick a double and double click to "View Data".  Now alter the query, prefixing it with "smd " (this is an undocumented command).  E.g., "smd select * from myTable".  Run.


This creates a PreparedStatement for the given SQL and outputs the ResultSet from the preparedStatement.getMetaData() call.


If data is displayed, does it look "reasonable"?   Most important are the ColumnName and Type columns.  For a valid example, compare it to data from a supported driver (e.g., a table in our bundled database).


Does it throw an exception?  If so, it's not supported and will not work at design time.  Period. 


All the failures I've seen so far are because PreparedStatement.getMetaData() does not work, usually throwing a "not supported" exception.  Some drivers support this call after statement execution, but we require support before executing the statement.


Add a comment to this entry with the driver/database that you'd like to see supported.  Even if someone else has mentioned your database, comment yourself.  Supporting additional drivers is on the unfinalized list of features for next release (no promises!).

View Data Trivia

View data is a simple window that allows you to run sql, any sql, even multiple statements.  It has some undocumented commands you may or may not find useful.  Here they are.


title something meaningful
Ever had more than one View Data document open and forgotten what's in which one?  This allows you to change this document's title.


setautocommit on | off
Default is on.  If you wish to run multiple statements in a single transaction, turn it off


// comment
If you're writing a long script, add comments using this format.




For troubleshooting, check out:


smd your_select_statement
This shows the driver provided pre-execution ResultSet metadata from a preparedStatement.getMetaData() call for the provided select statement.   An exception here means your 3rd party driver is not supported and just won't work at design time.


getmetadata
Show the DataBaseMetaData; see Connection.getMetaData().


table table_name | schema.table_name
Shows the meta data for a particular table.


datasources
For each open project, list the data sources it uses and their config info.




And lastly, a feature I didn't quite finish:


useViewData on | off
When on, selecting any RowSet and right-click "Edit SQL Statement" will open the sql statement in a View Data Window (with a Save button) instead of the Query Editor.   To return to using the Query Editor, set this to off or restart the IDE.  What's missing:  running when there are parameters (?) in the query is not supported.




Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.