Discussion:
[DBX] Catching DBMS error message?
(too old to reply)
Ahmadi
2008-05-07 09:48:47 UTC
Permalink
Hi
Im using D2007+SQLServer 2005+dbExpress driver(and dbx controls)
I have one error while running a query with following code:
...
mQuery.SQL.Clear;
mQuery.SQL.Add(sqlcommand);
try
mQuery.ExecSQL(true);
except
on E: Exception do
showmessage(E.Message);
end;
...

the error message is "DBX Error: Error Code: 16389)" , i can not
understand what this mean?
also google have no info about this error message.
16389 is not fix and is variable ! (seem that is a random number)
How can i catch DBMS error !?
Here is a sample query(that insert N records to table1):
Insert into table1 fields(f1,f2,f3) values ('field1','field2','1');
...
Insert into table1 fields(f1,f2,f3) values ('field1','field2','N');
consider that query have error(duplicate key value).
if i catch the error : error message ="DBX Error: Error Code: 16389)" , is
not a good information
But if i run this query with SQL Management Studio , the error is "You can
not insert duplicate record", and is very good information.
the above sample is only one sample, and is not my problem, just show my
problem
my problem is that i want to catch complete error message from DBMS such as
SQL Server Management Studio.

Thanks for any help

~~~~~~~~~~~
Best Regards
H.Ahmadi
Jan Doggen
2008-05-08 17:18:53 UTC
Permalink
Hello Ahmadi

- Perhaps you can use TSQLMonitor to see in mote detail what is going on.
Maybe the error is truncated or something...
- Do you have multiple SQL statements in the mQuery? That won't work

Bye
Jan
Post by Ahmadi
Hi
Im using D2007+SQLServer 2005+dbExpress driver(and dbx controls)
...
mQuery.SQL.Clear;
mQuery.SQL.Add(sqlcommand);
try
mQuery.ExecSQL(true);
except
on E: Exception do
showmessage(E.Message);
end;
...
the error message is "DBX Error: Error Code: 16389)" , i can not
understand what this mean?
also google have no info about this error message.
16389 is not fix and is variable ! (seem that is a random number)
How can i catch DBMS error !?
Insert into table1 fields(f1,f2,f3) values ('field1','field2','1');
...
Insert into table1 fields(f1,f2,f3) values ('field1','field2','N');
consider that query have error(duplicate key value).
if i catch the error : error message ="DBX Error: Error Code: 16389)" ,
is not a good information
But if i run this query with SQL Management Studio , the error is "You can
not insert duplicate record", and is very good information.
the above sample is only one sample, and is not my problem, just show my
problem
my problem is that i want to catch complete error message from DBMS such
as SQL Server Management Studio.
Thanks for any help
~~~~~~~~~~~
Best Regards
H.Ahmadi
Ahmadi
2008-05-10 05:42:29 UTC
Permalink
Post by Jan Doggen
- Do you have multiple SQL statements in the mQuery? That won't work
Yes,i have,i have multiple SQL statements in the mQuery(1000 insert
commands).
but why would not work? there is no other way that i catch more info?

Thanks
H.Ahmadi
Jan Doggen
2008-05-11 19:18:22 UTC
Permalink
1000 inserts?
That sounds as if they are very identical...
If so, use parameterized queries.
And if you really need to import large amounts of data, nothing beats
writing to a text file and then using a BULK INSERT query.

Jan
Post by Ahmadi
Post by Jan Doggen
- Do you have multiple SQL statements in the mQuery? That won't work
Yes,i have,i have multiple SQL statements in the mQuery(1000 insert
commands).
but why would not work? there is no other way that i catch more info?
Thanks
H.Ahmadi
Ahmadi
2008-05-18 05:27:40 UTC
Permalink
Post by Jan Doggen
- Perhaps you can use TSQLMonitor to see in mote detail what is going on.
Maybe the error is truncated or something...
TSQLMonitor not exists in Delphi 2007 !?
Also i can not find any link on internet to download it.
How can i use it in D2007?
Bill Todd [TeamB]
2008-05-18 12:12:51 UTC
Permalink
Post by Ahmadi
TSQLMonitor not exists in Delphi 2007 !?
It does in my copy of D2007 Enterprise. There are seven components on
the dbExpress tab and TSQLMonitor is the last one.
--
Bill Todd (TeamB)
Yannis
2008-05-18 16:22:51 UTC
Permalink
Post by Bill Todd [TeamB]
Post by Ahmadi
TSQLMonitor not exists in Delphi 2007 !?
It does in my copy of D2007 Enterprise.
No it doesn't exists on D2007 Professional. There are only 6
components in that tab

--
Ahmadi
2008-05-26 07:18:41 UTC
Permalink
Post by Bill Todd [TeamB]
It does in my copy of D2007 Enterprise. There are seven components on
the dbExpress tab and TSQLMonitor is the last one.
I have 6 components, TSQLMonitor not exists!
This mean that i can't get full information about my exception, with this
version of D2007 that im using !

Loading...