Recent

Author Topic: I need to connect with database server  (Read 5322 times)

Gebony

  • New Member
  • *
  • Posts: 18
I need to connect with database server
« on: May 20, 2019, 02:23:39 pm »
I want  to connect to database server not to the database itself.
or I want to program database server management tool.
How can I do this?
« Last Edit: May 20, 2019, 02:25:21 pm by Gebony »

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: I need to connect with database server
« Reply #1 on: May 20, 2019, 02:31:13 pm »
Which server?

What do you actually want to achieve?

Gebony

  • New Member
  • *
  • Posts: 18
Re: I need to connect with database server
« Reply #2 on: May 20, 2019, 02:34:28 pm »
postgres and mariadb or mysql.
I want program tool like HeidiSQL or pgadmin but for desktop.
« Last Edit: May 20, 2019, 02:37:32 pm by Gebony »

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: I need to connect with database server
« Reply #3 on: May 20, 2019, 02:54:32 pm »
postgres and mariadb or mysql.
I want program tool like HeidiSQL or pgadmin but for desktop.
So... you don't need to connect to the engine without a database.

All these tools are made that you first need to 'register' a database with the tool.
Before that registration, there is no connection needed yet.
After that you can just list all registered databases and connect to them with the normal connect command.

If are some databasemanagers made in Lazarus, so you can look at them how it's done.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: I need to connect with database server
« Reply #4 on: May 21, 2019, 12:18:35 am »
Lazarus ships with one standalone database desktop tool, check your tools folder.

Gebony

  • New Member
  • *
  • Posts: 18
Re: I need to connect with database server
« Reply #5 on: May 21, 2019, 02:08:51 pm »
but these tools don't need to register but browse the databases and create database if you need to .

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: I need to connect with database server
« Reply #6 on: May 21, 2019, 03:23:19 pm »
but these tools don't need to register but browse the databases and create database if you need to .
Yes, for MySQL (and MariaDB) you are correct.
You can use SHOW DATABASES to show the available databases.
But you still need to supply ONE databaseame to connect.

You can use the mysql-databasename for that.
Code: Pascal  [Select][+][-]
  1. MySQLConnection1.DatabaseName := 'mysql'; // MySQL is allways there!
See the example here: http://wiki.freepascal.org/MySQLDatabases#Connect_to_a_server
Quote
This database is used by mysql for some housekeeping so it will always be there.


Gebony

  • New Member
  • *
  • Posts: 18
Re: I need to connect with database server
« Reply #7 on: May 21, 2019, 03:25:50 pm »
thank you I saw it in the wikisite,but I need the same for postgresql too.

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: I need to connect with database server
« Reply #8 on: May 21, 2019, 04:26:48 pm »
thank you I saw it in the wikisite,but I need the same for postgresql too.
And what databasemanager do you know can do this, which can also handle postgresql?

Some database just don't have the ability to show known databases.
I know Firebird can't do it. I don't think postgresql can either.

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: I need to connect with database server
« Reply #9 on: May 21, 2019, 04:58:20 pm »
thank you I saw it in the wikisite,but I need the same for postgresql too.
And what databasemanager do you know can do this, which can also handle postgresql?

Some database just don't have the ability to show known databases.
I know Firebird can't do it. I don't think postgresql can either.
You are absolutely right:
Most can't do it. Indeed. Older versions of most, however, would have worked in the past.
The issue is simply security related and so would only work with a secure connection (in the case of mysql/mariadb: indeed a proper login to at least one, if it isn't proxied out of sight, that is)
Also known as separation of interest: access should be on a per database basis -or even on a more finely grained level like Oracle supports- , not everything the server actually hosts: that should never be available all at once.
« Last Edit: May 21, 2019, 05:28:37 pm by Thaddy »
Specialize a type, not a var.

Zvoni

  • Hero Member
  • *****
  • Posts: 2313
Re: I need to connect with database server
« Reply #10 on: May 22, 2019, 04:50:04 pm »

And what databasemanager do you know can do this, which can also handle postgresql?

Some database just don't have the ability to show known databases.
I know Firebird can't do it. I don't think postgresql can either.


Anyone ever heard of DBeaver?
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: I need to connect with database server
« Reply #11 on: May 22, 2019, 04:54:15 pm »

Anyone ever heard of DBeaver?
Yes. Has the same restrictions as I described..... (for the same reasons)
Maybe I forgot to explain: over the web, not over a lan or tunneled.
« Last Edit: May 22, 2019, 04:56:25 pm by Thaddy »
Specialize a type, not a var.

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: I need to connect with database server
« Reply #12 on: May 22, 2019, 05:00:12 pm »

And what databasemanager do you know can do this, which can also handle postgresql?

Some database just don't have the ability to show known databases.
I know Firebird can't do it. I don't think postgresql can either.


Anyone ever heard of DBeaver?
I have.

And are you saying DBeaver can list all available databases on the postgresql server without first registering such a database???
So you can just connect to a postgresql databaseserver and it will magically list all databases it knows?

(If not, please read this topic carefully)

Look at the image below. You would need to "Register" any postgresql database you want to work with first in DBeaver.

Maybe I forgot to explain: over the web, not over a lan or tunneled.
Does postgresql "publish" all it's available databases on the internal network/lan?
(I know for certain Firebird doesn't).

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: I need to connect with database server
« Reply #13 on: May 22, 2019, 05:28:27 pm »
That's what I wrote too Rik...
Specialize a type, not a var.

Zvoni

  • Hero Member
  • *****
  • Posts: 2313
Re: I need to connect with database server
« Reply #14 on: May 22, 2019, 09:54:41 pm »
Ah, ok. Now i understand.
Well, considering MySQL, that the User-Data needed for Login is actually stored in the "mysql"-DB, i agree: It makes no sense to connect to a DB-Server without at least specifying "mysql" (or in case of PG "postgres" (=Maintenance-DB)).
So to connect to a server, the server itself has to store your credentials somewhere
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

 

TinyPortal © 2005-2018