Database Query for MS SQL Server database with space in name? (335 Views)
Reply
Occasional Advisor
McNilsson
Posts: 10
Registered: ‎08-25-2013
Message 1 of 7 (335 Views)

Database Query for MS SQL Server database with space in name?

Trying to setup a Database Query Monitor and the problem is that all databases on the database server contains spaces (for some reason I don't know, I'm not the DBA). However, this makes it impossible to save the Database Connection URL because SiteScope says "The field Database Connection URL can only contain non space characters".

 

ex:

jdbc:sqlserver://10.10.0.5:1433;InstanceName=default;DatabaseName=Application Database

 

How do I fix this? I need to monitor this database and it's not an option to rename it.

 

According to JDBC driver it supports spaces if you use brackets or something like that, but the SiteScope UI won't let me save the Connection URL using this.

Please use plain text.
HP Expert
jmmirchev
Posts: 454
Registered: ‎09-14-2012
Message 2 of 7 (302 Views)

Re: Database Query for MS SQL Server database with space in name?

Hi McNilsson,

 

Could you confirm if this is the same issue you were refering to :

 

http://support.openview.hp.com/selfsolve/document/KM1132073

 

If so you can find on the artocle that this implementation had been considered for future releases, currently it is considered as a limitation (which is noted in the release notes).

 

I hope this helps !

 

Wish you a nice day!

 Yordan


Yordan Mirchev
HP Support

If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.

If you haven’t tried it yet, come and join us in our entitled forums at Support Customer Forums
Please use plain text.
Occasional Advisor
McNilsson
Posts: 10
Registered: ‎08-25-2013
Message 3 of 7 (299 Views)

Re: Database Query for MS SQL Server database with space in name?

I'm not authorized to view the document you linked.

 

We are currently running SiteScope 11.20.

Please use plain text.
Respected Contributor
dcsbeemer
Posts: 294
Registered: ‎07-19-2011
Message 4 of 7 (294 Views)

Re: Database Query for MS SQL Server database with space in name?

Hi McNilsson

 

 

I have no idea if this will work or not, but you could try "escaping" the space character with a backslash, i.e. Application\ Database.

 

If that doesn't work (I suspect it probably won't), try this:

 

jdbc:sqlserver://10.10.0.5:1433;InstanceName=default;DatabaseName={Application Database}

Please use plain text.
Occasional Advisor
McNilsson
Posts: 10
Registered: ‎08-25-2013
Message 5 of 7 (290 Views)

Re: Database Query for MS SQL Server database with space in name?

Thank you for your suggestions, but it won't work since SiteScope won't let me save the monitor if there is an space character in the string. I'm pretty sure the correct syntax would be {Application Database}, but I think the limitation is only in the SiteScope GUI (i.e. some programmed it wrongly not to accept spaces in the database connection string, even though the driver actually supports it).

Please use plain text.
Respected Contributor
dcsbeemer
Posts: 294
Registered: ‎07-19-2011
Message 6 of 7 (288 Views)

Re: Database Query for MS SQL Server database with space in name?

[ Edited ]

That's a pity. Still, the good news is you should be able to get away with using a Script monitor instead. We use Python scripts to a large extent in our environments, especially when faced with the odd unexpected issues like what you're experiencing here.

In short, the idea is to configure a script to run the query or queries you need, output the results to logfiles on the Sitescope server itself, then configure logfile monitors to check the resultant logfiles.

If you're interested in giving the scripting solution a go, let us know and we'll go from there.

 

EDIT: Also just to add, you don't necessarily have to use Python scripts. You could use powershell, VB, straight .bat scripts etc.

I only mention Python as that's what I use most of the time myself.

 

 

EDIT #2: Actually, before resorting to using a script, you could perhaps try configuring an ODBC connection on your Sitescope server to the SQL DB in question. Let's say you call the ODBC connection "APPDB", then you might be able to use the "sun.jdbc.odbc.JdbcOdbcDriver" driver and specifying your connection as follows:

jdbc:odbc:APPDB

 

Not too sure if that makes sense, but just access your Sitescope help and do a search for sun.jdbc.odbc.JdbcOdbcDriver and select the "Database Query Monitor" entry. The instructions are under the section marked "Database Query Monitor Settings".

 

I'm thinking that the space limitation probably won't be an issue with the MS ODBC tool. Using the JDBC-ODBC bridge driver should then bypass the limitation you're getting in the Sitescope UI.

 

 

If that fails, I reckon script monitoring is the way to go.

Please use plain text.
Occasional Advisor
McNilsson
Posts: 10
Registered: ‎08-25-2013
Message 7 of 7 (265 Views)

Re: Database Query for MS SQL Server database with space in name?

Thank you for your tips, I will try this!
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation