Hi
I am very new to Zeoslib and I am trying to connect the ZConnection1 component to my Oracle 11G R2 database using Delphi XE2, but I cannot seem to get it connected.
I already use a set of 3rd party software, Direct Oracle Access and the standard BDE TDatabase component which use my TNS.ora file to connect to the database with ease.
The problem is the newer versions of XE no longer use BDE components and Direct Oracle Access does not provide all the components we need but Zeoslib does, but I am not sure what properties need to be set in order for the component to see the database and connect to it?
Both the 'Database' and 'LibraryLocation' fields are looking for actual files, 'HostName' is blank, and 'Port' is equal to 0.
Connect Zeoslib to Oracle
- GhostReaper
- Fresh Boarder
- Posts: 6
- Joined: 11.06.2014, 07:47
- Location: South Africa
Connect Zeoslib to Oracle
Last edited by GhostReaper on 03.07.2015, 07:34, edited 1 time in total.
Re: Connect Zeoslib to Oracle
Database
Password
Protocol
User
possibly LibraryLocation
Michal
Password
Protocol
User
possibly LibraryLocation
Michal
- GhostReaper
- Fresh Boarder
- Posts: 6
- Joined: 11.06.2014, 07:47
- Location: South Africa
Re: Connect Zeoslib to Oracle
Okay I don't understand what you mean?miab3 wrote:Database
Password
Protocol
User
possibly LibraryLocation
Michal
I am used to using the tnsnames.ora file within my oracle setup, so that when I drop a BDE TDatabase component onto a form within Delphi, in the database parameter, it picks up automatically all my database connections. Are you saying that I need to physically select my tnsnames.ora file in the Database parameter of the ZConnection component as it is looking for a specific file? The name of the database and port number is in the tnsnames.ora file, so do I still need to specify the Port number then?
I also need to be able to connect to a remote MySQL server to access its data and send and receive data from the local Oracle server to the remote MySQL, but at the moment we use TDatabase component and a standard ODBC 5.3 Driver to connect to the remote server, so there is no local libmysql*.dll files, how do I get the ZConnection to connect to the remote SQL database?
Re: Connect Zeoslib to Oracle
Here's an example of what I do to connect to any database engine supported by ZeosLib
Maybe this throws some light on what you need to do. Every other ZeosLib component have Connection property pointing to this ZConnection1.
Code: Select all
fini:= TIniFile.Create(ChangeFileExt( application.ExeName,'.ini')) ;
with ZConnection1 do begin
Protocol := fini.ReadString('Database', 'Protocol', 'mysqld-5');
Database := fini.ReadString('Database', 'Database', 'historial');
if Protocol='mysqld-5' then begin
Properties.Add('ServerArgument1=--basedir=./');
Properties.Add('ServerArgument2=--datadir=./data');
Properties.Add('ServerArgument3=--character-sets-dir=./share/charsets');
Properties.Add('ServerArgument4=--language=./share/spanish');
Properties.Add('ServerArgument5=--skip-innodb');
Properties.Add('ServerArgument6=--key_buffer_size=32M');
end
else begin
HostName := fini.ReadString('Database', 'Host', '');
Port := fini.ReadInteger('Database', 'Port', 0);
User := fini.ReadString('Database', 'User', '');
Password := fini.ReadString('Database', 'Password', '');
end;
end;
fini.Free;
try
ZConnection1.Connect;
finally
ZConnection1.Disconnect;
end;
Re: Connect Zeoslib to Oracle
To be able to connect to a remote server, in the hostname you put it's domain or ip address (also need to set the port), the rest stays as is. The Mysql server must be reachable, that means it must be in the same network space or expossed to the internet (something not so wise imho).
- GhostReaper
- Fresh Boarder
- Posts: 6
- Joined: 11.06.2014, 07:47
- Location: South Africa
Re: Connect Zeoslib to Oracle
We are currently using a MySQL ODBC connection to connect remotely to our MySQL database which a BDE TDatabase component can pick up in Delphi2005 no problem. Our remote server is a linux machine and is hosted by an external company.Pitfiend wrote:To be able to connect to a remote server, in the hostname you put it's domain or ip address (also need to set the port), the rest stays as is. The Mysql server must be reachable, that means it must be in the same network space or expossed to the internet (something not so wise imho).
I have entered the hostname as the remote server's ip address, entered the database name, and the port number, password and user. I also selected the protocol which is 'mysql-5'. When I try and connect, it just brings up a error message that says the following:
Not sure what the last part of the message means. That code that you used as an example, where do I enter that code exactly?
I have managed to get it to connect to our Oracle DB now, just struggling with the remote MySQL part now.
You do not have the required permissions to view the files attached to this post.
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: Connect Zeoslib to Oracle
Hello GhostReaper,
it has been some time for me since I used Zeos with Oracle and it was only at one ocassion. But I would guess something like this:
Set the protocol property of your TZConnection Object to the oracle or oracle-9i protocol.
Keep the hostname property empty.
in the database name enter the name of your database from tnsnames.ora
set the username and password
choose a suitable connection character set encoding.
With best regards,
Jan
it has been some time for me since I used Zeos with Oracle and it was only at one ocassion. But I would guess something like this:
Set the protocol property of your TZConnection Object to the oracle or oracle-9i protocol.
Keep the hostname property empty.
in the database name enter the name of your database from tnsnames.ora
set the username and password
choose a suitable connection character set encoding.
With best regards,
Jan
Re: Connect Zeoslib to Oracle
From what I see, you miss some DLLs, you need to put libmysql.dll in the same folder as your app or put it in a system path. If you don't have any DLL, you must download mysql zip file and have a look inside the lib folder for them (don't mix x32 with x64 binaries). There are 2 DLLs, one for remote connection (libmysql.dll) and the other for embeded database (libmysqld.dll) (this needs some tricks to run, if you want I can explain later). In hostname you need to put either an ip address or a formal url.
Hope this solves your troubles.
Hope this solves your troubles.