JDBC :: Pooling Oracle Driver Socket Read Timed Out

Dec 18, 2014

I run Java EE application on Glassfish server v3 together with Oracle 12 DB on the same machine under Windows Server 2012 64bit. I use latest ojdbc7 driver.
 
Connection pool config:
 
<jdbc-connection-pool validation-table-name="DUAL" steady-pool-size="20" statement-cache-size="100" associate-with-thread="true" statement-timeout-in-seconds="30" idle-timeout-in-seconds="60" max-wait-time-in-millis="2000" validate-atmost-once-period-in-seconds="20" datasource-classname="oracle.jdbc.pool.OracleDataSource" pool-resize-quantity="5" max-pool-size="60" res-type="javax.sql.DataSource" name="dbPool" is-connection-validation-required="true">
  <property name="driverClass" value="oracle.jdbc.OracleDriver"></property>
  <property name="user" value="xxx"></property>

[Code] ....

After 2 or 3 hours, when there is more than 1 user (3-5) using my application, it stops responding and I get this in glassfish logs
 
javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.allocator|_ThreadID=152;_ThreadName=Thread-2;|RAR5038:Unexpected exception while creating resource for pool dbPool. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: IO Error: Socket read timed out

[Code] ....

From the database side it looks like this
 
Fatal NI connect error 12560, connecting to:
  (LOCAL=NO) 
  VERSION INFORMATION:
  TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
  Oracle Bequeath NT Protocol Adapter for 64-bit Windows: Version 12.1.0.1.0 - Production

[Code] ....

When I just reset db listener everything works ok for next 1-2 hours (depends on application load). So temporary solution is to run bat script from windows scheduler to reset the listener every 1h. I tried everything I could find - applied these parameters:
 
  - Sqlnet.ora:
  SQLNET.INBOUND_CONNECT_TIMEOUT=180
  SQLNET.EXPIRE_TIME=5
  - Listener.ora:
  INBOUND_CONNECT_TIMEOUT_LISTENER_IPC=120
 
But still without success

View Replies


ADVERTISEMENT

JDBC :: Oracle Driver Hangs When Fetching Row

Nov 7, 2014

We have a java application in our production enviroment using Spring framework which is configured with DBCP connection pool and the backend is Oracle database( version 11.2.0.3). Recently we encountered an occasionally happened situation(about once every week) and can be described as below:
 
The application schedules a task that runs every 10 minutes. And during task execution, the application would issue a SQL query of which the result is expected to be got within 10 seconds. At 11:51 a.m Oct 13th, however, the application failed to get the result within expected time, and 2 hours later, at 13:51, the result was finally returned to application.  Due to lack of information at that time, we were not able to reproduce the same problem in test environment. At 15:31 p.m, Oct 29th, it happend again and this time we grasped all the information including thread dump and Oracle diagnostic information. We could found that:

1. Through oracle v$sql view, we could find that the SQL query is executed twice, at 15:31 and 17:31 respectively.

2. By analyzing TCP packets provided by network monitoring tools, it can be concluded that the request TCP packet containing SQL statement had been sent to Oracle and get executed, but after that JDBC only fetched first 80000 records  out of 90000 records in total and then it stopped, didn't send any more request to Oracle to fetch rows. 2 hours later, Oracle sent a TCP keep alive packet and JDBC driver resume fetching remaining rows using the same connection(which can be confirmed by comparing source port of packets).

3. We dumped the thread at which JDBC hangs at socket read of JDBC driver
 
By the way, the version of JDBC we use is 11.2.0.1 and JDK version is 1.5.0_22.

The SQL statement is very simple:

select sum(n.netvalue) npvi,
       n.HISCENEID hsid,
       n.counterpartyid cid,
       n.productid pid,
       n.opendays

[Code] .....

View Replies View Related

JDBC :: No Suitable Driver Found For Oracle Database Connection

Jul 10, 2015

I have small Java code, which execute every day and checks for data in database using Cronj Schedular and everything works fine, but recently I have observed that, it is failing due to
  
    java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@160.110.xx.xxx:1521/test
 
At the same time, when I run my test code to check Database connectivity that works fine without above exception. I'm unable to figure it out. Although, there was just slight code change, but that was nowhere related to Database or Database connection.  
 
dbconf.java
    public class dbconf {
    private Connection connect;
    private String connstr;
    public Connection getConnection() throws SQLException {
    connstr = "jdbc:oracle:thin:@160.110.xx.xxx:1521/test";

[Code] .... 
 
Application Log file
 
    Wed Jul 01 09:25:17 IST 2015:------- Initializing -------------------
    Wed Jul 01 09:25:17 IST 2015:------- Scheduling Jobs ----------------
    Wed Jul 01 09:25:17 IST 2015:------- Job Started Running ----------------
    Thu Jul 02 06:00:00 IST 2015 : Job Executed..!! Bschedularv2.2
    java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@160.xxx.67.xxx:1521/test
    Sat Jul 04 06:00:00 IST 2015 : Job Executed..!! Bschedularv2.2
    Sun Jul 05 06:00:00 IST 2015 : Job Executed..!! Bschedularv2.2
    java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@160.xxx.67.xxx:1521/test
 
So, you can see, It failed on 3rd of July and 5th July as well. But, in between it ran fine.

View Replies View Related

Oracle Driver In Java App?

Jul 26, 2014

Where do I have to put the ojdbc6.jar file so that Java finally recognizes it?I'm trying to connect to a Oracle XE databse from a Java application, but

Class.forName("oracle.jdbc.OracleDriver");

Will throw a ClassNotFoundException no matter where I put the driver. Stuff like this should be extremely simple but I am about to give up for good now.

View Replies View Related

How To Access Oracle DB Without Using ODBC Driver Jar File

Oct 15, 2014

I need to access Oracle database without using ODBC driver using DAO only, how to do that...

View Replies View Related

How To Connect To A Remote SQL Server Using JDBC Driver

Jan 15, 2015

I'm working on an application I made a few years ago. At that time I connected to a local database so my address was 'jdbc:mysql://localhost:3306/'. That database is long gone so I recreated it on one of my hosted servers but I'm a little unsure of how to connect to it. At the moment I'm trying "jdbc:mysql://www.mydomain.com:3306/" but it is giving me an access denied error.

java.sql.SQLException: Access denied for user 'myusername'@'c-[my-ip].hsd1.pa.comcast.net' (using password: YES)Every result on Google seems to use localhost so I'm having a little difficulty figuring out the correct format.

View Replies View Related

Trying To Add Database Driver (JDBC) - Not In CLASSPATH Warning?

Jun 23, 2015

This the output of java from my PC under linux platform (rhel 6.5).
 
[pentaho@vertica-srv1 Downloads]$ java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
 
[Code] ....
 
But the problem is while trying to open ETL program under linux platform [pentaho@vertica-srv1 data-integration]$ ./spoon.sh .... I received the following error messages.
 
[pentaho@vertica-srv1 data-integration]$ ./spoon.sh
 
Trying to add database driver (JDBC): RmiJdbc.RJDriver - Warning, not in CLASSPATH?
Trying to add database driver (JDBC): jdbc.idbDriver - Warning, not in CLASSPATH?
Trying to add database driver (JDBC): org.gjt.mm.mysql.Driver - Warning, not in CLASSPATH?
Trying to add database driver (JDBC): com.mckoi.JDBCDriver - Warning, not in CLASSPATH?
[KnowledgeFlow] Loading properties and plugins...

View Replies View Related

JDBC :: Java Oracle Rac Connection URL Using Scan

Dec 30, 2014

I am trying to connect to an oracle rac using jdbc thin . when i use the scan as the host, like this

String url = "jdbc:oracle:thin:@//<scan>:port/servicename;

I get error 1153, connection refused

but when i use the ip of the rac instead of the scan

String url = "jdbc:oracle:thin:@//<ip>:port/servicename;

The connection is successful
 
Is the issue at the application level? or is the problem with the server ....

View Replies View Related

JDBC :: Change Oracle EBS Connection Pool

May 24, 2010

I have installed and configured Oracle Business Intelligence Applications on top of one demo eBS instance as a source. Now I would like to change the OLTP to a different eBS instance but am not sure which steps to take. I don't know if I can add new EBS connection pool and a new DataWarehouse Connection Pool in the administration and have old ones preserved or I need to overwrite the old ones? Or (ideally) can I just change the OLTP and overwrite the old DWH? 

Any document supporting the process of changing the eBS OLTP database without new installation of the OBIAPPS?

View Replies View Related

JDBC :: Oracle IN Clause With Collection Of Elements

Jan 26, 2012

I am using a IN clause in Oracle DB to pass a collection of custId to retrieve the customer details. If it was 10 or 50 custId's as a collection in IN clause it works fine. But if the collection grows bigger to 500 or 1000 then it is pretty slow to load the JSP page with the customer details.

Here is the query:-

select CustName, CustAge, CustCity, CustPin from CUSTOMER where custId IN (....)

The list of custId that is passed through Hibernate query.setParameterList()

How to optimize this query to make sure it displays the customer details faster even if the collection of elements which we pass is huge?

View Replies View Related

JDBC :: Oracle UCP Connecting To Wrong Port

Apr 10, 2015

I am trying to connect to Sql Server database using Oracle UCP with sqljdbc4-3.0 JDBC driver for Sql Server,with different ports and instances.

– the issue is with the port being ignored in the server string.

For example, using port 1440 connects to the default instance (which is on port 1433) rather than MSSQLINSTANCE1 which is on 1440.

Below are Server hosts used.

sql005.sqlasoftware.com (connects correctly to the default instance)
sql005.sqlasoftware.com:1440 (connects incorrectly to the default instance on port 1433)
sql005.sqlasoftware.comMSSQLINSTANCE1 (connects correctly to the named instance)

View Replies View Related

Connect To MySQL Database And Print Out Some Fields - Cannot Find JDBC Driver

Aug 17, 2014

I am trying to run a simple program that connects to a mysql database and prints out some fields. I am using Eclipse.

THe problem I am having is on the following line of code.

Class.forName("com.mysql.jdbc.Driver");

I get an error:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)

[Code] ....

I have done some research and from what I have found is that I need to alter the class path to pick up the driver. When I downloaded the .msi I ran it and then the program closed. Where the files are ??? How to locate and import the file so I need to get my program to run?

I have included all the of the source code below.

package mySQLConnect;
import java.sql.*;
public class Connect {
// JDBC Driver name and database URL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String BD_URL = "jdbc:mysql://localhost/sstbde";

[Code] .....

View Replies View Related

Socket Should Only Read One Message

Apr 4, 2015

if i send messages as in the code below, is there a way to read only one message, if the client doesn't know how long it is (or if he only knows the maximum length)?in the documentation it says, that the method read(byte[]) reads until no data ist available or end of file is decteted. What does the latter mean? Can i extend the array that i sent by a byte that signals the end? Here is my Code:

Server

public class Server implements Runnable{
 ServerSocket server;
HashMap<Short,Socket> clients;
 public Server(){
clients = new HashMap<>();

[code]....

Both are startet in seperate threads. At the moment the first output of the client is "12 bytes read", and then continously "-1 bytes read"(because the server closes).

View Replies View Related

Timed Object Generation For Guitar Hero Game

May 22, 2014

I want to generate a new tile every 1,5,10,15 (please check the code to gain an understanding of where I'm going) the session last for 4m :20 sec, I need using the date package, I tried using the sleep method however I don't want to pause the whole thread, so I need setting up the time aspect of the key generation (assume all other code works).

Java Code:

import info.gridworld.actor.*;
import info.gridworld.grid.*;
import java.awt.*;
import java.util.*;
//importations, just in case you were wondering
//locations and actor world are set up
//assume all other code works

[Code] ....

I'm using grid world to set up the locations, the tiles are actors that move south every turn

View Replies View Related

JDBC :: How To Call Parameterized Stored Procedure In Jdbc

May 17, 2014

calling a parameterized stored procedure in java jdbc from sql server.The stored procedure goes like this in sql

create proc patientreg
@id int
as
begin
select [patient_id],[Psurname], [pFirstname], [pMiddlename], [reg_date], [DOB], [Sex], [Phone_num], [Addr],[Email],[dbo].[fncomputeage](DOB) from [dbo].[Patient_registration] where [patient_id] = @id
end
please note dbo.fncompute(DOB) is a function

To call it in jdbc it goes like this

try{
String str = "{call patientreg(?)}";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbcdbc:GeneralHospit al");
cstmt = con.prepareCall(str);
cstmt.setInt(1, Integer.parseInt(t.getText()));

[code]....

after doing it this way it throwing an exception: Error:java.sql.SQLException: Parameter 1 is not an OUTPUT parameter.

View Replies View Related

Create A Driver Class

May 2, 2014

Why we create a driver class?Instead of creating a driver class, if we want to compile our code so will it show output? Let say, we've created a class GradeBook of the institution for students.So they can easily view their profile information and scores in different semesters.so when we have created a class for this purpose, should we create a driver class or not?What is the big advantage of creating a driver class?

View Replies View Related

Errors Trying To Get Random Number To Driver?

Sep 25, 2014

I'm trying to use a setter method to pick a random integer to be the MPG for a car. However, I'm having major issues in my driver when trying to use that random number in an instance. I'm not finished with the driver yet because I keep getting "cannot find symbol errors"

import java.util.Random;
public class Car {
private String make;
private String model;
private int year;
private int mpg;
private int odometer;
Random generator = new Random();

[code]...

View Replies View Related

Driver For Lockable Coin Class?

Feb 20, 2014

I am having trouble creating a driver for the following program. im new to creating interfaces and i need to make this work.

Lockable interface:

Java Code:

public interface Lockable {
boolean locked();
public void setKey(int key);
public void lock(int key);
public void unlock(int key);
} mh_sh_highlight_all('java');

[code]....

View Replies View Related

Unbuffered I / O Requests Send To CD Driver

Feb 25, 2014

I want to write java code which can block unbuffered I/O requests send to CD driver ...

View Replies View Related

No Suitable Driver Found For Dbms

Mar 22, 2015

I started learning mysql to connect my program to a database but every time i try to connect I get this error.

java.sql.SQLException: No suitable driver found for dbms:mysql://localhost:3306/apexdemo
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at JDBCdemo2.main(JDBCdemo2.java:7)

I did the following:

- added the mysql-connector-java-5.1.34 jar to my classpath
- added mysql jdbc driver to the project library
- double checked the url syntax and spelling errors
- checked that the server is running

import java.sql.*;
public class JDBCdemo2 {
public static void main(String[] args) {
Connection conn = null;

[Code] ....

View Replies View Related

Accessing Private From Driver Class

May 14, 2015

I came across the below

1) When a variables are declared "Private" How should it be accessed from the driver class ? Sometimes i get an error in driver class saying "your variable is declared Private" why am I getting this error ...

The document says "Private" declared variables should be accessed only through methods. What does that mean.

View Replies View Related

Test Driver Does Not Accept String Parameter

Jan 6, 2015

I wrote a couple classes and am trying a test driver but it is having an error I do not know how to solve.

Student Class:

public class Student{
private Course[] courseList;
private static int numCourses;
private final int maxCourses;
public Student(int max){
maxCourses = max;

[Code] .....

Error:
javac tester.java
tester.java:6: error: cannot find symbol
one = new Course(name);
^
symbol: variable name
location: class tester
1 error

Same issue, just only one error as there is only one line. It seems like it does not accept my parameters as it cannot find symbol.

I forgot to put the "" in the brackets, it's been a month since I have looked at any java and made this simple mistake.

View Replies View Related

Driver Program That Creates 2 Instances Of A Class?

May 10, 2014

public class Car
{
//instance variables ----------------------
private String make;
private String model;
private int year;
private double vehiclePrice;
private double downPayment;
private double milesPerGallon;

[code]....

I created this class "Car" (also not sure if it's correct) and need to write a driver program that creates two instances of the class Car. One must use the default constructor, and the other must use the non-default constructor. It must demonstrate the methods used in the Car class using those instances.

public class DriverCar
{
public static void main(String[] args) {
Car car1 = new Car("Toyota", "Corolla", 2013, 20000, 3000, 35);
Car car2 = new Car("Ford", "Taurus", 2005, 14000, 1500, 25);
System.out.println(car1);

[Code] ....

View Replies View Related

How To Create A Driver Program That Invokes A Class

May 13, 2014

Assignment:

Create a class; call it Lab4a that will have one method called pull. This method does not return anything and requires no parameters.

-In the method, create three random integers in the range 1 to 7. The method will then display the three numbers to the terminal window.

-Now create a driver program, called SlotMachine, to invoke the pull method of the Lab4a class.

-As a refresher, you will have a main method in the driver class that will create an object of Lab4a and then use the only method of this object.

-In your driver program, invoke the roll method 10 times.

-See the back of this lab for an example of the output.

This is what I have so far.

Slot machine

import java.util.Random;
public class Lab4a {
public static void main (String[]args) {
Random pull=new Random();

[code]....

View Replies View Related

Creating Instance Methods And Driver Class

May 5, 2014

Okay, so I have to create a class with instance data and instance methods.

First, BankAccount class. It should contain the following information, stored in instance variables:

First name: The customer's first name.
Last name: The customer's last name
Balance: The amount of money the customer has in the account.

It should have the following methods:

BankAccount(String firstName, String lastName,
double openingBalance)

This constructor creates a new BankAccount

public String firstName()
Returns the customer's first name
public String lastName()
Returns the customer's last name
public double balance()
Returns the customer's account balance

Finally I need to create a driver to test my class. And create several accounts and verify that the first name, last name, and balance methods work properly. This is my code below.. I don't know if I did it right.

public class BankAccount {
String firstName, lastName;
double balance;
public BankAccount(String firstName, String lastName, double balance) {

[Code] .....

View Replies View Related

How To Write Driver Class To Test Methods

Apr 13, 2015

I am to create a Array class then create a Driver class (TestArray) to test all the methods in the Array Class. Here's the code i've written for the Array Class. I just nee developing the TestArray class.

import java.util.Scanner;
public class Array
{
Scanner sc = new Scanner(System.in);
private double[] array = new double[];
public void setArray(double[] arr) {

[Code] ...

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved