JDBC connection setting

I am trying to connect to a database (data warehouse) via JDBC. From what I read in the documentation and controls, it seems like on can set the JDBC connection settings to connect to a specific database. The thing is that the documentation and examples connect to a local database on the local machine.

Has anyone used the DBQUERY to connect to a JDBC db on a different server? IF so would you mind sharing how you did it?

Thanks

Demos

I guess you are using a PAGE not a NATPAGE layout.
What you need to do is:

  1. Provide a ConnectionProvider object with your jdbc connection settings:

public class ConnectionProvider
        implements IDBQUERYConnectionProvider
{
public Connection getDBConnection(String datasource)
{    
   ...
   return DriverManager.getConnection("jdbc:hsqldb:hsql://localhost", "sa", ""); 	
...	    
}
}

Replace the localhost with your remote settings.

  1. Pass the ConnectionProvider object to the DBQueryInfo object

DBQUERYInfo m_dBQueryInfo = new DBQUERYInfo(..., 
    		new ConnectionProvider(), ...  		
    		

Does this work in your environment?

Best Regards,
Christine

Thanks Christine. I am using NATPAGE at the moment. Would it be better to use PAGE?

The DBQUERY control is currently only supported for PAGE not for NATPAGE. For a NATPAGE it is not offered as a control in the right-hand palette.

How did you insert a DBQUERY control into a NATPAGE?

Best Regards,
Christine

do you know if the DBQUERY control will be coming to NATPAGE?

Hi Demos,

We haven’t got any enhancement request regarding the support of the DBQUERY controls up to now.

Another aspect here is: The current DBQUERY controls are sufficient for some specific use cases. But a more general approach for different kind of data sources and data formating has advantages.

So, the answer to your question: Support for the DBQUERY controls in NATPAGEs is currently not planned.

Best Regards,
Christine

Christine do you know if I can do the following?

Have a PAGE that uses a DBQUERY control. The dbquery page is then called as a modal from NATPAGE

I really would like to find a way to read data from a Teradata data ware house database using Natural.

There is tremendous potential for “marrying” various sources of data using NJX and I hope to find a way that this will work in my situation.

Hi Demos,

…some thoughts to add the DBQUERY features to your NJX application:

Option A:

Have a SUBCISPAGE2 control in a NATPAGE. In this SUBCISPAGE2 control you would load your PAGE layout which contains the DBQUERY controls.

Option B:

Open your PAGE layout which contains the DBQUERY controls as a popup. You can open a popup from within an adapter listener. Or you could open the popup in the usual way from within Natural. In this case the popup would be a NATPAGE which contains a SUBCISPAGE2 control as in Option A.

If you would like to exchange data between your Natural application and the “DBQUERY-PAGE” you can again use an adapter listener. You can also use XCIDATADEF controls to add some not rendered data as some kind of “data exchange area” to your NATPAGEs.

Best Regards,
Christine