Skip to Content.
Sympa Menu

freetds - [freetds] SELECT querys fine, but INSERT query packets get malformed?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Scott Kovach <scott AT webdropstudio.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] SELECT querys fine, but INSERT query packets get malformed?
  • Date: Fri, 30 Jan 2009 09:02:24 -0600

Thanks in advance to anyone that might help with this.

We are interacting remotely with a sql server 2k DB from a unix machine. We are using the mssql libraries in PHP as our programming environment on the unix machine.

Here is our test script:

$link = mssql_pconnect (MSDBHOST . ":" . MSDBPORT, MSDBUSER, MSDBPASS);
if(!$link || !mssql_select_db(MSDB, $link))
{
die('Unable to connect or select database!');
}
$query_select = "SELECT * FROM VA_ORDHDR WHERE VA_ORDER_NUMBER = '1409-1'";
$queryid = mssql_query ($query_select, $link);
mssql_free_result($queryid);

$query_insert = "INSERT INTO VA_ORDHDR (VA_ORDER_NUMBER,VA_BUYERID,SHIP_CODE) VALUES ('1411-1','SC1276191463KO','VA03R')";
$queryid = mssql_query ($query_insert, $link);

$queryid = mssql_query ($query_select, $link);
mssql_free_result($queryid);



We CAN connect, send queries, and get results from querys from the remote sql server just fine. However, all of the "INSERT" or "UPDATE" queries fail, and the response is "Incorrect syntax near the keyword 'and'." (note: there is no 'and' in the query) The DBA of the remote sql server is saying that they fail due to some problem with the packets sent:

"Error: 17832, Severity: 20, State: 7
Connection opened but invalid login packet(s) sent. Connection closed.

You should have a talk with your provider. It seems that the packets
coming from your service are not valid."


I dont see how the sql server response of Incorrect syntax near the keyword
'and'." can be caused by the packets sent, since the connection is fine and a
response packet is received back from them and the select querys are sent in
valid packets. I've attached a log of a
single connection with 3 queries. If anyone can tell me if the failed inserts/updates are a freetds/php issue or whether its an issue on the remote sql server, i would be forever grateful.
-- Scott


Attachment: bingfOOiyBrs2.bin
Description: application/applefile

Attachment: freetds_log.log
Description: Binary data



  • [freetds] SELECT querys fine, but INSERT query packets get malformed?, Scott Kovach, 01/30/2009

Archive powered by MHonArc 2.6.24.

Top of Page