on 2008 May 27 11:32 AM
Hello All,
My requirement is to connect to a SAP database using the Java Application. As per the information i have, We can create a Data dictionary using the SAP Netweaver. Accordingly i have created a data dictionary and deployed the sda file on the portal. Now i need to connect to that database using java jndi.
my database connection class has the foll code:
InitialContext ctx = new InitialContext();
DataSource dataSource = (DataSource) ctx.lookup("java:comp/env/TMP_MEGHANA");
con = dataSource.getConnection();
I get the error: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
I am not sure where exactly do i have to specfy TMP_MEGHANA to be considered as a datasource.
Could some1 let me know how do i go about this problem?
Thanks in advance,
Meghana
Hi,
Check this code.
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/TMP_MEGHANA ");
Connection conn = ds.getConnection();
Use this connection now to create statement.
Regards,
Harini S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.