on 07-14-2006 3:11 PM
hi to all Gurus,
I could not able to aceess table contents through a datasource.
How could i assign a datasource to some database.
i have to use oracle database. Here is my code.
InitialContext context = new InitialContext();
DataSource ds = (DataSource)context.lookup("jdbc/SAPTEDDB");
con=ds.getConnection();
//Upto here everything works fine now,
rs1=con.createStatement().executeQuery("");
i have to create table using this datasource
Please tell me how i will assign tables to this datasource.
Please help me.
Thanks and Regards;
Pankaj Kumar
Hello Pankaj,
r u able to get all the records of the table into some node ?
if yes, then in the wdDomodifyview of the view, you can dynamically bind this node to the datasource property of the table
Hope this helps
Thanks and Regards
Kapil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi kapil,
Thanx 4 quick reply. My question is how could i know that which table i can access through the datasource. and how could i make a table to be accessed by a datasource.
Suppose i have a table named as "Employee" in oracle server with database name as MYDATABASE. Now how can i access the table contents through the datasource created in "VISUAL ADMINISTRATOR" of SAP J2EE Server.
Please Help me.
Thanks,
Pankaj kumar.
Hi Pankaj,
This is the code for accessing the database using datasource
InitialContext initialContext= new InitialContext ();
DataSource dataSource = (DataSource)initialContext.lookup("Datasource");
java.sql.Connection conn = dataSource.getConnection();
Then you can write SQL query to obtain the values from table
Hope this helps
Kind Regards,
Saravanan K
Hi Pankaj,
sorry I missed one, this is the correct version,
InitialContext initialContext= new InitialContext ();
DataSource dataSource = (DataSource)initialContext.lookup(jdbc/"Alias name");
java.sql.Connection conn = dataSource.getConnection();
ps: alias name that was created by you
Then you can write SQL query to obtain the values from table
Hope this helps
Kind Regards,
Saravanan K
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.