Problem with Delphi + Zeos + MySQL/Oracle

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
rchaves
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 27.02.2008, 18:30
Location: Araçatuba-São Paulo

Problem with Delphi + Zeos + MySQL/Oracle

Post 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 ?
gto
Zeos Dev Team
Zeos Dev Team
Posts: 278
Joined: 11.11.2005, 18:35
Location: Porto Alegre / Brasil

Post 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
Use the FU!!!!!IN Google !

gto's Zeos Quick Start Guide

Te Amo Taís!
rchaves
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 27.02.2008, 18:30
Location: Araçatuba-São Paulo

Post 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
rchaves
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 27.02.2008, 18:30
Location: Araçatuba-São Paulo

Post by rchaves »

ps: the username and the password are really equals
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
rchaves
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 27.02.2008, 18:30
Location: Araçatuba-São Paulo

Post by rchaves »

the problem is that i will use both DataBases ...

zeos does not support ?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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...
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post by pol »

For Oracle it works that way:
Database: tnsnames.ora entry for the database
HostName: empty
rchaves
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 27.02.2008, 18:30
Location: Araçatuba-São Paulo

Post 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 ?
rchaves
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 27.02.2008, 18:30
Location: Araçatuba-São Paulo

Post 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)
)
)
rchaves
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 27.02.2008, 18:30
Location: Araçatuba-São Paulo

Post by rchaves »

hey guys ... thanks for the help ...

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

Thanks a lot ... you are great
rchaves
Fresh Boarder
Fresh Boarder
Posts: 9
Joined: 27.02.2008, 18:30
Location: Araçatuba-São Paulo

Post by rchaves »

by the way, Mysql works fine to ...

you guys helped me a lot thanks
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post 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.
Post Reply