Re: My 1st JDBC and PostgreSQL

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: My 1st JDBC and PostgreSQL
Дата
Msg-id 466555.1689814728@sss.pgh.pa.us
обсуждение исходный текст
Ответ на My 1st JDBC and PostgreSQL  (Amn Ojee Uw <amnojeeuw@gmail.com>)
Список pgsql-general
Amn Ojee Uw <amnojeeuw@gmail.com> writes:
> https://www.tutorialspoint.com/postgresql/postgresql_java.htm
> In reference to the above web page, it reads :
> The following Java code shows how to connect to an existing database. If 
> the database does not exist, then it will be created and finally a 
> database object will be returned.
> True, the database file does not exist, but isn't JDBC supposed to 
> create it?

I think that web page is lying to you.  JDBC cannot promise to
create a database for you, because (a) if the given database
doesn't exist, it would have to guess at some other database
to connect to, with no certainty of success; and (b) even if
it manages to connect to the server, there's no certainty
that you'd have permissions to create a new database.
So I don't believe any JDBC driver would even try.

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: Maciek Sakrejda
Дата:
Сообщение: Re: Nu-B here
Следующее
От: Chuck Davis
Дата:
Сообщение: Re: My 1st JDBC and PostgreSQL