on 01-27-2008 10:59 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.