tag:blogger.com,1999:blog-34020393.post5530159653704247278..comments2024-03-27T10:59:38.307-07:00Comments on Jim's PeopleSoft Journal: Using JDBC from PeopleCodeJim Marionhttp://www.blogger.com/profile/12995110203807924786noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-34020393.post-78094065554393089562009-03-18T10:54:00.000-07:002009-03-18T10:54:00.000-07:00Jim, Thanks for your solution. I can connect ...Jim,<BR/> Thanks for your solution. I can connect using JDBC to remote database. Using driver directly solved my problem.<BR/><BR/>Once again thanks a lot.newbiehttps://www.blogger.com/profile/18422802466592411466noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-41191959633193336692009-03-17T14:56:00.000-07:002009-03-17T14:56:00.000-07:00@newbie, I experienced the same class loader probl...@newbie, I experienced the same class loader problem with class.forName. I don't know why. I've used class.forName before. I was also able to replicate your "No suitable driver" error. Using the driver directly, however, I was able to get this working. You can find the details in my latest post <A HREF="http://jjmpsj.blogspot.com/2009/03/using-oracle-jdbc-from-peoplecode.html" REL="nofollow">Using Oracle JDBC from PeopleCode</A>. I hope this satisfies your requirements. Please let me know.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-61454116876984721832009-03-17T09:10:00.000-07:002009-03-17T09:10:00.000-07:00I wrote the following for Class.forName&class ...I wrote the following for Class.forName<BR/>&class = GetJavaClass("java.lang.Class");<BR/>&class.forName("oracle.jdbc.driver.OracleDriver");<BR/><BR/>The above code did not work so I did some research and used the following<BR/><BR/>Local JavaObject &jCls = GetJavaClass("java.lang.Class");<BR/>Local JavaObject &jClsLoadr = GetJavaClass("java.lang.ClassLoader");<BR/>Local JavaObject &jDocClass = &jClsLoadr.getSystemClassLoader().loadClass("oracle.jdbc.driver.OracleDriver"); <BR/><BR/>Local JavaObject &jDocClass = &jCls.forName("oracle.jdbc.driver.OracleDriver", False, &jClsLoadr.getSystemClassLoader());<BR/><BR/>&driverManager = GetJavaClass("java.sql.DriverManager");<BR/><BR/>&connection = &driverManager.getConnection("jdbc:oracle:thin:@HRMS:1521:sid", "scott", "tiger");<BR/><BR/>We are on JVM 1.4 and on 8.45 Peopletools.<BR/><BR/>I will check and confirm if we have the same Java version on my process scheduler as that of my Java program.<BR/><BR/>Thanks.newbiehttps://www.blogger.com/profile/18422802466592411466noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-23159586514087501712009-03-17T08:33:00.000-07:002009-03-17T08:33:00.000-07:00@newbie, can you post your class.forName call and ...@newbie, can you post your class.forName call and your JDBC url? Please don't post your server name, database name, password, etc. Replace these with generic text.<BR/><BR/>class.forName is supposed to register the driver and return a reference to the Class object. You can call the getName() method on the returned object and print that to your AE log file just to make sure class.forName is finding the class.<BR/><BR/>You say it was working as a Java program, but not from PeopleCode, so I assume your code is OK. Another consideration is your JVM version. Does your Java program use the same JVM as your process scheduler server? If not, you may want to recompile your Java app and run it using the same JVM as your process scheduler.<BR/><BR/>What version of PeopleTools are you using? Different PeopleTools versions use different JVM versions. If your version of PeopleTools uses Java 1.4 or higher, you might consider ojdbc14.jar.<BR/><BR/>I'm going to write up a quick test using ojdbc14.jar and see what happens. I'll post the results.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-54320284675254370822009-03-16T17:20:00.000-07:002009-03-16T17:20:00.000-07:00Jim, Thanks for your immediate response. I am n...Jim,<BR/> Thanks for your immediate response. I am not getting Class.Forname error. I am getting the following error<BR/><BR/>Java Exception: java.sql.SQLException: No suitable driver: during call of java.sql.DriverManager.getConnection.<BR/><BR/>Yes log4j*.jar is in my $PS_HOME/class directory. We did bounce the process scheduler server as we will he running the app engine through process scheduler.<BR/><BR/>Thanks.newbiehttps://www.blogger.com/profile/18422802466592411466noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-16633024937805788882009-03-16T16:25:00.000-07:002009-03-16T16:25:00.000-07:00If Class.forName throws a ClassNotFoundException, ...If Class.forName throws a ClassNotFoundException, then you have a class path problem.<BR/><BR/>Is log4j*.jar in your $PS_HOME/class directory or $PS_HOME/appserv/classes directory? Your implementation might be using $PS_HOME/appserv/classes.<BR/><BR/>Did you restart your app server after placing the jar file in the class dir? The startup process adds jars to the classpath at startup.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-33025164529310147722009-03-16T14:10:00.000-07:002009-03-16T14:10:00.000-07:00Jim, Thanks for your post. I am trying to conne...Jim,<BR/> Thanks for your post. I am trying to connect to Oracle data base using JDBC from peoplecode and I am getting the following error message. <BR/><BR/>No suitable driver found.<BR/><BR/>I downloaded the jdbc class12.zip and made a .jar and placed it in $PS_HOME/CLASS <BR/><BR/>But when I wrote the same logic in a java program it is working as expected. Can you let me know as how to check if the driver is registering in peoplecode or not. <BR/><BR/>Thanks in advance.newbiehttps://www.blogger.com/profile/18422802466592411466noreply@blogger.com