I'm struggling for two hours to deploy an application on Jboss server which connects to my Oracle DB.
The dbname-ds.xml has:
<datasources>
<local-tx-datasource>
<jndi-name>dbnameDatasource</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:oracle:thin:#192.168.168.105:1521:XE</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<user-name>system</user-name>
<password>password</password>
</local-tx-datasource>
</datasources>
The credentials are ok because I've tested them using DataBase home page tool from Oracle.
The error I receive in jboss is:
00:14:28,383 INFO [ConnectionProviderFactory] Initializing connection provider:
org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
00:14:28,389 INFO [InjectedDataSourceConnectionProvider] Using provided datasou
rce
00:14:49,476 WARN [JBossManagedConnectionPool] Throwable while attempting to ge
t a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested
throwable: (java.sql.SQLException: Io exception: The Network Adapter could not
establish the connection)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.g
etLocalManagedConnection(LocalManagedConnectionFactory.java:225)
//etc
and caused by:
Caused by: java.sql.SQLException: Io exception: The Network Adapter could not es
tablish the connection
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
Do you have any idea where to look?
I've also modified the default localhost to be my ip from ds file:
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.168.105)(PORT = 1521))
so the host and port is correct.
What else can be the cause...?
Thanks a lot...
Related
I am trying to connect to Teradata from my spring boot project. But I am constantly getting unknown host exception. When I do Test Net Connection from Power shell, TCP Test Succeeded comes as true. Also I am able to connect to the Teradata from Teradata SQL assistant. Below is config from application config file. Properties in <> removed for security reason. the Teradata we have is via LDAP authentication
spring:
jpa:
show-sql: true
database-platform: org.hibernate.dialect.TeradataDialect
datasource:
driverClassName: com.teradata.jdbc.TeraDriver
url: jdbc:teradata://:/LOGMECH=LDAP,database=,charset=ASCII,tmode=ANSI
username:
password:
Exception is below: ( values in <> removed for security reason)
java.sql.SQLException: [Teradata JDBC Driver] [TeraJDBC 16.20.00.13] [Error 1000] [SQLState 08S01] Login failure for Connection to :1025 Tue Jul 05 23:12:11 CEST 2022 socket orig=:1025 cid=6007091b sess=0 java.net.UnknownHostException: HOSTNAME :1025
I am trying to create new datasource in the Weblogic 12c (version: 12.2.1.3.0).
Below are the details of the databasource:
Name: TestDataSource
JNDI Name: jdbc/test.data
DatabaseType: Oracle
Database Driver: Oracle's Driver (Thin XA) for Instance
connections; Verions: Any
Database Name: XXXX
Host Name: xxxxxx
Port: 1521
Database User Name: XXXX
Password: XXXX
Driver Class Name: oracle.jdbc.OracleDriver
Select Targets: serverName
After saving I am getting below exception:
oracle.net.ns.NetException: Listener refused the connection with the following error: ORA-12519, TNS:no appropriate service handler found
Substituted for the exception oracle.net.ns.NetException which lacks a String contructor, original message - Listener refused the connection with the following error: ORA-12519, TNS:no appropriate service handler found
I am able to connect to the same database via SQLDeveloper without any error.
Please let me know if I am missing any property or step while setup.
I deploy an app with Spring Boot + JPA and use Oracle DB for store data.
Sometimes I got this error in log after using the app for a while.
SQL Error: 17002, SQLState: 08006 - IO Error: Connection timed out
Config properties
server.port = 8095
# ===============================
# = DATA SOURCE
# ===============================
# Set here configurations for the database connection
spring.datasource.url=jdbc:oracle:thin:#//localhost:1521/xe
spring.datasource.username=root
spring.datasource.password=root
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
If I add autoReconnect=true to datasource url I got error when start app.
SQL Error: 12514, SQLState: 08006
oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
at oracle.net.ns.NSProtocolStream.negotiateConnection(NSProtocolStream.java:272)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:263)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1360)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:486)
... 46 common frames omitted
Does anyone know the issue root cause and how to fix it? Thanks.
Test the Oracle DB connection from SQLPlus.
Also, check if your Oracle service_name is valid in tnsnames.ora file.
For example, if you have a user entry in tnsnames.ora is as follows:
SAMPLEUSER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = <fqdnHostNameOrAddress>)(PORT = <validPORT>))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = <OracleDBServiceName>)
)
)
Then test with SQLPlus as below:
sqlplus user#SAMPLEUSER
I'm trying to open a read-only Derby database over a network client connection (using ij / derbyclient.jar).
I have created a read-only database:
jar cMf sample.jar sample
The Derby Network Server is started.
I have tried the following connection URLs:
connect 'jdbc:derby:jar://localhost:1527/sample.jar';
connect 'jdbc:derby:jar://localhost:1527/(sample.jar)sample';
connect 'jdbc:derby://localhost:1527/jar:(sample.jar)sample';
But none of the above URLs work.
The only URL that works is:
connect 'jdbc:derby:jar:(sample.jar)sample';
It appears that read-only Derby databases can only be opened in embedded mode. Is this true ?
Solved:
After checking the "derby.log", the problem was that the read-only database needs to be able to create a temporary file.
derby.log:
java.sql.SQLException: Failed to start database 'jar:(sample.jar)sample' with class loader sun.misc.Launcher$AppClassLoader#1d450337, see the next exception for details.
...
Caused by: java.sql.SQLException: Failed to start database 'jar:(sample.jar)sample' with class loader sun.misc.Launcher$AppClassLoader#1d450337, see the next exception for details.
...
Caused by: java.sql.SQLException: Java exception: 'Unable to create temporary file: java.lang.SecurityException'.
...
Caused by: java.lang.SecurityException: Unable to create temporary file
The solution is to define a temporary directory for the database. This can be done with the "derby.storage.tempDirectory" property:
System-wide in "derby.properties":
derby.storage.tempDirectory=c:/temp
Database-wide
CallableStatement cs =
conn.prepareCall("CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(?, ?)");
cs.setString(1, "derby.storage.tempDirectory");
cs.setString(2, "c:/temp");
cs.execute();
cs.close();
The network URL is:
connect 'jdbc:derby://localhost:1527/jar:(sample.jar)sample';
After one week that jboss is working, its crash down, sending the next exception:
Software jboss5.0 jdk1.6 ojdbc14.jar
WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Io exception: Connection reset)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:225)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:195)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:633)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:267)
at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:622)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:381)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
at org.jboss.resource.adapter.jdbc
.WrapperDataSource.getConnection(WrapperDataSource.java:89)
at com.genexus.db.driver.GXConnection.connectJDBCDataSource(Unknown Source)
........
Caused by: java.sql.SQLException: Io exception: Connection reset
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:420)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:207)
... 58 more
Currently running SAS 9.3 and Oracle 11.2.0.2, getting the same error as NEFTALY. Prior to this, getting an error due to limit for number of processes/threads in Red Hat Linux 6.3 - out of memory. This was solved by increasing the limit from 40000 to 90000(!)
This exception can be occur by wrong IP-address.
So check the binding IP address and connection properties of DATABASE.
<local-tx-datasource>
<jndi-name>JNDI_NAME</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/DATABASE_NAME</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>root</password>
<min-pool-size>1</min-pool-size>
<max-pool-size>10</max-pool-size>
<idle-timeout-minutes>1</idle-timeout-minutes>
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>