error connecting to database — oracle-tech

    Forum Stats

  • 3,707,910 Users
  • 2,240,909 Discussions
  • 7,839,920 Comments

Discussions

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

error connecting to database

Tony007Tony007 Posts: 3,916 Gold Badge
edited January 9 in New To Java

hi am geting this error when connecting

Jan 09, 2021 5:13:06 AM org.hibernate.Version logVersion

INFO: HHH000412: Hibernate ORM core version 5.4.25.Final

Jan 09, 2021 5:13:07 AM org.hibernate.spatial.integration.SpatialService <init>

INFO: HHH80000001: hibernate-spatial integration enabled : true

Jan 09, 2021 5:13:07 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>

INFO: HCANN000001: Hibernate Commons Annotations {5.1.2.Final}

Jan 09, 2021 5:13:08 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)

Jan 09, 2021 5:13:08 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001005: using driver [oracle.jdbc.OracleDriver] at URL [jdbc:oracle:thin:@//92.168.8.189:1539/sid]

Jan 09, 2021 5:13:08 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001001: Connection properties: {user=fullStackEcommerce, password=****}

Jan 09, 2021 5:13:08 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator

INFO: HHH10001003: Autocommit mode: false

Jan 09, 2021 5:13:08 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections <init>

INFO: HHH000115: Hibernate connection pool size: 1 (min=1)

Jan 09, 2021 5:13:29 AM org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator initiateService

WARN: HHH000342: Could not obtain connection to query metadata

java.lang.IllegalStateException: Cannot get a connection as the driver manager is not properly initialized

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:172)

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180)

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68)

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)

at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)

at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)

at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)

at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:116)

at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)

at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:341)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:260)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:238)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:379)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:98)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:73)

at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)

at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)

at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)

at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:176)

at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)

at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:86)

at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:473)

at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:84)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:689)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)

at com.mzansi.hibernate.demo.CreateStudentDemo.main(CreateStudentDemo.java:17)


Jan 09, 2021 5:13:29 AM org.hibernate.dialect.Dialect <init>

INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect

Jan 09, 2021 5:13:29 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions

WARN: SQL Error: 17002, SQLState: 08006

Jan 09, 2021 5:13:29 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions

ERROR: IO Error: The Network Adapter could not establish the connection

Exception in thread "main" org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)

at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)

at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:176)

at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)

at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:86)

at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:473)

at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:84)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:689)

at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)

at com.mzansi.hibernate.demo.CreateStudentDemo.main(CreateStudentDemo.java:17)

Caused by: org.hibernate.exception.JDBCConnectionException: Error calling Driver#connect

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)

at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.convertSqlException(BasicConnectionCreator.java:118)

at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:41)

at org.hibernate.engine.jdbc.connections.internal.BasicConnectionCreator.createConnection(BasicConnectionCreator.java:58)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.addConnections(DriverManagerConnectionProviderImpl.java:341)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:260)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections.<init>(DriverManagerConnectionProviderImpl.java:238)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl$PooledConnections$Builder.build(DriverManagerConnectionProviderImpl.java:379)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:98)

at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:73)

at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)

at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)

at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)

at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)

... 14 more

Caused by: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:801)

at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:782)

at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:39)

at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:704)

at org.hibernate.engine.jdbc.connections.internal.DriverConnectionCreator.makeConnection(DriverConnectionCreator.java:38)

... 29 more

Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection

at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:569)

at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:521)

at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:660)

at oracle.net.ns.NSProtocol.connect(NSProtocol.java:287)

at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1481)

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:540)

... 33 more

Caused by: java.io.IOException: Connection timed out: connect, socket connect lapse 21006 ms. /92.168.8.189 1539 0 1 true

at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:229)

at oracle.net.nt.ConnOption.connect(ConnOption.java:172)

at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:508)

... 38 more

Caused by: java.net.ConnectException: Connection timed out: connect

at sun.nio.ch.Net.connect0(Native Method)

at sun.nio.ch.Net.connect(Net.java:454)

at sun.nio.ch.Net.connect(Net.java:446)

at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)

at java.nio.channels.SocketChannel.open(SocketChannel.java:189)

at oracle.net.nt.TimeoutSocketChannel.connect(TimeoutSocketChannel.java:108)

at oracle.net.nt.TimeoutSocketChannel.<init>(TimeoutSocketChannel.java:86)

at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:188)

... 40 more


this my class

package com.mzansi.hibernate.demo;


import org.hibernate.Session;

import org.hibernate.SessionFactory;

import org.hibernate.cfg.Configuration;


import com.mzansi.entity.co.za.Student;


public class CreateStudentDemo {


public static void main(String[] args) {

// TODO Auto-generated method stub

SessionFactory factory = new Configuration()

        .configure("hibernate.cfg.xml")

        .addAnnotatedClass(Student.class)

        .buildSessionFactory();

Session session = factory.getCurrentSession();

try {

System.out.println("Creating new student object..");

Student tempStudent = new Student("Test","test01","[email protected]");



session.beginTransaction();



System.out.println("Saving the student..");

session.save(tempStudent );


session.getTransaction().commit();


System.out.println("Done!");

}

finally {

factory.close();

}


}


}

my xml

<!DOCTYPE hibernate-configuration PUBLIC

    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">


<hibernate-configuration>


  <session-factory>


    <!-- JDBC Database connection settings -->

    <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>

    <property name="connection.url">jdbc:oracle:thin:@//92.168.8.189:1539/ncs_maint</property>

    <property name="connection.username">fullStackEcommerce</property>

    <property name="connection.password">fullStackEcommerce</property>


    <!-- JDBC connection pool settings ... using built-in test pool -->

    <property name="connection.pool_size">1</property>


    <!-- Select our SQL dialect -->

    <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>


    <!-- Echo the SQL to stdout -->

    <property name="show_sql">true</property>


<!-- Set the current session context -->

<property name="current_session_context_class">thread</property>

 

  </session-factory>


</hibernate-configuration>i do have jdbc


Sign In or Register to comment.