Skip to Content
author's profile photo Former Member
Former Member

About JDBC System...

Hi All,

I am trying to develop a Portal Application in NWDS with java.

My requirement is to create some tables and then to access them.

I created these tables with the Dictionary Prespective in the NWDS.

To have acces to a RDBMS i read that i have to create a JDBC System and then write a code like this

IConnectorGatewayService cgService =(IConnectorGatewayService) PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);

if (cgService == null) {

throw new ConnectorException("Error in get Connector Gateway Service");

}

ConnectionProperties cp =new ConnectionProperties(request.getLocale(),request.getUser());

IConnection conn = cgService.getConnection("tempdbalias", cp);

conn = getJDBCConnection("testdbalias", request);

INativeQuery query = conn.newNativeQuery();

ResultSet result = (ResultSet)query.execute("select vendorname from vendor");

My questions are :

Do i have access in the tables created in the NWDS with the above code?

Or i have to create tables in the DB with other way?

Please i will appreciate any help.

Regards,

Ari

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2008 at 04:04 AM

    The tables created through the dictionary perspective are created in the default DB of your server. You can access that by creating any alias of the DB( through visual admin) and access the same through the following code:

    InitialContext initialContext = new InitialContext();

    DataSource dataSource = (DataSource)initialContext.lookup("jdbc/SAPDB");

    connection = dataSource.getConnection();

    Here SAPDB is the alias for the datasource.

    Hope it helps.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.