Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » How to work with PostgreSQL?(Problem with PostgreSQL)
icon9.gif  How to work with PostgreSQL? [message #1385382] Fri, 06 June 2014 04:55 Go to next message
Barust R. is currently offline Barust R.Friend
Messages: 43
Registered: February 2014
Member
Hi!
Maybe this is trivial, but I have not got it, how to work with PostgreSQL?
Can anyone suggest how to incrementally adjust the PostgreSQL Scout? Since I already tried to "HowTo" do it, but the proper result I did not get.Are there any conditions in the setting of the PostgreSQL server?
Re: How to work with PostgreSQL? [message #1385615 is a reply to message #1385382] Tue, 10 June 2014 04:20 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 946
Registered: October 2011
Senior Member
I do not know PostgreSQL but I think that it works like any other DB.

How does your SQL Service class looks like? Does it extends AbstractPostgreSqlService ?

Can you connect to your database with a Java-based client like SQuirreL? (the installation of the drivers in this SQL client is not straight forward). If yes, does the JDBC connection String match the one you have defined in your scout Server?

.
Re: How to work with PostgreSQL? [message #1385736 is a reply to message #1385615] Tue, 10 June 2014 20:00 Go to previous messageGo to next message
Matthias Zimmermann is currently offline Matthias ZimmermannFriend
Messages: 93
Registered: February 2010
Member
Did you already have a look at the postgresql driver for scout [1] that is available on the eclipse marketplace? I didn't try recently, but maybe this solves your problem. Thanks for checking and letting us know.

[1] http://marketplace.eclipse.org/content/jdbc-drivers-eclipse-scout
Re: How to work with PostgreSQL? [message #1385810 is a reply to message #1385736] Wed, 11 June 2014 11:04 Go to previous messageGo to next message
Barust R. is currently offline Barust R.Friend
Messages: 43
Registered: February 2014
Member
Hi Jeremie, Mattias.
Thank you for giving me attention!

Through trial and error, I solved this problem. I do not know what was the reason, but after reinstalling PostgreSQL version 9.3.4(currently version) to 9.1.13 everything worked.

Eclipse Scout I really liked, it really is possible to create complex programs.
Thank you!

P.S.: I would like to share my solution, maybe it will help someone.

I am worked on Ubuntu 12.04. Java version "1.7.0_60". Eclipse for Scout Developers(Version: Kepler Service Release 2 Build id: 20140224-0627).

Installing PostgreSQL(version 9.1.13):

In console mode, do next:

-install postgreSQL:
$sudo apt-get update
$sudo apt-get install postgresql postgresql-contrib

-change postgres user password:
$sudo -u postgres psql postgres
\password postgres
(e.g. enter as password 'postgres')

-change the authentication method from peer to md5:
$sudo nano /etc/postgresql/9.1/main/pg_hba.conf
and change the line

#Database administrative login by Unix domain socket
local all postgres peer
to
local all postgres md5

-then reload PostgreSQL:
$sudo /etc/init.d/postgresql reload

-create minicrm database:
$sudo -u postgres createdb minicrm

-reenter PostgreSQL database minisrm
$sudo -u postgres psql -d minicrm

-create Table Company with fields (company_nr, short_name, name):
minicrm=# create table company (company_nr integer not null, short_name varchar(60) not null, name varchar(240) not null);

-you can view result:
minicrm=# \dt

-then insert data to the table Company:
minicrm=# insert into company (company_nr, short_name, name) values(1, 'BSIAG', 'Greate Company BSIAG');

-(optional) insert second data to the table Company:
minicrm=# insert into company (company_nr, short_name, name) values(2, 'BARUST', 'Any Company BARUST');

-show results:
minicrm=# select * from company;

company_nr | short_name | name
------------+------------+----------------------
1 | BSIAG | Greate Company BSIAG
2 | BARUST | Any Company BARUST
(2 rows)

That is all, database minicrm and table company created!

Next step:

From Scout/Tutorial/3.9/Minicrm/Minicrm Step-by-Step:

1) Download, install Eclipse Scout Kepler SR2. (I think it's easy, why does not detail.)http://wiki.eclipse.org/Scout/HowTo/3.9/Install_Scout_SDK

2) Create New Eclipse Scout Project(outline tree with table form). (I think it's easy, why does not detail.)http://wiki.eclipse.org/Scout/Tutorial/3.9/Minicrm/New_Eclipse_Scout_Project

3) Add JDBC Drivers for Eclipse Scout:
-uncheck the box named 'Derby JDBC Driver for Eclipse Scout'.
-check the box named 'PostgreSQL 9 JDBC Driver for Eclipse Scout'.
(for details, see here:http://wiki.eclipse.org/Scout/Tutorial/3.9/Add_JDBC_Drivers_for_Eclipse_Scout)

4) Creating a SQL Service:
-сreate a new AbstractPostgreSqlService
From ('Server' |'Common Services' | 'SQL Services'), right click and open new wizard. For:
-class name type: 'Postgre'
-Super class choose: 'AbstractPostgreSqlService'
(for details, see here:http://wiki.eclipse.org/Scout/Tutorial/3.9/Add_JDBC_Drivers_for_Eclipse_Scout)
-configure properties of PostgreSqlService as next:

  @Override
  protected String getConfiguredJdbcMappingName() {
    return "jdbc:postgresql://localhost:5432/minicrm";
  }

  @Override
  protected String getConfiguredPassword() {
    return "postgres";
  }

  @Override
  protected String getConfiguredUsername() {
    return "postgres";
  }

5) Write the first page.(I think it's easy, why does not detail.)
(for details/ see here: http://wiki.eclipse.org/Scout/Tutorial/3.9/Minicrm/Write_the_first_page).

That's all, your first page with data should appear.


Kind regards
Bahtiyor.
Re: How to work with PostgreSQL? [message #1385823 is a reply to message #1385810] Wed, 11 June 2014 12:28 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 194
Registered: August 2013
Senior Member
Hi Bahtiyor,
glad it worked out and thank you very much for sharing your solution, we really appreciate it.

If you have any other questions during the development of your app, please let us know!

Best regards,
Matthias
Re: How to work with PostgreSQL? [message #1385840 is a reply to message #1385823] Wed, 11 June 2014 14:51 Go to previous messageGo to next message
Barust R. is currently offline Barust R.Friend
Messages: 43
Registered: February 2014
Member
Thank you for my assessment. In the future I will try to ask questions in hopes that my questions will help other Scout users in developing programs.
Re: How to work with PostgreSQL? [message #1403969 is a reply to message #1385840] Mon, 28 July 2014 19:32 Go to previous messageGo to next message
G Bits is currently offline G BitsFriend
Messages: 1
Registered: July 2014
Junior Member
Dear Bahtiyor,

You have described the JDBC mapping name, user name, and password. What is the "JDBC Driver Name" that you use?

Re: How to work with PostgreSQL? [message #1403994 is a reply to message #1403969] Tue, 29 July 2014 03:20 Go to previous message
Barust R. is currently offline Barust R.Friend
Messages: 43
Registered: February 2014
Member
Hi, G Bits

As you understand, we are talking about PostgreSQL.

To be laconic answer: org.postgresql.Driver

Please, again look at it above :
3) Add JDBC Drivers for Eclipse Scout:
-uncheck the box named 'Derby JDBC Driver for Eclipse Scout'.
-check the box named 'PostgreSQL 9 JDBC Driver for Eclipse Scout'.
(for details, see here:http://wiki.eclipse.org/Scout/Tutorial/3.9/Add_JDBC_Drivers_for_Eclipse_Scout)

in addition:
http://i62.tinypic.com/qoyc7l.png

http://i58.tinypic.com/otqcrn.png

[Updated on: Tue, 29 July 2014 03:25]

Report message to a moderator

Previous Topic:Wrong bundle is used as server bundle
Next Topic:Upgrading 3.9 to 3.10 almost ok
Goto Forum:
  


Current Time: Tue Apr 21 23:25:19 GMT 2015

Powered by FUDForum. Page generated in 0.02945 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software