on 07-18-2006 12:18 PM
hi,
i have written the code for getting data from maxdb.But it is giving error.pls hel me
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
p.put(Context.PROVIDER_URL, "192.168.1.2:50004");
p.put(Context.SECURITY_PRINCIPAL, "admin");
p.put(Context.SECURITY_CREDENTIALS, "admin");
InitialContext ctx=null;
String test="1";
try {
ctx = new InitialContext(p);
Object o=ctx.lookup("jdbc/SAPJ2EDB");
<i><b>Error</b></i>
java.lang.NoClassDefFoundError: javax/resource/ResourceException
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
at javax.naming.spi.NamingManager.getObjectFactoryFromReference(NamingManager.java:129)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:299)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:497)
at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:614)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at ForFoundation.main(ForFoundation.java:42)
Exception in thread "main"
regards
Guru
Hi,
Try with the following code snippet to access the DataSource using the JNDI look up name:
try{
InitialContext initialContext = new InitialContext();
DataSource dataSource = (DataSource)initialContext.lookup("jdbc/SAPJ2EDB");
java.sql.Connection conn = dataSource.getConnection();
Statement st = conn.createStatement();
....
...
}
Hope this helps.
Regards,
Srinivasan T
<b>Helpful answer=>points</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
i have done wht u have said and i have added some jars also .
exception is
java.lang.NoClassDefFoundError: iaik/utils/Base64Exception
at com.sap.sql.connect.OpenSQLConnectInfo.getStore(OpenSQLConnectInfo.java:802)
at com.sap.sql.connect.OpenSQLConnectInfo.lookup(OpenSQLConnectInfo.java:787)
at com.sap.sql.connect.OpenSQLDataSourceImpl.setDataSourceName(OpenSQLDataSourceImpl.java:206)
at com.sap.sql.connect.OpenSQLDataSourceImpl.setDataSourceName(OpenSQLDataSourceImpl.java:194)
at com.sap.engine.services.dbpool.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:113)
at com.sap.engine.services.dbpool.spi.DefaultConnectionManagerImpl.allocateConnection(DefaultConnectionManagerImpl.java:26)
at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:51)
at ForFoundation.main(ForFoundation.java:49)
Exception in thread "main"
regards
Guru
Hi,
two helpful sources that explain it:
an <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/05058e8d-0c01-0010-c986-fdc8eaebf37c">article</a>, and <a href="http://help.sap.com/saphelp_nw04/helpdata/en/2d/23b32e8c0152469edf07909703fe03/frameset.htm">documentation</a>.
Hi,
the article that I gave link to in the previous message contains an overview of the options that you have for deploying the drivers on the server. Please, refer to section Common Tasks -> Deploying a JDBC Driver of this article for info about deploying the driver libraries using the Telnet console.
You can also do it with Visual Administrator as described <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/80/4f34c587f05048adee640f4c346417/frameset.htm">here</a>.
Hope that helps!
Hi,
on the first question: yes, you can, but the DataSource you should use for connectivity should be using Vendor SQL.
second question: no, you can't. Java dictionary and Open SQL can be used with the system's database (note, this does not include MaxDB only; this is true for all DBs that are supported as listed in the product availability matrix: http://service.sap.com/pam). Since mysql is not among supported DBs, you cannot use java dictionary with it..
Hope that explains this a bit.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.