Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netezza ODBC connection - equivalent of "use database"

Tags:

netezza

After connecting to a Netezza system is there any way to switch the database? For instance, in MSSQL one could send the command use database_name in order to switch to the database_name.

Is there anything in Netezza like "use" on mssql?

http://technet.microsoft.com/en-us/library/ms188366.aspx

My reason for asking is in regards to metadata queries; I can only access _v_table of the "currently connected database".

like image 550
joefromct Avatar asked Feb 14 '14 16:02

joefromct


2 Answers

Prior to Version 7.0 there wasn't an equivalent to USE. You had to log in to specific databases on the server however you can still access any object using. database.schema.objectname

Post Version 7.0 the equivalent is Set Catalog

SET CATALOG <database_name> 

Regarding your specific inquiry. Please consider using _V_TABLE_XDB instead of _V_TABLE. This system table should provide you with a list of all tables, not just those in the database you are connected to.

like image 155
Niederee Avatar answered Oct 15 '22 08:10

Niederee


If you're using NPS v7.0+, then the SET CATALOG command will connect you to a different database dynamically (without having to disconnect and reconnect). The beauty of this command is that it can be submitted from an ODBC/JDBC client as well as in an nzsql script.

like image 31
Huw Ringer Avatar answered Oct 15 '22 07:10

Huw Ringer