Skip navigation
devdoyler
Currently Being Moderated

ColdFusion ignoring Connection String set in CFAdmin?

Aug 7, 2012 8:18 AM

Tags: #jdbc #cf10

I'm trying to setup a 3rd party JDBC driver as a datasource, but it appears to not matter what I put in the Connection String field in CFAdmin, it doesn't seem to use it at all.

User=user@account.com;Password=!password;

Errors out with Login failed: You must provide a user and password to login.

I tried putting random text into the Connection String field expecting it to error out, but nothing happened either.

I was wondering if I was entering the data wrong (I also tried the entire connection string with the jdbc:, but that did not work either) or if there was some way to verify the entire connection string that ColdFusion was trying to use.

I'm not trying anything special inside of my cfquery tag: <cfquery name="output" datasource="mySource"> so that should not be the issue. I can get around the user/password issue by hard-coding these values in the cfquery tag, but there is a 3rd key that I need to provide as a connection value as well.

The issue shouldn't be with my connection string, because the following worked with pure Java:

conn = DriverManager.getConnection("jdbc:mydriver:User=user;Password=password;AccessToken=accessToken;");

.

An interesting addition...ColdFusion appears to not care at ALL what is at the end of my URL as long as the beginning is correct...

jdbc:mydriverrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr:

gives the username/password error. Whereas:

jdbc:mydriveer:

gives me an "unable to find driver" error.

 
Replies
  • Currently Being Moderated
    Aug 8, 2012 12:11 AM   in reply to devdoyler

    Hi,

    On your CFAdmin page, click the database and check for this.

    JDBC  URL : jdbc:oracle:thin:@#Ip address of the database#:#port#:#username#

     

    There is a colon in between the database and the port and port and the username.

    Also, your driver class should be oracle.jdbc.OracleDriver

     

    I m assuming you are using Oracle.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 7:10 AM   in reply to devdoyler

    What datasource driver are you selecting in cfadmin?

    When you say that you got the connection working using pure java was that from the same server?

    Are you sure that the drivers are installed and available to the cf server?  Are the jar files associated with your 3rd party driver listed in the java class path on your cf server's system information page (from the cfadmin)?

     

    We have used 3rd party drivers with cf before and although I have seen similar situations as you mention (settings being ignored) we have always gotten them to work eventually.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 9:30 AM   in reply to devdoyler

    I can't remember for sure if the drivers need to be listed under CF's classpath or not.  It has been a while since we configured ours.  Typically we can take the connection string used for a java connection directly over to the CF datasource page and plug that in.  So, in your case, I would think that including your parameters with the jdbc url would work.  What error does that give you?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 12:37 PM   in reply to devdoyler

    When you say the mydriverrrrrrrrrrrrr...  works as a connection string what do you mean?  The connection actually works with that or it allows you to enter that in the datasource dialog without error?  I don't think CF cares what you put in the connection string because it has no way of knowing what your specific driver wants/needs.  So it just passes whatever you put in there at connection time and lets the driver deal with it (I think).

     

    Are you including the url to your database in the jdbc url string?  It should be something like:

     

    jdbc:mydriver://dbserver:port

     

    What happens when you put the username and password in the supplied fields of the datasource in cfadmin (not in the connection string box)?

     

    Where are you telling it the dbserver to connect to (if not in the jdbc url)?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 12:42 PM   in reply to devdoyler

    How does it know where to connect with no db server specified?  Defaults to local or something?

     

    Anyway, if the username and password fields seem to work have you tried using those and supplying only the accesstoken in the connection string box?  Or the accesstoken as part of the jdbc url?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 14, 2012 9:15 AM   in reply to devdoyler

    I think you are right about CF ignoring what you put in those fields but it should be passing the values you enter to your driver (jar).  Does your driver have any logging?  What do those logs show?

     

    From what you have described I think CF is communicating with your driver.  You said that if you put the username and password in the CF datasource fields then it attempts to connect but fails because of the accesstoken.  So how is this accesstoken supposed to work with your database?  Is it set per query, user, connection?  Is it dynamic or static?  Where do you get the accesstoken (from the db server)?

     

    If you can specify the database server to connect to within the JAR then perhaps you can also specify the accesstoken there?  At this point I would start looking at the driver you are using for logging/debugging options.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 14, 2012 1:43 PM   in reply to devdoyler

    By chance have you tried Access_Token instead?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 14, 2012 2:01 PM   in reply to devdoyler

    I guess I'm on the opposite side of you.  The connection string option is there to provide specific parameters that are needed by the driver you are using.  ColdFusion does not know what those parameters may be so it allows you to enter whatever you want and just passes whatever you enter to the driver.  It is up to the driver to interpret the string.  Does that make sense?

     

    I don't understand how your jdbc url is missing the database server either.  That does not make sense to me?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 14, 2012 2:45 PM   in reply to devdoyler

    I guess that works because the first part, jdbc:mydriver, happens to match your driver.  Like you said earlier, jdbc:mydrivrerrrrrrrr does not work.  I'm guessing though.

     

    I agree the same jdbc url that you use in java should also work in CF.  The odd thing to me is the missing database server in your jdbc url.  I have always needed to supply that in ours (after the driver name and before any additional parameters).  For what it's worth, you should be able to define the datasource using your java server (jrun if you are using that) and then reference that in CF.  I forget the exact scenario for that setup but we did it before as a proof of concept.  If it works in java it will work in CF I promise.

     

    Also, you used to be able to define the connection within the cfquery tag itself but I'm not sure that is allowed anymore.  (Can't look it up at the moment.)

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 15, 2012 5:32 AM   in reply to Miguel-F
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points