Video Screencast Help
Search Video Help Close Back
to help
Not able to make it to Vision this year? Get a sampling in the Best of Vision on Demand group.

SQL Server - Collector Studio connecting to DB

Updated: 23 Jan 2012 | 13 comments
jamied's picture
+1 1 Vote
Login to vote

I am attempting to connect to a SQL Server 2008 database using Collector Studio 2.43. When I test the Sensor it just sits at "reading events...".

 

This is what I see in the log:

 

DEBUG    2012-01-23 14:26:14,891    sensors    AWT-EventQueue-0    Initial read policy: "BEGINNING"
DEBUG    2012-01-23 14:26:14,891    sensors    AWT-EventQueue-0    use URLClassLoader in OpenDevice(), dir=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/lib/sqljdbc_3.0/enu; files=sqljdbc4.jar
DEBUG    2012-01-23 14:26:14,891    sensors    AWT-EventQueue-0    URLs are loaded: [jar:file:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/lib/sqljdbc_3.0/enu/sqljdbc4.jar!/]
DEBUG    2012-01-23 14:26:14,891    sensors    AWT-EventQueue-0    java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
INFO    2012-01-23 14:26:14,928    sensors    AWT-EventQueue-0    Result query(TestQuery) is "select top 10 aggregate_id from dbo.scr_fct_web"

 

This is a pic of my config of the sensor:

Thanks for any help you can provide!

Comments

Avkash K's picture
23
Jan
2012
0 Votes 0
Login to vote

No Error Logs!! Can you

No Error Logs!!

Can you please check if you can any log with ERR.

and also can you confirm the connectivity to the database TNS port.

check if you are able to telnet the DB over TNS service port.

Also confirm if you provided driver path correctly.

Regards,

Avkash K

ya4ept's picture
24
Jan
2012
0 Votes 0
Login to vote

may be Query is wrong? Query

may be Query is wrong?

Query must be sorted by the key field and the condition
where key_field > ?

sorry, but I use translate.google.ru

antilles's picture
24
Jan
2012
0 Votes 0
Login to vote

Queries

Jamied, please attach full query definition because it's possible that you have incorrect condition there and that's the cause of no results.

The beginning of your main query is: "select top 10 aggregate_id from ..." - in this case you will be able to retrieve only aggregate_id value... so you should verify whether you event identification rule is correct...

Also you can remove "Top 10" from MAX and MIN queries because you will always have only one value as a result (at least you should).

Regards

jamied's picture
24
Jan
2012
0 Votes 0
Login to vote

removed top - please right click | view image to view full value

I am not seeing any error lines in the log. If you right click on my image and click view image you should be able to see my full queries. I am just trying to see if the logs can be read at this point. Thanks for the suggestions. I removed top from my queries, but am still seeing no results.

 

Avkash K's picture
24
Jan
2012
0 Votes 0
Login to vote

Have you confirmed your DB

Have you confirmed your DB connectivity over TNS service port??

Regards,

Avkash K

antilles's picture
25
Jan
2012
0 Votes 0
Login to vote

Changes in query

You added InitialEndQuery and IntitialBeginningValue parameters but your main query is built in the way that makes impossible to use those values.

Change QuerySet.1.PrimaryQuery.1.Query in following way:
SELECT aggregate_id FROM dbo.scr_fct_web where aggregate_id > ?

Moreover you have used IntitialBeginningValue but as value you used MIN query. Change this in one of two ways:
- put 0 instead of MIN query
- leave MIN query but change parameter name from IntitialBeginningValue to IntitialBeginningQuery

Regards

jamied's picture
25
Jan
2012
0 Votes 0
Login to vote

Yes, I can connect to this DB

Yes, I can connect to this DB externally through a different application.

I will try that Antilles. Thank you.

jamied's picture
25
Jan
2012
0 Votes 0
Login to vote

little further

Well, I got a little further.. but still stuck on "reading events" when testing the sensor.

 DEBUG    2012-01-25 13:15:43,496    sensors    AWT-EventQueue-0    Initial read policy: "BEGINNING"
DEBUG    2012-01-25 13:15:43,497    sensors    AWT-EventQueue-0    use URLClassLoader in OpenDevice(), dir=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/lib/sqljdbc_3.0/enu; files=sqljdbc4.jar;sqljdbc.jar
DEBUG    2012-01-25 13:15:43,498    sensors    AWT-EventQueue-0    URLs are loaded: [jar:file:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/lib/sqljdbc_3.0/enu/sqljdbc4.jar!/, jar:file:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/lib/sqljdbc_3.0/enu/sqljdbc.jar!/]
DEBUG    2012-01-25 13:15:43,499    sensors    AWT-EventQueue-0    java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
INFO    2012-01-25 13:15:43,834    sensors    AWT-EventQueue-0    Result query(TestQuery) is "select user_id from dbo.scr_dim_user where user_id > ?"
INFO    2012-01-25 13:15:43,835    sensors    AWT-EventQueue-0    Init query is "select min(user_id) from dbo.scr_dim_user" 

Here is my property list I changed the query to point to a smaller table, but it is basically the same with the changes suggested implimented.

TatyanaS's picture
26
Jan
2012
0 Votes 0
Login to vote

When you run the query on

When you run the query on your database:

select user_id from dbo.scr_dim_user where user_id > (select min(user_id) from dbo.scr_dim_user)

does it returns any rows?

-Tatyana

jamied's picture
26
Jan
2012
0 Votes 0
Login to vote

 Yes, this query is

 Yes, this query is successful on my DB.

I am wondering if I have the linux sql server jdbc driver installed correctly. I am running centos 6 and extracted the drivers to  /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/lib/sqljdbc_3.0/enu. From what I have read I believe this is is the correct location, but I am interested to see if others have placed the drivers in this directory. Thanks. 

Avkash K's picture
26
Jan
2012
1 Vote +1
Login to vote

Hi Jamied,   Driver path is

Hi Jamied,

 

Driver path is not an issue in general, if you have provided the correct path of drivers in your sensor config.

Regards,

Avkash K

TatyanaS's picture
27
Jan
2012
0 Votes 0
Login to vote

Agree with Avkash K. If you

Agree with Avkash K. If you specify incorrect driver - collector would log ERROR message in your log.

Can you test your collector in collector studio and check if it returns events?

jamied's picture
27
Jan
2012
0 Votes 0
Login to vote

Hi Tatyana. I am testing in

Hi Tatyana. I am testing in collector studio. I click on test collector, then I select my sensor and configure it. I then click read and it just sits at "reading events". No events come back. When I do a test with a syslog collector I am able to get events back.