Would suggest using the JDBC adapter that is bundled with Integration Server to perform database operations. There is no need to drop to Java code to do these sorts of operations.
We can do that using adapter service.
But I want to do that in a java service.
I just want a simple code to connect to Oracle using externally java service.
The reson it is not finding those classes might be because you have not set the classpath properly for IS to pick up the java classes.Are other java services running on your IS with import statement?Also some changes need to be made to your code.I think you need to give userid and password in commas.Also con has a setAutoCommit method and not AutoCommit i guess.Again in prepared statement first setString enclose “3” in commas and in last setInt you need to set some integer value as you are using setInt and not setString.
Enclose the code in try-catch block also for exceptions to be caught.
But as pointed out by everyone here use JDBC Adapter in your services.Maintaining this java code for connection will be a headache going forward.If you just want to do it for practice then use the above mentioned steps.
Thanks to all,
Compilled without any errors.
But i’m getting runtime error:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver.class not found.
For this, should i set any class path?
Are there any settings in webMethods to copy classes12.jar file?
What would be the solution?
Put the classes12.jar in your <wm_root>/IntegrationServer/lib/jars folder and restart your Integration Server.Check in the Administrator Screen–> About link(at top right hand corner) and see if it is showing the jar file there.
Ganesh, is this just an academic attempt to see if this can be done? Or are you trying to do this for a real solution that will be used in a production environment? If the latter, I would strongly suggest that you don’t do it this way.
I got it.
Following up on what Rob is saying, writing Java for things that can be done much easier w/Flow services is just asking for trouble – especially for whoever’s going to be maintaining the system. I’ve done way more than my share of cleaning up the mess left by other consultant (people who do projects for consultant company w/o wM people on-staff), and it’s normally these Java services that 1) causes hellishly untraceable problems, and 2) makes the system difficult to understand for a “real” webMethods guy.
The reason most people have for writing Java services is just this – unfamiliarity with webMethods.