I looked at you class there is no reason it can't be a cfm page . In fact
you can do the class in two lines CFML!
Assumes com.ibm.db2.jcc.DB2Driver has been loaded
Line 1
<cfset props = createObject("java",
"java.util.Properties").setProperty("connectionAttribute","UID="
+ userName +";PWD=" + #oldPassword# + ";NEWPWD=" + #newPassword# + ";");
Line 2
con = createObject("java", "java.lang.Class").forName("
com.ibm.db2.jcc.DB2Driver
").newInstance().getConnection("jdbc:db2:jdbc:db2://XXXXXXXXXXXXX/DB2S",props);
Line 3 (does not count) :)
con.close();
make sure you close everything with con.close();
On 9/11/06, Rob Wilkerson <[EMAIL PROTECTED]> wrote:
>
> looks like CF is finding *your* class okay, but Java can't find
> subordinate classes. Is 'com.ibm.db2.jcc.DB2Driver' in your class
> path?
>
> On 9/11/06, loathe <[EMAIL PROTECTED]> wrote:
> > Helps a bunch thanks.
> >
> > Now I have:
> >
> > 17:50:59.059 - java.lang.Error Exception - in
> > C:\Inetpub\wwwroot\javaTest.cfm : line 3
> >
> > Unresolved compilation problems:
> > Unhandled exception type ClassNotFoundException
> > Unhandled exception type SQLException
> >
> > What do I do with those?
> >
> >
> > > -----Original Message-----
> > > From: Rob Wilkerson [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, September 11, 2006 5:40 PM
> > > To: CF-Talk
> > > Subject: Re: Java/CF Question
> > >
> > > You can put the class file anywhere in your classpath. Your classpath
> > > is defined in your jvm.config file in the java.classpath setting.
> > >
> > > Within a createObject() call, you'd reference the path to the class
> > > file from your base path. For example, your classpath points to :
> > > e:\path\to\my\classes, but your file is located in
> > > e:\path\to\my\classes\com\db\MyClass.class. Your createObject() call
> > > would look like this: createObject ( 'java', 'com.db.MyClass' )
> > >
> > > Hope this helps.
> > >
> > > On 9/11/06, loathe <[EMAIL PROTECTED]> wrote:
> > > > Well, I have been able to avoid this demon till today. So I guess I
> am
> > > > pretty lucky :)
> > > >
> > > > I have a pretty simple Java class to change a users password in DB2
> on a
> > > > mainframe. Looks like this:
> > > >
> > > > import java.sql.*;
> > > > import java.util.Properties;
> > > >
> > > > public class UpdatePassword {
> > > >
> > > >
> > > > /**
> > > > * @param args
> > > > */
> > > > Properties props =new Properties();
> > > > public static void main(String[] args)
> > > > {
> > > >
> > > > }
> > > >
> > > > public int changePassword(String userName, String
> oldPassword,
> > > > String newPassword )
> > > > {
> > > > Class.forName("com.ibm.db2.jcc.DB2Driver");
> > > > props.setProperty("connectionAttribute","UID=" +
> > > userName +
> > > > ";PWD=" + oldPassword + ";NEWPWD=" + newPassword + ";");
> > > > Connection con =
> > > >
> > > DriverManager.getConnection
> ("jdbc:db2:jdbc:db2://XXXXXXXXXXXXX/DB2S",props
> > > );
> > > >
> > > > return 1;
> > > > }
> > > > }
> > > >
> > > > Now I have a class file compiled from that.
> > > >
> > > > Where do I need to put the class file in order to have CF pick it up
> > > once I
> > > > recycle the services?
> > > >
> > > > What is the path to the class inside of a createObject call?
> > > >
> > > > TIA.
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252812
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4