Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2005



Tip: Looking for answers? Try searching our database.

CFMX7 -  dynamically changing a DSN password

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mighty wayward - 20 Sep 2005 11:34 GMT
Hi

Has anyone figured out how to go about changing a datasource password
programatically rather than having to do it through the CF Administrator?

I have  several datasources which share the same password.  Each month these
passwords need to be changed.  I'd like to be able to create a single form
listing the DSNs and passwords and, using this form, update the passwords for
the appropriate DSNs.  Ideally, this would update both the test and live server.

I've googled the issue but not had any joy.  Any help would be much
appreciated.

Thanks in advance.

Neil
UK
PaulH - 20 Sep 2005 12:05 GMT
adminAPI's setMSSQL ,setDB2 , etc. doesn't work? setMSSQL "Creates or modifies
a Microsoft SQL Server data source."

btw you can bring up the cfcexplorer by calling the CFC like
serverName/cfide/adminapi/datasource.cfc (requires that you authenticate).
mighty wayward - 20 Sep 2005 16:10 GMT
Thanks for that.  I don't suppose you know any code to update a datasource cfc?
Never done anything like this before.  I want to do something like:

update myDSN and set password = myNewPassword

Help much appreciated.
PaulH - 20 Sep 2005 20:23 GMT
this is right out of the docs. i'd setup a dsn & practice on it. as you can
see, mm did a good job making this sort of thing pretty easy.

<cfscript>
   // Login is always required. This example uses two lines of code.
   adminObj = createObject("component","cfide.adminapi.administrator");
   adminObj.login("admin");

   // Instantiate the data source object.
   myObj = createObject("component","cfide.adminapi.datasource");

   // Create a DSN.
   myObj.setMSSQL(driver="MSSQLServer",
      name="northwind_MSSQL",
      host = "10.1.147.73",
      port = "1433",
      database = "northwind",
      username = "sa",
      login_timeout = "29",
      timeout = "23",
      interval = 6,
      buffer = "64000",
      blob_buffer = "64000",
      setStringParameterAsUnicode = "false",
      description = "Northwind SQL Server",
      pooling = true,
      maxpooledstatements = 999,
      enableMaxConnections = "true",
      maxConnections = "299",
      enable_clob = true,
      enable_blob = true,
      disable = false,
      storedProc = true,
      alter = false,
      grant = true,
      select = true,
      update = true,
      create = true,
      delete = true,
      drop = false,
      revoke = false );
</cfscript>
mighty wayward - 21 Sep 2005 11:33 GMT
Hi

Thanks for getting back to me.  Much appreciated.

I'm using your code, adjusted to fit my needs:

<cfscript>
// Login is always required. This example uses two lines of code.
   adminObj = createObject("component","cfide.adminapi.administrator");
   adminObj.login("myAdminPassword");

   // Instantiate the data source object.
   myObj = createObject("component","cfide.adminapi.datasource");

   // Create a DSN.
   myObj.setOther  (
        name="myDSN",
     url="jdbc:teradata://myDSN",
     class="com.ncr.teradata.TeraDriver",
     driver="JDBC Driver myDSN",
     username = "myUsername",
      password = "myDSNPassword",
     encryptpassword="false",
     description="testing 1-2-3",
     selectmethod="direct"
    );
</cfscript>

And I'm getting this error message:

    There has been an error while trying to encrypt or decrypt your input
string: The input and output encodings are not same..
 
I've played about with the the encryptpassword parameter, but no luck there.

I take out the password parameter, it works OK.  I'm stumped.  Any ideas?

Thanks again,
Neil
PaulH - 22 Sep 2005 13:07 GMT
first off that's not my code, came right out of the docs.

hmm looks like a bug (i reported this to mm). try padding out the password to 16 chars using spaces. that worked for me against sql server.
PaulH - 23 Sep 2005 05:38 GMT
this is strange, mm couldn't reproduce this issue and today i can't either
(though yesterday it failed 100%).  in your case, did you try turning off the
password encryption when you updated the DSN password?
mighty wayward - 30 Sep 2005 12:10 GMT
Hi,

Sorry for the delay in getting back to you.  I've been off sick.  Back to
normal now though.  I'm still getting problems.

Executing the code as outlined with the password padded out to 16 characters
I'm now getting this error:

There has been an error while trying to encrypt or decrypt your input string:
Input length (with padding) not multiple of 8 bytes.

Note: encryptpassword has been set to false.  I'm flummoxed.
PaulH *TMM* - 30 Sep 2005 12:22 GMT
>  Note: encryptpassword has been set to false.  I'm flummoxed.

well as i said i couldn't neither mm nor i could reproduce that error
the very next day. try not setting encryptpassword and setting it to
true (let's assume the docs are wrong).
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.