www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Database connection...

reply Nahon <lburger hu.tesco-europe.com> writes:
I wouldn't call it a "problem" as such: you have to tell the compiler which
files to compile. However, Derek Parnell's Bud (nee Build) tool can make the
task of compiling a lot less tedious.
http://www.dsource.org/projects/build/wiki

Ok, it's a feature. :-) (I don't like it by the way... I think the compiler should automatically find the modules it has to compile: there are implicit commands for it.) But anything I do, I get this result: #c:\DMD\tarolas>bud_win_3.04 -full -names stock ws2_32.lib #Current Dir 'c:\DMD\stock\' # [ stock.d ] # [ sh.d ] # [ screen.d ] # [ element.d ] # [ telnet.d ] # [ dbi\odbc\OdbcDatabase.d ] # [ dbi\Database.d ] # [ dbi\DBIException.d ] # [ dbi\ErrorCode.d ] # [ dbi\Result.d ] # [ dbi\Row.d ] # [ dbi\Statement.d ] # [ dbi\odbc\OdbcResult.d ] # [ ws2_32.lib ] #OPTLINK (R) for Win32 Release 7.50B1 #Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved # #dbi\odbc\OdbcDatabase.obj(OdbcDatabase) # Error 42: Symbol Undefined _SQLFreeHandle 8 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase) # Error 42: Symbol Undefined _SQLEndTran 12 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase) # Error 42: Symbol Undefined _SQLGetDiagField 28 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase) # Error 42: Symbol Undefined _SQLGetDiagRec 32 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase) # Error 42: Symbol Undefined _SQLSetEnvAttr 16 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase) # Error 42: Symbol Undefined _SQLAllocHandle 12 #dbi\odbc\OdbcResult.obj(OdbcResult) # Error 42: Symbol Undefined _SQLColAttribute 28 It seems everything is imported but it does not compile/link.
Oct 30 2006
next sibling parent "JC" <johnch_atms hotmail.com> writes:
"Nahon" <lburger hu.tesco-europe.com> wrote in message 
news:ei50g3$12ec$1 digitaldaemon.com...
I wouldn't call it a "problem" as such: you have to tell the compiler 
which
files to compile. However, Derek Parnell's Bud (nee Build) tool can make 
the
task of compiling a lot less tedious.
http://www.dsource.org/projects/build/wiki

Ok, it's a feature. :-) (I don't like it by the way... I think the compiler should automatically find the modules it has to compile: there are implicit commands for it.)

I know what you're saying, but how is it supposed to know where your files are located?
 But anything I do, I get this result:

 #c:\DMD\tarolas>bud_win_3.04 -full -names stock ws2_32.lib
 #Current Dir 'c:\DMD\stock\'
 # [ stock.d ]
 # [ sh.d ]
 # [ screen.d ]
 # [ element.d ]
 # [ telnet.d ]
 # [ dbi\odbc\OdbcDatabase.d ]
 # [ dbi\Database.d ]
 # [ dbi\DBIException.d ]
 # [ dbi\ErrorCode.d ]
 # [ dbi\Result.d ]
 # [ dbi\Row.d ]
 # [ dbi\Statement.d ]
 # [ dbi\odbc\OdbcResult.d ]
 # [ ws2_32.lib ]
 #OPTLINK (R) for Win32  Release 7.50B1
 #Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 #
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLFreeHandle 8
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLEndTran 12
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLGetDiagField 28
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLGetDiagRec 32
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLSetEnvAttr 16
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLAllocHandle 12
 #dbi\odbc\OdbcResult.obj(OdbcResult)
 # Error 42: Symbol Undefined _SQLColAttribute 28

 It seems everything is imported but it does not compile/link.

You haven't linked in the odbc import library. Specify "odbc32.lib" on the command line. Alternatively, in one of your modules, add the following: pragma(lib, "odbc32.lib"); An import library comes with the linker and utilities package from the website (http://ftp.digitalmars.com/dmc.zip). But I'm not sure if the one that version will work, because it's very old. If you have the latest Platform SDK, you can copy odbc32.lib from there into your dm\lib folder, and then run coffimplib (ftp://ftp.digitalmars.com/coffimplib.zip) on it to make it compatible with DMD.
Oct 30 2006
prev sibling parent James Pelcis <jpelcis gmail.com> writes:
Nahon wrote:
 #OPTLINK (R) for Win32  Release 7.50B1
 #Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 #
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLFreeHandle 8
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLEndTran 12
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLGetDiagField 28
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLGetDiagRec 32
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLSetEnvAttr 16
 #dbi\odbc\OdbcDatabase.obj(OdbcDatabase)
 # Error 42: Symbol Undefined _SQLAllocHandle 12
 #dbi\odbc\OdbcResult.obj(OdbcResult)
 # Error 42: Symbol Undefined _SQLColAttribute 28
 
 It seems everything is imported but it does not compile/link.

That's a known problem that is caused by DMC not being shipped with up-to-date Windows libraries. To fix it, follow the instructions at http://www.dsource.org/projects/ddbi/wiki/ODBCSubproject. Hope you enjoy.
Oct 30 2006