• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jdbc:odbc Bridge Failing Even With System ODBC variable set

 
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone. I have a problem I can't figure out.

I wrote a Java object which feeds a DB and is called from ColdFusion. I uploaded my Java object and tested it on the server that it will run on (java - classpath ... Recievable). I created an ODBC source in Win 2008 for the DB at the system level. I ran the object and got my test data into the DB, no problem. So I call my ColdFusion programmer and tell him that it's good to go and write a little CF to show him how to instantiate the object.

He runs it and gets [Microsoft][ODBC Driver Manager] Invalid string or buffer length. You can try it yourself here: https://www.cpawins.com/_cpapubs/test1.cfm. I have the full stack trace being returned as a string in my catch clause so that it can be dumped by CF. The CF server sits on the same server that I tested my java code on and is calling the same DB (and again, I've set a Windows system level ODBC source). Why does it work when I run it through java at the command prompt but does not when I run it through CF?

The Connection is:



According to the StackTraceElements[] that you see on screen when you follow the link, the code is failing at line 55 which is the Connection invocation.

Your help is much appreciated.

Best,
Al
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the name of your datasource?
 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jan. And, I probably am just missing something somewhere. But, the confusion I have is this:

I ran this exact same code on the server using java -classpath and each time I do, I pass those values into the DB and get a successful return. When CF invokes the code, I get an error. How can this be? At first, I though that perhaps the CF code was sending in variables incorrectly which is why I output the variables I received in the <cfdump>. They are correct.

How can I have a query problem when everything is the same? It's not making sense to me.

Again:

java -classpath ...Recievable.getMoney(int,int,int) works fine

<cfobject component="...Recievable.getMoney(sameInt,sameInt,sameInt)> does not work fine

 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P_CPA
 
Jan Cumps
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was just wondering if you have a user dztzsource with the same name as the system source.
In that case, maybe the code you run from the command prompt would use the user datasource, and the coldfusion code could pick up the system datasource ?


 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey, there's a plausible explanation! I'll check this out and follow up.

Thanks!
 
Jan Cumps
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you get the error in the line that creates the connection (as you say in your opening post) or in the method setMoney(int, int, int) (as shows on the exception page)?
 
Al Johnston
Ranch Hand
Posts: 99
Postgres Database Flex Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did check and there is no DMZ. The ODBC source I created should work for all connections to the DB. But, it does not.

Yet, the object fails at the connection point (line 55 which is Connection con = ...) and is in the method "setMoney(int,int,int). This has still left me baffled.
 
I was born with webbed fish toes. This tiny ad is my only friend:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic