Max_allowed_packet variable ??

2001-02-25 Thread Li Sze

Hi,

This is how I set the variables in the my.cnf file.

[mysqld]
set-variable = key_buffer_size=16M
set-variable = max_allowed_packet=16M

I can only insert 8M at any one time using SQLPutData. Even if I insert 1024K more, 
the SQLPutData will return a "Function sequence error". Does max_allowed_packet means 
half of what is stated? Coz I tried setting the max_allowed_packet=2M, and eventually 
I can only insert 1M at any one time.

I'm not sure whether I have to set any other variables as well. Please advise.

Thanks,
Li Sze



Win2K and MyODBC?

2001-02-15 Thread Li Sze

Hi,

When I ran the application that uses myodbc as the interface to the mysql server 
(linux) on a Win98 platform, it works fine. But when I transferred the application to 
a Win2K pc and run it, I cannot even get through a connect. I have already granted 
access for the Win2K pc to access the mysql server with the correct username and 
password. I tested it using the mysql gui and it connects fine.

Are there any known problems when using myODBC with Win2K? Or are there any write ups 
on what needs to be done to get myodbc to work in Win2K environment?


Thanks,
Li Sze



Re: Help - SQLBindParameter not used for all parameters error

2001-02-08 Thread Li Sze

Thanks for responding. I've changed the column back to size 1. However, if I
follow the example from the Microsoft Documentation, that is setting the
last parameter to &cbValue where cbValue = SQL_NTS, and BufferLength to 0, I
get a handling exception error when the last SQLParamData is called. The
SQLParamData is used for my last column where I insert binary data using
SQLPutData.

The example is for a string of length more than 1 and as such I do not know
if there is a different workaround to this for single character entries. I
have tried applying all the working examples that I have come arcross to my
program but to no avail. I really have no idea what is going on here. Are
there any other approaches that I may try out?

Thanks,
lisze

> At 17:05 08/02/2001 +0800, Li Sze wrote:
> Hi!
>
> If you only need room for 1 character you don't need a column with
> size 2.
> The last parameter of SQLBindParameter is a pointer to a buffer for the
> parameter's length.
>
> Then error HY090 means:
>
> (DM) The argument ParameterValuePtr was a null pointer, the argument
> StrLen_or_IndPtr was a null pointer, and the argument InputOutputType was
> not SQL_PARAM_OUTPUT.
> (DM) SQL_PARAM_OUTPUT, where the argument ParameterValuePtr was a null
> pointer, the C type was char or binary, and the BufferLength (cbValueMax)
> was greater than 0.
>
> Take a look in the sample from Microsoft Documentation:
>
> #define SALES_PERSON_LEN 10
> #define STATUS_LEN 6
>
> SQLSMALLINT  sOrderID;
> SQLSMALLINT  sCustID;
> DATE_STRUCT  dsOpenDate;
> SQLCHAR szSalesPerson[SALES_PERSON_LEN];
> SQLCHAR szStatus[STATUS_LEN);
> SQLINTEGER  cbOrderID = 0, cbCustID = 0, cbOpenDate = 0, cbSalesPerson
> = SQL_NTS,
> cbStatus = SQL_NTS;
> SQLRETURN retcode;
> SQLHSTMT hstmt;
>
> /* Prepare the SQL statement with parameter markers. */
> retcode = SQLPrepare(hstmt,
> "INSERT INTO ORDERS (ORDERID, CUSTID, OPENDATE, SALESPERSON,
> STATUS) VALUES (?, ?, ?, ?, ?)", SQL_NTS);
> if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO) {
> /* Specify data types and buffers for OrderID, CustID, OpenDate,
> SalesPerson, */
> /* Status parameter data. */
> SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SSHORT,
> SQL_INTEGER, 0, 0, &sOrderID, 0, &cbOrderID);
> SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_SSHORT,
> SQL_INTEGER, 0, 0, &sCustID, 0, &cbCustID);
> SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_TYPE_DATE,
> SQL_TYPE_DATE, 0, 0, &dsOpenDate, 0, &cbOpenDate);
> SQLBindParameter(hstmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR,
> SQL_CHAR, SALES_PERSON_LEN, 0, szSalesPerson, 0, &cbSalesPerson);
> SQLBindParameter(hstmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR,
> SQL_CHAR, STATUS_LEN, 0, szStatus, 0, &cbStatus);
> /* Specify first row of parameter data. */
> sOrderID = 1001;
> sCustID = 298;
> dsOpenDate.year = 1996;
> dsOpenDate.month = 3;
> dsOpenDate.day = 8;
> strcpy(szSalesPerson, "Johnson");
> strcpy(szStatus, "Closed");
>
> /* Execute statement with first row. */
> retcode = SQLExecute(hstmt);
> /* Specify second row of parameter data. */
> sOrderID = 1002;
> sCustID = 501;
> dsOpenDate.year = 1996;
> dsOpenDate.month = 3;
> dsOpenDate.day = 9;
> strcpy(szSalesPerson, "Bailey");
> strcpy(szStatus, "Open");
>
> /* Execute statement with second row. */
> retcode = SQLExecute(hstmt);
> }
>
> Regards,
> Miguel
>

>
> >I have trouble writing a character into the database (the column is
> >declared as char(2) not null) because I figured that if it appends a null
> >at the end of the character data I want to insert (i.e.'A\0'), it would
> >still fit. I bound the parameters first before assigning the data and
> >executing a statement to write into the database. This is how I bind it:
> >
>
>---

> >g_rc = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR,
> >2, 0, (SQLPOINTER)chDataPart, 1, NULL);
> >->if I put NULL in the last parameter in the SQLBindParameter function, I
> >get the following error for the SQLParamData function call,
> >
> >Error code: HY090
> >Error message: SQLBindParameter not used for all parameters.
> >
> >However, I see many working examples that sets the last parameter to NULL
> >when it is a string. I'm not sure if it works for a character. I've
> >checked the manual and list archives and found out that the above error
> >message means [there is an error in the number of parameters in an insert
> >statement]. What does this

Help - SQLBindParameter not used for all parameters error

2001-02-08 Thread Li Sze


I have trouble writing a character into the database (the column is declared as 
char(2) not null) because I figured that if it appends a null at the end of the 
character data I want to insert (i.e.'A\0'), it would still fit. I bound the 
parameters first before assigning the data and executing a statement to write into the 
database. This is how I bind it:

---
g_rc = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 2, 0, 
(SQLPOINTER)chDataPart, 1, NULL);
->if I put NULL in the last parameter in the SQLBindParameter function, I get the 
following error for the SQLParamData function call,

Error code: HY090
Error message: SQLBindParameter not used for all parameters.

However, I see many working examples that sets the last parameter to NULL when it is a 
string. I'm not sure if it works for a character. I've checked the manual and list 
archives and found out that the above error message means [there is an error in the 
number of parameters in an insert statement]. What does this mean?

---
g_rc = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 2, 0, 
(SQLPOINTER)chDataPart, 1, 0);
->the funny thing is, if I put 0 in the last parameter in the SQLBindParameter 
function I don't get any error but the character data (i.e. 'A') that I assigned to 
the bound parameter would not be written into the database.

Am I missing out something here? Please advise.

Thanks in advance,
lisze



Unable to write string data

2001-02-04 Thread Li Sze

Hi all,

I'm using SQLBindParameters to bind the columns to variables of type integer, string 
and binary. There was no error during binding and writing. However, the string data 
are all NULL when I checked the database entries. I figured it could be a mistake in 
the SQLBindParameter parameters. 

What exactly should I put for the StrLen_or_IndPtr argument (the last argument)? 
Should it be NULL, 0 or SQL_NTS? Please advise.


charchDataType[12];

   g_rc = SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 
1, 0, (SQLPOINTER)chDataType, 12, &cbCharData);



Thanks,
Li SZe



Fw: MyODBC Error

2001-02-02 Thread Li Sze

Hi again,

I solved the weird thing but the original myODBC error is still there. How
do I know what values are suitable for my application. I'm using MediumBlob
to store my data so at any one time, the max amount of data to insert would
be 16M. So am I supposed to set max_allowed_packet to 16M, and if so, how
much should I set the key_buffer_size to. The key read/key read request =
approx 0.3969 and the key write/key write request = approx. 0.666. I don't
really know what this means but the manual says it should be <0.01.

Currently the variables are set as followed:
[mysqld]
 set-variable = key_buffer_size=16M
set-variable = max_allowed_packet=1M

As I have mentioned earlier, I couldn't even get >1MB through. Any idea
anyone?

Thanks,
Li Sze

- Original Message -
From: Li Sze <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 02, 2001 4:35 PM
Subject: Re: MyODBC Error, SQLGetData


> Hi,
>
> Thanks Miguel, I'll look through the manual.
>
> Another weird thing came up while I was testing the following code. The
> cbData in the following line of code always turns up as 8164. Previously,
> the cbData will indicate the size of the data to be retrieved.
>
> --
--
> ---
>   g_rc = SQLGetData(hstmt, 11, SQL_C_BINARY, &theVersions.byData, n,
> &cbData);
>if (g_rc == SQL_ERROR)
> ProcessLogMessages(SQL_HANDLE_STMT, hstmt, "SQLGetData() Failed\n\n",
> TRUE);
>
>while (g_rc == SQL_SUCCESS_WITH_INFO || g_rc == SQL_SUCCESS)
>{
> if (cbData > (SDWORD) n)
> {
>  if (::WriteFile(hFile, &theVersions.byData, n, &dwWriteSize, NULL) ==
> 0) {
>   dwFileIOError = ::GetLastError();
>   TRACE("WriteFile error: %d\n", dwFileIOError);
>  }
> } else {
>  if (::WriteFile(hFile, &theVersions.byData, cbData, &dwWriteSize,
NULL)
> == 0) {
>   dwFileIOError = ::GetLastError();
>   TRACE("WriteFile error: %d\n", dwFileIOError);
>  }
> }
> g_rc = SQLGetData(hstmt, 11, SQL_C_BINARY, &theVersions.byData, n,
> &cbData);
> if (g_rc == SQL_ERROR)
>  ProcessLogMessages(SQL_HANDLE_STMT, hstmt, "SQLGetData() Failed\n\n",
> TRUE);
>}
> ----------
--
> ---
>
> As I did not change anything, I'm really confused why it became constant.
> Even files that I've successfully tried retrieving yesterday doesn't work
> anymore.
>
> Li Sze
>
>
>
> - Original Message -
> From: Miguel Angel Solórzano <[EMAIL PROTECTED]>
> To: Li Sze <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Friday, February 02, 2001 1:41 PM
> Subject: Re: MyODBC Error
>
>
> > At 12:23 02/02/2001 +0800, Li Sze wrote:
> > Hi,
> >
> > Try to use the variables below in your my.cnf file:
> >
> > [mysqld]
> > set-variable = key_buffer_size=16M
> > set-variable = max_allowed_packet=1M
> >
> > Set the values according with your necessities and read in the
> > MySQL Manual the item Tuning server parameters.
> >
> > Regards,
> > Miguel
> >
> >
> >
> > >Hi,
> > >
> > >I'm using SQLPutData and SQLParamData to insert data into the database.
> It
> > >works fine with data files smaller than 1MB. However, I get the
following
> > >error for the last call to SQLParamData when the data file is more than
> 1MB.
> > >I have no idea what the following error means. I would really
appreciate
> it
> > >if someone could tell me what went wrong or if I need to include more
> > >information about this problem. Thanks in advance.
> > >
> > >The following is the trace log from myodbc.
> >
>
>---
> -
> > >myMFC   fff63add:fff7fe09 ENTER SQLPutData
> > >   HSTMT   0x00891258
> > >   PTR0x01710004
> > >   SDWORD 64974
> > >
> > >myMFC   fff63add:fff7fe09 EXIT  SQLPutData  with return code 0
> > >(SQL_SUCCESS)
> > >   HSTMT       0x00891258
> > >   PTR0x01710004
> > >   SDWORD 64974
> > >
> > >myMFC   fff63add:fff7fe09 ENTER SQLParamData
> > >   HSTMT   0x00891258
> > >   PTR * 

Re: MyODBC Error, SQLGetData

2001-02-02 Thread Li Sze

Hi,

Thanks Miguel, I'll look through the manual.

Another weird thing came up while I was testing the following code. The
cbData in the following line of code always turns up as 8164. Previously,
the cbData will indicate the size of the data to be retrieved.


---
  g_rc = SQLGetData(hstmt, 11, SQL_C_BINARY, &theVersions.byData, n,
&cbData);
   if (g_rc == SQL_ERROR)
ProcessLogMessages(SQL_HANDLE_STMT, hstmt, "SQLGetData() Failed\n\n",
TRUE);

   while (g_rc == SQL_SUCCESS_WITH_INFO || g_rc == SQL_SUCCESS)
   {
if (cbData > (SDWORD) n)
{
 if (::WriteFile(hFile, &theVersions.byData, n, &dwWriteSize, NULL) ==
0) {
  dwFileIOError = ::GetLastError();
  TRACE("WriteFile error: %d\n", dwFileIOError);
 }
} else {
 if (::WriteFile(hFile, &theVersions.byData, cbData, &dwWriteSize, NULL)
== 0) {
  dwFileIOError = ::GetLastError();
  TRACE("WriteFile error: %d\n", dwFileIOError);
 }
}
g_rc = SQLGetData(hstmt, 11, SQL_C_BINARY, &theVersions.byData, n,
&cbData);
if (g_rc == SQL_ERROR)
 ProcessLogMessages(SQL_HANDLE_STMT, hstmt, "SQLGetData() Failed\n\n",
TRUE);
   }

---

As I did not change anything, I'm really confused why it became constant.
Even files that I've successfully tried retrieving yesterday doesn't work
anymore.

Li Sze



- Original Message -
From: Miguel Angel Solórzano <[EMAIL PROTECTED]>
To: Li Sze <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, February 02, 2001 1:41 PM
Subject: Re: MyODBC Error


> At 12:23 02/02/2001 +0800, Li Sze wrote:
> Hi,
>
> Try to use the variables below in your my.cnf file:
>
> [mysqld]
> set-variable = key_buffer_size=16M
> set-variable = max_allowed_packet=1M
>
> Set the values according with your necessities and read in the
> MySQL Manual the item Tuning server parameters.
>
> Regards,
> Miguel
>
>
>
> >Hi,
> >
> >I'm using SQLPutData and SQLParamData to insert data into the database.
It
> >works fine with data files smaller than 1MB. However, I get the following
> >error for the last call to SQLParamData when the data file is more than
1MB.
> >I have no idea what the following error means. I would really appreciate
it
> >if someone could tell me what went wrong or if I need to include more
> >information about this problem. Thanks in advance.
> >
> >The following is the trace log from myodbc.
>
>---
-
> >myMFC   fff63add:fff7fe09 ENTER SQLPutData
> >   HSTMT   0x00891258
> >   PTR0x01710004
> >   SDWORD 64974
> >
> >myMFC   fff63add:fff7fe09 EXIT  SQLPutData  with return code 0
> >(SQL_SUCCESS)
> >   HSTMT   0x00891258
> >   PTR0x01710004
> >   SDWORD 64974
> >
> >myMFC   fff63add:fff7fe09 ENTER SQLParamData
> >   HSTMT   0x00891258
> >   PTR *  0x0066eb78
> >
> >myMFC   fff63add:fff7fe09 EXIT  SQLParamData  with return code -1
> >(SQL_ERROR)
> >   HSTMT   0x00891258
> >   PTR *  0x0066eb78
> >
> >   DIAG [HY000] [TCX][MyODBC]MySQL server has gone away (2006)
>
>---
-
> >
> >Regards,
> >Li Sze
>
> __  ___   __
>/  |/  /_ __/ __/ __ \/ /   http://www.mysql.com/
>   / /|_/ / // /\ \/ /_/ / /__  Miguel Solórzano <[EMAIL PROTECTED]>
> /_/  /_/\_, /___/\___\_\___/  São Paulo, Brazil
> <___/  Development Team
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




MyODBC Error

2001-02-01 Thread Li Sze

Hi,

I'm using SQLPutData and SQLParamData to insert data into the database. It
works fine with data files smaller than 1MB. However, I get the following
error for the last call to SQLParamData when the data file is more than 1MB.
I have no idea what the following error means. I would really appreciate it
if someone could tell me what went wrong or if I need to include more
information about this problem. Thanks in advance.

The following is the trace log from myodbc.

myMFC   fff63add:fff7fe09 ENTER SQLPutData
  HSTMT   0x00891258
  PTR0x01710004
  SDWORD 64974

myMFC   fff63add:fff7fe09 EXIT  SQLPutData  with return code 0
(SQL_SUCCESS)
  HSTMT   0x00891258
  PTR0x01710004
  SDWORD 64974

myMFC   fff63add:fff7fe09 ENTER SQLParamData
  HSTMT   0x00891258
  PTR *  0x0066eb78

myMFC   fff63add:fff7fe09 EXIT  SQLParamData  with return code -1
(SQL_ERROR)
  HSTMT   0x00891258
  PTR *  0x0066eb78

  DIAG [HY000] [TCX][MyODBC]MySQL server has gone away (2006)


Regards,
Li Sze





MyODBC Error

2001-02-01 Thread Li Sze

Hi,

I'm using SQLPutData and SQLParamData to insert data into the database. It works fine 
with data files smaller than 1MB. However, I get the following error for the last call 
to SQLParamData when the data file is more than 1MB. I have no idea what the following 
error means. I would really appreciate it if someone could tell me what went wrong or 
if I need to include more information about this problem. Thanks in advance.

The following is the trace log from myodbc.

myMFC   fff63add:fff7fe09 ENTER SQLPutData
  HSTMT   0x00891258
  PTR0x01710004
  SDWORD 64974

myMFC   fff63add:fff7fe09 EXIT  SQLPutData  with return code 0
(SQL_SUCCESS)
  HSTMT   0x00891258
  PTR0x01710004
  SDWORD 64974

myMFC   fff63add:fff7fe09 ENTER SQLParamData
  HSTMT   0x00891258
  PTR *  0x0066eb78

myMFC   fff63add:fff7fe09 EXIT  SQLParamData  with return code -1
(SQL_ERROR)
  HSTMT   0x00891258
  PTR *  0x0066eb78

  DIAG [HY000] [TCX][MyODBC]MySQL server has gone away (2006)



Regards,
Li Sze