|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERHello Freinds,
Thanks for the reply.Take this simple example "select ID from TEST_TABLE where TEST_VALUE = ?" This query works fine in CLI using mysql 5.1. But in the application when i EXECUTE this query iam unable to fetch the data using the SQLFetch and it returns DB_NO_DATA with a result code 100 or some times gives a junk value. The procedure i have followed is as follows. i have used SQLUINTEGER for the input parameter in case of SQLBindParameter. SQLUINTEGER value; SQLBindParameter(sthdl,1,SQL
_PARAM_INPUT,SQL_C_ULONG,SQL_INTEGER,00,0,&value,00,00);
SQINTEGER indIdValue; SQLUINTEGER idValue; retCode = SQLBindCol(sthdl,1,SQL_C_ULONG,&idValue,sizeof(idValue),&indIdValue); and same in the case of out put SQLBindCol //steps followed are. SQLPrepare SQLBindParameter SQLExecute SQLBindCol SQLFetch Iam executing this on a 64 bit machine with mysql 5.1. But the same code works fine on a 32 bit machine with mysql4.0. Iam not getting clue what the problem is.I will be very grateful if you could help me solve this problem Regards Faizan. _______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERqureshifaizan faiz wrote:
>Hello Freinds, >Thanks for the reply.Take this simple example > >"select ID from TEST_TABLE where TEST_VALUE = ?" > >This query works fine in CLI using mysql 5.1. > >But in the application when i EXECUTE this query iam unable to fetch the >data using the SQLFetch and it returns DB_NO_DATA with a result code 100 or >some times gives a junk value. >The procedure i have followed is as follows. > >i have used SQLUINTEGER for the input parameter in case of SQLBindParameter. > >SQLUINTEGER value; >SQLBindParameter(sthdl,1,SQL >_PARAM_INPUT,SQL_C_ULONG,SQL_INTEGER,00,0,&value,00,00); > >SQINTEGER indIdValue; >SQLUINTEGER idValue; >retCode = >SQLBindCol(sthdl,1,SQL_C_ULONG,&idValue,sizeof(idValue),&indIdValue); >and same in the case of out put SQLBindCol > >//steps followed are. >SQLPrepare >SQLBindParameter >SQLExecute >SQLBindCol >SQLFetch > >Iam executing this on a 64 bit machine with mysql 5.1. > >But the same code works fine on a 32 bit machine with mysql4.0. > >Iam not getting clue what the problem is.I will be very grateful if you >could help >me solve this problem > >Regards >Faizan. > > > should. I would check with the MyODBC folk, as none of the values in the SQLBindParameter/SQLBindCol are altered by unixODBC, and are passed onto the driver. Just one thing, the indValue should be a SQLLEN type, and there are two incompatible definitions of that, but again, in this case its between the ap and the driver, the DM doesn't get involved. Even if the size was wrong, as long as it didn;t end up being -1 (SQL_NULL_DATA) the driver should ignore the length for fixed length type like a integer. -- Nick _______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERHi nick,
Thanks for the reply.please find the attached sample code along with the sample table description to give you a bit of more sight.I am very grateful for your interest in this issue. Waiting for your reply,guys because this code works in 32 bit machine iam not able to find the problem. why it is not working on a 64 bit machine. Regards, Faizan On Thu, Mar 27, 2008 at 2:58 PM, Nick Gorham <nick@...> wrote:
+----------------------+---------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------------+---------+------+-----+---------+-------+ | REFERENCE_ID | int(11) | NO | PRI | 0 | | | REFERENCE_VALUE | int(11) | YES | UNI | NULL | | +----------------------+---------+------+-----+---------+-------+ mysql> select * from REFERENCE_TABLE; +-------------------+----------------------+ | REFERENCE_ID | REFERENCE_VALUE | +-------------------+----------------------+ | 1 | 0 | | 2 | 10 | | 3 | 11 | | 4 | 12 | | 5 | 13 | | 6 | 14 | | 7 | 15 | | 8 | 16 | | 9 | 17 | | 10 | 18 | | 11 | 19 | | 12 | 20 | +-------------------+----------------------+ sqlQuery = "select REFERENCE_ID from REFERENCE_TABLE where REFERENCE_VALUE = ?" int getIdFromValue(IN DBConnection*& con,IN string sqlQuery,IN int Value,OUT int& Id) { //InPut Bind Parameters SQLUINTEGER value; //OutPut Bind Column Parameters SQLUINTEGER idValue; //Get the Statement Handle From the Connection Object HSTMT sthdl = con->getStmtHdl(); //Prepare Statement SQLRETURN retCode = SQLPrepare(sthdl,(SQLCHAR*)sqlQuery.c_str(),SQL_NTS); //Set Parameter #1. SQL_C_ULONG Corresponds to reference Value Data-Type=INT . retCode = SQLBindParameter(sthdl,1,SQL_PARAM_INPUT,SQL_C_ULONG,SQL_INTEGER,00,0,&value,00,00); value = drefValue; cout<<"+++++++++++Value is:"<<value<<endl; //SQLExecute retCode = SQLExecute(sthdl); //SQLBind Column Id DataReference Id SQLLEN indIdValue; retCode = SQLBindCol(sthdl,1,SQL_C_ULONG,&idValue,sizeof(idValue),&indIdValue); //Fetching From the Result-Set if(SQL_SUCCEEDED(retCode = SQLFetch(sthdl))) { //DataReference Id Id = idValue; cout<<"+++++++++++Fetched Value +++++++++++"<<Id<<endl; } return 0; } _______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERqureshifaizan faiz wrote:
>Hi nick, >Thanks for the reply.please find the attached sample code >along with the sample table description to give you a bit >of more sight.I am very grateful for your interest in this >issue. Waiting for your reply,guys because this code >works in 32 bit machine iam not able to find the problem. >why it is not working on a 64 bit machine. > >Regards, >Faizan > >On Thu, Mar 27, 2008 at 2:58 PM, Nick Gorham <nick@...> wrote: > > > I just took a look at the code, seems fine, as I say, I think you need to ask the MyODBC folk, as it gets passed through the driver manager to the driver. -- Nick Gorham Easysoft Limited http://www.easysoft.com, http://www.unixODBC.org _______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERHi nick,
Thanks again any ways if u get to know any thing about this 64 bit problem.please let me know. Regards, Faizan. On Thu, Mar 27, 2008 at 4:19 PM, Nick Gorham <nick.gorham@...> wrote:
_______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERqureshifaizan faiz wrote:
> Hi nick, > Thanks for the reply.please find the attached sample code > along with the sample table description to give you a bit > of more sight.I am very grateful for your interest in this > issue. Waiting for your reply,guys because this code > works in 32 bit machine iam not able to find the problem. > why it is not working on a 64 bit machine. > > Regards, > Faizan How are you compiling your code? Perhaps your MySQL driver was compiled with SIZEOF_LONG = 8 and your code is compiled with SIZEOF_LONG=4 ! Only guessing as the unixODBC sql* header files test SIZEOF_LONG but nothing is recorded in unixODBC itself to say how it was compiled. That means you can compile unixODBC with SIZEOF_LONG = 8, your driver with SIZEOF_LONG=4 and your app with SIZEOF_LONG=xx and they won't work together. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com > On Thu, Mar 27, 2008 at 2:58 PM, Nick Gorham <nick@... > <mailto:nick@...>> wrote: > > qureshifaizan faiz wrote: > > >Hello Freinds, > >Thanks for the reply.Take this simple example > > > >"select ID from TEST_TABLE where TEST_VALUE = ?" > > > >This query works fine in CLI using mysql 5.1. > > > >But in the application when i EXECUTE this query iam unable to > fetch the > >data using the SQLFetch and it returns DB_NO_DATA with a result > code 100 or > >some times gives a junk value. > >The procedure i have followed is as follows. > > > >i have used SQLUINTEGER for the input parameter in case of > SQLBindParameter. > > > >SQLUINTEGER value; > >SQLBindParameter(sthdl,1,SQL > >_PARAM_INPUT,SQL_C_ULONG,SQL_INTEGER,00,0,&value,00,00); > > > >SQINTEGER indIdValue; > >SQLUINTEGER idValue; > >retCode = > >SQLBindCol(sthdl,1,SQL_C_ULONG,&idValue,sizeof(idValue),&indIdValue); > >and same in the case of out put SQLBindCol > > > >//steps followed are. > >SQLPrepare > >SQLBindParameter > >SQLExecute > >SQLBindCol > >SQLFetch > > > >Iam executing this on a 64 bit machine with mysql 5.1. > > > >But the same code works fine on a 32 bit machine with mysql4.0. > > > >Iam not getting clue what the problem is.I will be very grateful > if you > >could help > >me solve this problem > > > >Regards > >Faizan. > > > > > > > The sample code looks fine, assuming sizeof( SQLUINTEGER ) == 4 as it > should. I would check with the MyODBC folk, as none of the values in the > SQLBindParameter/SQLBindCol are altered by unixODBC, and are passed onto > the driver. > > Just one thing, the indValue should be a SQLLEN type, and there are two > incompatible definitions of that, but again, in this case its between > the ap and the driver, the DM doesn't get involved. Even if the size was > wrong, as long as it didn;t end up being -1 (SQL_NULL_DATA) the driver > should ignore the length for fixed length type like a integer. > > -- > Nick unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERMartin Evans wrote:
> qureshifaizan faiz wrote: > >> Hi nick, >> Thanks for the reply.please find the attached sample code >> along with the sample table description to give you a bit >> of more sight.I am very grateful for your interest in this >> issue. Waiting for your reply,guys because this code >> works in 32 bit machine iam not able to find the problem. >> why it is not working on a 64 bit machine. >> >> Regards, >> Faizan > > > How are you compiling your code? Perhaps your MySQL driver was > compiled with SIZEOF_LONG = 8 and your code is compiled with > SIZEOF_LONG=4 ! Only guessing as the unixODBC sql* header files test > SIZEOF_LONG but nothing is recorded in unixODBC itself to say how it > was compiled. That means you can compile unixODBC with SIZEOF_LONG = > 8, your driver with SIZEOF_LONG=4 and your app with SIZEOF_LONG=xx and > they won't work together. > > Martin Yes, what Martin says is correct, but it should not be the problem here, as SQLINTEGER is always 4 bytes. However, if the app, DM and driver are built in different ways then it will cause problems. The newer releases of unixODBC allow the compile settings to be found by configure scripts using odbc_config --cflags and by looking at the header created by the driver manager build unixodbc_conf.h But if the driver is not built on that machine, there is no way of enforcing consistency -- Nick Gorham Easysoft Limited http://www.easysoft.com, http://www.unixODBC.org _______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERHi nick,
thanks for the reply.The application code was compiled on 64 bit machine with -m64 flag.And the DM was mysql connector driver which was 64 bit binary and odbc driver was compiled on the 64 bit machine.Apart from this i have one more query. Is their any option(compilation flag which can be set) for compiling odbc driver with 32 bit compilation on 64 bit machine. thanks again faizan On Thu, Mar 27, 2008 at 5:07 PM, Nick Gorham <nick.gorham@...> wrote:
_______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERqureshifaizan faiz wrote:
>Hi nick, >thanks for the reply.The application code was compiled on 64 bit machine >with -m64 flag.And the DM was mysql connector driver which was 64 bit binary >and odbc driver was compiled on the 64 bit machine.Apart from this i have >one more query. > >Is their any option(compilation flag which can be set) for compiling odbc >driver with 32 bit compilation on 64 bit machine. > > Set any CFLAGS for 32 bit build before running configure. -- Nick Gorham Easysoft Limited http://www.easysoft.com, http://www.unixODBC.org _______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERThanks nick,
shall try that option.I have read it on net,people working on 64 bit machine had same problem with SQLUINTEGER and SQLINTEGER when they changed to SQLULEN and SQLLEN,then the code was working fine.so will this change will help me in solving problem on 64 bit machine with unix os. Regards, Faizan. On Fri, Mar 28, 2008 at 3:00 PM, Nick Gorham <nick.gorham@...> wrote:
_______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERHi nick,
I have a small query regarding compilation error which iam getting while compiling the "unixODBC-2.2.11".I have the following machine configuration. os is fedora 6 machine is 64 bit when i do uname -a Linux localhost 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:39:22 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux Iam following this procedure. ./configure make all make install after make install i get a compilation error. please find the attached log with this mail. If you could kindly please have a look at the log and guide me further i will be grateful to you. you guys have been very helpful to me. Thanks in advance Faizan. On Fri, Mar 28, 2008 at 3:20 PM, qureshifaizan faiz <qureshifaizan@...> wrote: Thanks nick, step 1: ./configure --prefix /home/nilanjan/software/unixODBC-2.2.11 --enable-gui=no step 2: make all step 3: make install make[2]: Nothing to be done for `install-exec-am'. /bin/sh ../mkinstalldirs /home/nilanjan/software/unixODBC-2.2.11/include /usr/bin/install -c -m 644 odbcinst.h /home/nilanjan/software/unixODBC-2.2.11/include/odbcinst.h /usr/bin/install: `odbcinst.h' and `/home/nilanjan/software/unixODBC-2.2.11/include/odbcinst.h' are the same file /usr/bin/install -c -m 644 odbcinstext.h /home/nilanjan/software/unixODBC-2.2.11/include/odbcinstext.h /usr/bin/install: `odbcinstext.h' and `/home/nilanjan/software/unixODBC-2.2.11/include/odbcinstext.h' are the same file /usr/bin/install -c -m 644 sql.h /home/nilanjan/software/unixODBC-2.2.11/include/sql.h /usr/bin/install: `sql.h' and `/home/nilanjan/software/unixODBC-2.2.11/include/sql.h' are the same file /usr/bin/install -c -m 644 sqlext.h /home/nilanjan/software/unixODBC-2.2.11/include/sqlext.h /usr/bin/install: `sqlext.h' and `/home/nilanjan/software/unixODBC-2.2.11/include/sqlext.h' are the same file /usr/bin/install -c -m 644 sqltypes.h /home/nilanjan/software/unixODBC-2.2.11/include/sqltypes.h /usr/bin/install: `sqltypes.h' and `/home/nilanjan/software/unixODBC-2.2.11/include/sqltypes.h' are the same file /usr/bin/install -c -m 644 sqlucode.h /home/nilanjan/software/unixODBC-2.2.11/include/sqlucode.h /usr/bin/install: `sqlucode.h' and `/home/nilanjan/software/unixODBC-2.2.11/include/sqlucode.h' are the same file /usr/bin/install -c -m 644 uodbc_stats.h /home/nilanjan/software/unixODBC-2.2.11/include/uodbc_stats.h /usr/bin/install: `uodbc_stats.h' and `/home/nilanjan/software/unixODBC-2.2.11/include/uodbc_stats.h' are the same file /usr/bin/install -c -m 644 autotest.h /home/nilanjan/software/unixODBC-2.2.11/include/autotest.h /usr/bin/install: `autotest.h' and `/home/nilanjan/software/unixODBC-2.2.11/include/autotest.h' are the same file make[2]: *** [install-includeHEADERS] Error 1 make[2]: Leaving directory `/home/nilanjan/software/unixODBC-2.2.11/include' make[1]: *** [install-am] Error 2 make[1]: Leaving directory `/home/nilanjan/software/unixODBC-2.2.11/include' make: *** [install-recursive] Error 1 _______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERqureshifaizan faiz wrote:
>Hi nick, >I have a small query regarding compilation error which iam getting while >compiling the "unixODBC-2.2.11".I have the following machine configuration. > > > I think you have set it up to install to the same location as the build tree -- Nick _______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERThanks nick that compilation problem is resolved,
On Mon, Mar 31, 2008 at 3:42 PM, Nick Gorham <nick@...> wrote:
_______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
|
|
Re: Issue with ODBC on 64 bit machine while using SQLUINTEGER and SQLINTEGERMartin Evans <martin.evans@...> writes: > How are you compiling your code? Perhaps your MySQL driver was compiled > with SIZEOF_LONG = 8 and your code is compiled with SIZEOF_LONG=4 ! Only > guessing as the unixODBC sql* header files test SIZEOF_LONG but nothing > is recorded in unixODBC itself to say how it was compiled. That means > you can compile unixODBC with SIZEOF_LONG = 8, your driver with > SIZEOF_LONG=4 and your app with SIZEOF_LONG=xx and they won't work together. JFYI, the MySQL drivers are right now compiled against unixODBC-2.2.12 (with a few patches applied to correct unixODBC "descriptor bugs"). For 64-bit builds we currently don't set BUILD_REAL_64_BIT_MODE but we do set SIZEOF_LONG to 8 for all 64 bit platforms. This means that the driver is not compatible with precompiled unixODBC part of Linux distributions that has patched the source to set BUILD_REAL_64_BIT_MODE, kent _______________________________________________ unixODBC-dev mailing list unixODBC-dev@... http://mail.easysoft.com/mailman/listinfo/unixodbc-dev |
| Free Forum Powered by Nabble | Forum Help |