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
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 upload a large CSV file (500MB) file in tomcat server . But everytime I am getting "504 Gateway Time-out" error.
I am not getting any issue in catalina.out file
**Part of my application.properties file**
async-timeout-ms: 1800000 #AsyncTimeout on the connector.
keepAliveTimeout: 1800000 # KeepAliveTimeout on the nioHandler.
connection-timeout-ms: 1800000 # Connection Timeout on the nioHandler
innodb_strict_mode = 0
GLOBAL max_connections = 1500;
# ==============================================================
spring.servlet.multipart.maxFileSize=800MB
spring.servlet.multipart.maxRequestSize=800MB
spring.http.multipart.max-file-size=800MB
spring.http.multipart.max-request-size=800MB
The following error occurs in the stacktrace:
...
java.lang.OutOfMemoryError: Java heap space
...
Caused by: org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [HikariDataSource (HikariPool-4)] with key 'dataSource'; nested exception is javax.management.InstanceAlreadyExistsException: dataSource_flashsale:name=dataSource,type=HikariDataSource
I have configured Oracle VirtualBox with DB, user and populated a small DB.
In the same machine I've installed Pentaho Data-Integration(Spoon), the JDBC driver and I'm trying to create a connection to Oracle DB but without success.
This is where I'm typing the credentials/data:
Host Name: localhost
Database Name: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCL)))
Port Number: 1521
User Name: SYSTEM
Password: oracle
This is the error message:
Error connecting to database [oraConn12c] : org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database
Error connecting to database: (using class oracle.jdbc.driver.OracleDriver)
IO Error: NL Exception was generated TNS-04605: Invalid syntax error: Unexpected char or LITERAL "(" before or at ( DESCRIPTION =
org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database
Error connecting to database: (using class oracle.jdbc.driver.OracleDriver)
IO Error: NL Exception was generated TNS-04605: Invalid syntax error: Unexpected char or LITERAL "(" before or at ( DESCRIPTION =
at org.pentaho.di.core.database.Database.normalConnect(Database.java:459)
at org.pentaho.di.core.database.Database.connect(Database.java:357)
at org.pentaho.di.core.database.Database.connect(Database.java:328)
at org.pentaho.di.core.database.Database.connect(Database.java:318)
at org.pentaho.di.core.database.DatabaseFactory.getConnectionTestReport(DatabaseFactory.java:80)
at
.......
... more .....
Caused by: java.sql.SQLRecoverableException: IO Error: NL Exception was generated TNS-04605: Invalid syntax error: Unexpected char or LITERAL "(" before or at ( DESCRIPTION =
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:743)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at org.pentaho.di.core.database.Database.connectUsingClass(Database.java:569)
... 52 more
Caused by: oracle.net.ns.NetException: NL Exception was generated TNS-04605: Invalid syntax error: Unexpected char or LITERAL "(" before or at ( DESCRIPTION =
at oracle.net.resolver.AddrResolution.resolveAddrTree(AddrResolution.java:733)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:493)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:595)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:230)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1452)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496)
... 58 more
Hostname : localhost
Port : 1521
Database name : (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCL)))
How can I configure it in order to connect Pentaho/Spoon to the Oracle DB?
The oracle DB seems to be working fine, I've also tried with other users/databases that I created, but the result is the same.
I was able to resolve this same issue by removing 'Host Name' and 'Port Number' details from the connection window. Leaving only the 'DB Name' string.
I had a similar issue. Could solve it that way for the client tool, but not for the carte server.
I fixed it with an JNDI connection.
put this in your pdi\simple-jdni\jdbc.properties
mydb/type=javax.sql.DataSource
mydb/driver=oracle.jdbc.driver.OracleDriver
mydb/url=jdbc:oracle:thin:#(DESCRIPTION=(ADDRESS_LIST=(ADDRESS(PROTOCOL=TCP)(HOST=myhost)(PORT=myport)))(CONNECT_DATA=(SERVICE_NAME=myservicename)))
mydb/user=myuser
mydb/password=mypassword
and this connection in your repositories.xml:
<connection>
<name>JNDI</name>
<server>myserver</server>
<type>ORACLE</type>
<access>JNDI</access>
<database>mydb</database>
<port>myport</port>
<username>myuser</username>
<password>mypassword</password>
<servername/>
<data_tablespace/>
<index_tablespace/>
<attributes>
<attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
<attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
<attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
<attribute><code>PORT_NUMBER</code><attribute>myport</attribute></attribute>
<attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
<attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>N</attribute></attribute>
<attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
</attributes>
Adding
(FAILOVER_MODE=(type=select)(method=basic)(retries=20)(delay=3))))
to the end of the string solved it for us.
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';
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...