on 12-27-2005 12:48 PM
Hi,
I want to create a datasource in WAS from my own web application at runtime depending upon which database the user has chosen from the dropdown list on the JSP page.
Can any one help me and tell me how to go about it.
i want to know which APIs and which classes to use.
Its a very urgent requirement.
Regards
Saurabh
Hi,
For information, on how to create a datasource
http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/bridge.html
I have used the following snippet of code inorder to achieve connection for a datasource defined in WAS.
So you may try creating a datasource based on the above link,and see if it can create a datasource in WAS.
java.sql.DataSource datasource;
initialContext = new InitialContext();
dataSource = (java.sql.DataSource) initialContext.lookup("jdbc/xyz123");
conn = dataSource.getConnection();
Regards,
Harish
(Please award points ,if this answer has been helpfull)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As i understand DataSources are static entities in any application. we should be creating the DataSources initially and assign Alias to the Datasources,.. at runtime we can decide the alias and use the corresponding alias.
Regards,
S.Divakar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Divakar,
The requirement is such that the user can choose the type of RDBMS from the list on the jsp page and provide all the info like username.password,etc and when he submits the page a datasource should be created on WAS which can be used later by the application.
Can you help on how to create a data source.
Regards
saurabh
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.