Hi Ed,

Yes, you should add an additional api

sqldriverconnect=: 'odbc32 SQLDriverConnect s x x *c s *c s *s s' &cd

and then inside ddcon change the line

if. -.'dsn=' -: tolower 4{.y do. errret ISI08 return. end.

to

isdsn=. 'dsn=' -: tolower 4{.y

And then write conditional code 

if. isdsn do.
  NB. y is in the form: dsn=xxx;uid=...

  ... original code that use sqlconnect

else.
  NB. y is in the form: Driver={Microsoft Access Driver 
(*.mdb)};Dbq=\somepath\dbname.mdb;Uid=Admin;Pwd=pass;

  ... use sqldriverconnect here 

end.

Of course arguments and result from sqldriverconnect will be different
from that of sqlconnect


Сбт, 01 Май 2010, Cox, Ed писал(а):
> Thanks Bill,
> I am looking in the odbc script (could not find one named jodbc).  In it I 
> see the definition for ddcon, and inside it has this line:
> z=. sqlconnect LASTCONNECT=: HDBC;(bs dsn),(bs uid),bs pwd
> 
> But at the top of the file I see this definition for sqlconnect:
> sqlconnect=: 'odbc32 SQLConnect s i *c i *c i *c i' &cd
> 
> So is this the one I want to modify?  So that it would become:
> sqlconnect=: 'odbc32 SQLDriverConnect s i *c i *c i *c i' &cd
> 
> I just want to make sure I understand you, and also get it into the archives 
> for anyone else who looks for this.
> 
> Thanks,
> Ed
> 
> ------------------------------
> 
> Message: 8
> Date: Sat, 1 May 2010 08:26:07 +0800
> From: bill lam <[email protected]>
> Subject: Re: [Jprogramming] ODBC with DSN-less connection string
> 
> 
> DSN-less connection require a patch to the verb ddcon inside jodbc
> script.  Search for the api sqlconnect and modify it to use another
> api sqldriverconnect.
> 
> 
> ???, 30 ??? 2010, Cox, Ed ???(?):
> > I have tried numerous times to get ODBC working in J using DSN-less 
> > connection strings but have never gotten it to work.  (Most often trying 
> > for SQL Server and/or Excel.)  I have done so successfully in other 
> > languages so I think that should eliminate about 95% of the possible newbie 
> > mistakes.  Has anyone been able to get this working, and if so could you 
> > share some examples of how you did it?
> >
> > Thanks in advance,
> > Ed Cox
> > CareFusion, Inc.
> >
> 
> _________________________________________________
> 
> This message is for the designated recipient only and may contain privileged, 
> proprietary
> or otherwise private information. If you have received it in error, please 
> notify the sender
> immediately and delete the original. Any other use of the email by you is 
> prohibited.
> 
> Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - 
> Norsk - Portuguese
> Svenska: www.cardinalhealth.com/legal/email

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to