Page 1 of 1

Problem with Delphi + Zeos + MySQL/Oracle

Posted: 27.02.2008, 18:42
by rchaves
Hi guys. Sorry about my english. It is not one of the best, i am brasilian.

I am with a problem.

I work with two databases, Oracle and Mysql and i need to connect the component ZConnection with the network ...
With ADO i used to fill the property HostName with the server name and works fine. But with ZConnection, not works.

It simply ignore the hostname and connect with my local database.

There is someone that can help me ?

Posted: 27.02.2008, 21:16
by gto
Hello rchaves!

Welcome to Zeos Forum. Don't worry about your english, it's very good ;)

About you problem, what version do you use? I've tested the latest Zeos versions with Interbase, Firebird, MySQL and PostgreSQL, all local and via network. And all of them worked right as I wanted to.

Properties you must fill in order to connect successfully:

Database (default: Empty) Used to tell which database the connection should connect to. It's database dependant. In Firebird/Interbase protocols, its a string with the full path, on server, of the database. In MySQL, PostgreSQL and possibly other, its the name of the database. In SQLite, its the full path to the database file. In ADO, its the connection string (?).

HostName (default: Empty) The host where the database is running. If its a local databse, you can use it empty, fill up the local loopback address (127.0.0.1 for IPV4, ::1 for IPV6) or even with your local network address (used to share the program over the network). It's database dependant.

Password (default: Empty) The password you use to connect to your database. It will be used when LoginPrompt is False.

Protocol (default: Empty) The protocol that will be used when trying to connect. The correct selection of protocol is important so the correct library will be loaded and other minor changes will take place. Actually, there are 26 different protocol Zeos can handle. Some of it work very good, and others not so good. Here's a list (taken with Zeos 6.6.2-BETA): (In need of more information about which protocol is broken.)

TransactIsolationLevel (default: tiNone) Here you can select the Isolation Level that will be used withing Zeos transactions. It's database dependant, as some DBs don't support all of them. The current options are:

User (default: Empty)
Username that will be used to connect to database. Used when LoginPrompt is False.

This information and a little more you can read in my Quick 'n Dirty Start Guide (work in progress):
http://zeos.firmos.at/viewtopic.php?t=1317

Posted: 27.02.2008, 21:43
by rchaves
gto ... thanks about the answer ...

but i've tested this and still not works...

i've put this code on the event before connect of zconnection ...

with cnnDados do
begin
Port := 1521;
Database := '';
HostName := 'bti01';
Password := 'bdbti';
Protocol := 'oracle-9i';
User := 'bdbti';
end;

Even filling in order zconnection still connects locally ...

ps: I'm trying to connect with oracle 10g

Posted: 27.02.2008, 21:44
by rchaves
ps: the username and the password are really equals

Posted: 28.02.2008, 00:16
by mdaems
Start without a before connect event. Just set the properties using the object inspector or eventually in the code before the 'Connection1.Connect' call.
Another thing : test using Mysql. Oracle is a little tricky as there exists something like TNSNames which also has some implications.

Mark

Posted: 28.02.2008, 01:46
by rchaves
the problem is that i will use both DataBases ...

zeos does not support ?

Posted: 28.02.2008, 02:24
by mdaems
It should, but let's start with the easiest... If it works for mysql we'll do Oracle. To make you comfortable, I used both 2 days ago, Oracle remote and mysql local.

My advise : if you have a problem start from zero. (= 1 single, database/server:form/component/...) if you understand that situation, all complex situations follow in (almost) no time...

Posted: 28.02.2008, 11:32
by pol
For Oracle it works that way:
Database: tnsnames.ora entry for the database
HostName: empty

Posted: 28.02.2008, 14:15
by rchaves
i've tested this way the last colegue said ....

but returns a oracle error...

ORA-12154

but my tnsnames.ora is configured correctly ... do you know what happens ?

Posted: 28.02.2008, 14:17
by rchaves
my server ip is 192.168.1.8, the port is 1521

folowing my tnsnames.ora file

XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.8)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)

EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)

ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)

Posted: 28.02.2008, 14:31
by rchaves
hey guys ... thanks for the help ...

I simply changed the database name to 'xe' and works ...

Thanks a lot ... you are great

Posted: 28.02.2008, 15:01
by rchaves
by the way, Mysql works fine to ...

you guys helped me a lot thanks

Posted: 05.03.2008, 10:59
by pol
XE. That is what I meant. It is hard to say how that thingy is called. I looked it up in the documentation: it#s Net Service Name. Aha.