hello
i want to use ZeosDBO with mysql 4.1.x
with the follow code
DBConnection1.HostName:= EdtDBServerAddress.Text;
DBConnection1.Port:=StrToInt(edtDBServerPort.text);
DBConnection1.User:=EdtDBUser.Text;
DBConnection1.Password:=edtDBPasswort.Text;
DBConnection1.Catalog:='mysql-4.1';
DBConnection1.Connect;
Query1.SQL.Clear;
Query1.Sql.Text:='Show DataBases';
Query1.Open;
but i get a EZSQLException "Can not open a resultset" after i open the Query
what is wrong with my code?
thanks for Help
Resultset
Moderators: gto, cipto_kh, EgonHugeist
-
- Junior Boarder
- Posts: 38
- Joined: 22.11.2005, 09:11
- Location: Skövde, Sweden
- Contact:
I use Zeos-6.1.5, so I don't know if anything has changed, but based on that version...
DBConnection1.Catalog should not by 'mysql-4.1'. You should assign that to Protocol instead. The Catalog property should be left blank. Actually, I have no idea what Catalog does myself, I never had to touch it.
Also, you haven't assigned anything to DBConnection1.Database. If you want to connect to a MySQL server without specifying a database name, you should consider setting DBConnection1.Properties to "dbless=true", this way it won't try to connect to a specific database, it just connects to the server.
And, oh... "Query1.SQL.Clear" is unnecessary.![Smile :)](./images/smilies/icon_smile.gif)
/ Mats
DBConnection1.Catalog should not by 'mysql-4.1'. You should assign that to Protocol instead. The Catalog property should be left blank. Actually, I have no idea what Catalog does myself, I never had to touch it.
Also, you haven't assigned anything to DBConnection1.Database. If you want to connect to a MySQL server without specifying a database name, you should consider setting DBConnection1.Properties to "dbless=true", this way it won't try to connect to a specific database, it just connects to the server.
And, oh... "Query1.SQL.Clear" is unnecessary.
![Smile :)](./images/smilies/icon_smile.gif)
/ Mats
Coffee clarifies the mind, improves morale, lifts the spirit and motivates and inspires to focused, productive work.
I agree. Correct the code like this:
DBConnection1.HostName:= EdtDBServerAddress.Text;
DBConnection1.Port:=StrToInt(edtDBServerPort.text);
DBConnection1.User:=EdtDBUser.Text;
DBConnection1.Password:=edtDBPasswort.Text;
DBConnection1.Protocol:='mysql-4.1'; (this can also be set designtime)
DBConnection1.Database := 'mysql'; (replace mysql with own DB)
DBConnection1.Connect;
Query1.Sql.Text:='Show DataBases';
Query1.Open;
Post if works...![Smile :)](./images/smilies/icon_smile.gif)
DBConnection1.HostName:= EdtDBServerAddress.Text;
DBConnection1.Port:=StrToInt(edtDBServerPort.text);
DBConnection1.User:=EdtDBUser.Text;
DBConnection1.Password:=edtDBPasswort.Text;
DBConnection1.Protocol:='mysql-4.1'; (this can also be set designtime)
DBConnection1.Database := 'mysql'; (replace mysql with own DB)
DBConnection1.Connect;
Query1.Sql.Text:='Show DataBases';
Query1.Open;
Post if works...
![Smile :)](./images/smilies/icon_smile.gif)
Hi
i have found the problem (i hope the fix is OK)
function TZMySQLStatement.ExecuteQuery(SQL: string): IZResultSet;
begin
Result := nil;
if FPlainDriver.ExecQuery(FHandle, PChar(SQL)) = 0 then
begin
DriverManager.LogMessage(lcExecute, FPlainDriver.GetProtocol, SQL);
if FPlainDriver.GetStatus(FHandle) = MYSQL_STATUS_READY then
raise EZSQLException.Create(SCanNotOpenResultSet);
Result := CreateResultSet(SQL);
end else
CheckMySQLError(FPlainDriver, FHandle, lcExecute, SQL);
end;
and now my change
if not (FPlainDriver.GetStatus(FHandle) = MYSQL_STATUS_READY) then
raise EZSQLException.Create(SCanNotOpenResultSet);
i think if the status is not ready the function do create the error ?
Juergen
i have found the problem (i hope the fix is OK)
function TZMySQLStatement.ExecuteQuery(SQL: string): IZResultSet;
begin
Result := nil;
if FPlainDriver.ExecQuery(FHandle, PChar(SQL)) = 0 then
begin
DriverManager.LogMessage(lcExecute, FPlainDriver.GetProtocol, SQL);
if FPlainDriver.GetStatus(FHandle) = MYSQL_STATUS_READY then
raise EZSQLException.Create(SCanNotOpenResultSet);
Result := CreateResultSet(SQL);
end else
CheckMySQLError(FPlainDriver, FHandle, lcExecute, SQL);
end;
and now my change
if not (FPlainDriver.GetStatus(FHandle) = MYSQL_STATUS_READY) then
raise EZSQLException.Create(SCanNotOpenResultSet);
i think if the status is not ready the function do create the error ?
Juergen
i have the same problem with D2006-FB1.5.3-Zeos 6.5.1alpha
error is in :
im geting SQLData.GetFieldCount =0 and error pop-ups
any ideas?
thx
error is in :
Code: Select all
function TZInterbase6PreparedStatement.ExecuteQueryPrepared
...
if (StatementType in [stSelect, stExecProc])
and (SQLData.GetFieldCount <> 0) then
...
else
raise EZSQLException.Create(SCanNotRetrieveResultSetData);
...
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
any ideas?
thx