The situation is as follows. There is a java-project assembled in Gradle with a Rabbitmq connection. As a working IDE I use Idea, I work in Ubuntu. In pgAdmin created a simple database with 2 tables. I want to add it to the project. I looked through the tutorials, but they only confused me ...
1 answer
You will need a database connection library (for example, postgresql-9.4-1204.jdbc4.jar) Well, here is an example of a bean that will actually return a DataSource to you
<bean id="postgres-ds" class="org.postgresql.ds.PGPoolingDataSource"> <property name="serverName" value="localhost"/> <property name="databaseName" value="mydb"/> <property name="portNumber" value="5432"/> <property name="user" value="admin"/> <property name="password" value="admin"/> <property name="dataSourceName" value="postgres"/> <property name="initialConnections" value="1"/> <property name="maxConnections" value="10"/> </bean>
This is in case I understand you correctly, and it is not possible to connect to the database from the project.
- I postgre jar-file I kind of added. I have it in the idea / libraries / postgresql_9_4_1208.xml directory. Then I followed this example. I created a class in which I entered the code from here j4web.ru/postgresql / ... PostgreSQLConnect class. Commands Logger, Level, PostgreSQLConnect highlights in red and writes "Cannot resolve symbol". Maybe in gradle.build still need to register some dependencies? - Iga
- Show the entire listing of the class with the connection. Maybe you accidentally copied the package name (package ru.j4web.examples.java.jdbc.jdbcpostgresqlconnect;) and you have a package with a different class? - Chubatiy
- here listing does not fit. on this link you can see it j4web.ru/postgresql/... solved the problem with the Logger and Level commands. he just doesn't like PostgreSQLConnect - Iga
- Maybe you have a class file name and the description itself is different? For example, the name of the class file is called Test, and inside it is written public class PostgreSQLConnect ...... - Chubatiy
- oneYou're welcome) Always happy to help - Chubatiy
|
database
tab you can view the contents of the database, or in the sense of how to connect to the database from the program code? - iksuy