2009-05-18 07:54 AM
OM3.7 provides database views which can be accessed through both ODBC and JDBC.
I am trying to access database view through JDBC connection, but I get an SQL Exception
when I am trying to get view's column type by calling getColumnTypeName(1):
JZ0SJ: Metadata accessor information was not found on this database.
Please install the required tables as mentioned in the jConnect documentation.
The error occurs when the sybase ASA server has not been enbled for JDBC. So, the question is:
Is embeded database disabled for JDBC access by default for OM3.7? Is that way to enable it somewhere?
2009-05-25 03:15 AM
I am able to access database view through JDBC connection and retrieve metadata of the DataFabric Manager views successfully.
I was able to use 'getColumnTypeName()' api without any issue.
Please find attached a sample Java code (dfmAccess.java) which retrieves metadata of the DataFabric Manager views.
The output for hostView looks like this:
****************** View - hostView ******************
hostId(unsigned int) hostType(varchar) hostPrimaryAddress(varchar) hostProductId(varchar) hostPingStatus(varchar) hostPingTimestamp(timestamp) hostDownTimestamp(timestamp) hostClusterId(unsigned int) hostMode(varchar)
78 Clustered Filer 184.108.40.206 0111111111 Up 2009-05-25 15:04:15.000 2009-05-25 14:22:44.000 78 node
79 Clustered Filer 220.127.116.11 01201168088 Up 2009-05-25 15:03:17.000 2009-05-25 14:23:24.000 79 node
My Setup Details are as follows:
DFM server - OEL 4.0
Windows client : Win 2003 64 bit
Following were the steps followed by me:
1. Install latest Java Development Kit on the Windows system
2. Copy jconn2.jar and jodbc.jar from <DFM install-dir>/misc/dbconn folder to
C:\Sun\SDK\jdk\lib directory on the Windows system
3. Ensure that the environment variables 'JAVA_HOME' and 'CLASSPATH' are set.
The variable "CLASSPATH" should be created in 'User variables for Administrators" section in 'Environment Variables' wizard
Example: The value of this variable could be like this
4. Create a database user on the DFM server by using the cli 'dfm database user create'.
5. Enable database access to the user by using the cli 'dfm database access enable'
6. From the Windows system create a DSN to the remote DFM server database using the ODBC Administrative tool.
Use the user credentials created above
On Windows 64 bit servers, the odbcad32.exe is available in C:\WINDOWS\SysWOW64 folder
7. Edit the java source file to reflect this database user and its password. Also specify the name of the DSN created.
Copy the java source file to C:\Sun\SDK\jdk\bin directory
8. Compile and execute the java file.
P.S: Please note that code iterates through all the DFM views and prints its metadata as well as the values. You may want to modify the code to print
single view information at a time
2009-05-26 10:33 AM
Yes, I am be able to connect to DFM database through the iAywhere JDBC drive with DSN specified. That means each client has to have jdbc drive (dbodbc9.dll) loaded, which doesn't have by default on window system. And we have to manually create DSN on each client. Right now, I have trouble to get the metadata by connecting to DFM database through JConnect driver, which is pure Java. So qeustion is: Does OM3.7 fully support JConnect drive? Or Is that possible to use DSN-less jdbc connection?
2009-05-28 02:18 AM
You are right, the stored procedures required by Sybase to provide metadata information are not installed on Operations Manager DB.
Could you please open a support case for this issue ?
I installed the stored procedures on a test system, and still not able to get the metadata. Will work with Sybase to resolve that.
I have attached a sample java code where i tried two methods for getting the metadata using the JConnect driver (jconn2.jar installed with DFM).
Method - 1: Using getColumnTypeName() returned null after installing the stored procedures.
Method - 2: Using sp_columns() stored procedure to get the columns and data type.
Please let me know if the second method will work for you. I have attached the sample code (you will have to comment method-1's code), and here's the output:
Connected to Monitordb using JConnect.
Details of obectView (using JConnect):
Details of obectView (using stored procedures):
objId (unsigned int)