JDBC :: Open Connection String

Jun 25, 2015

What I have in my tnsnames.ora and verify it all works via sqlplus
 
CDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = cdb1)
 
[Code] ....
 
I am trying to get RJDBC to work so I can connect to Oracle from R doing some data analysis..
 
This connection string works for my local db which I have it running in my Virtual Box
 
con <- dbConnect(drv, "jdbc:oracle:thin:@//localhost:1521/orcl", "demo", "demo")
 
However, it does not work when I do it for the remote db that I really need to pull data from...
 
> con <- dbConnect(drv, "jdbc:oracle:thin:@//ymsdbppr-scan:1522/YMQCTPRD", "user_read", "user_read")

Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  :
  java.sql.SQLException: Listener refused the connection with the following error:
ORA-12514, TNS: listener does not currently know of service requested in connect descriptor

View Replies


ADVERTISEMENT

EJB / EE :: GenericJDBCException - Could Not Open Connection

Oct 3, 2014

I am new to EJB; I am writing EJB (3.1) program in JBoss 7.1 - I am using MySQL DB with JPA. While executing the program, I am facing the Generic JDBCException: Could not open connection. It is happening only for certain tables in the database; but NOT for all tables. My code is able to access few of the tables in the same database. Here is my full stack trace: -

Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

[code]....

View Replies View Related

JDBC :: Unable To Establish Connection To Excel

Aug 21, 2014

I have failed with all possibilities that I know to make this program success. Getting error as :

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Program goes like this.

import java.sql.*;
public class ExcelConnection {
public static void main (String[] args){
try {
Connection conn = getConnection("TEST.xls");
Statement stmt = conn.createStatement();

[Code] ....

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 :: Session Parameters And Connection Pools

May 1, 2015

Suppose I issue a command such as "ALTER SESSION SET WORKAREA_SIZE_POLICY=MANUAL" inside a stored procedure called via JDBC and then release the connection back to the pool.  When the connection is next reused by a completely independant Weblogic thread is there any chance that the non-default setting could be inherited by the new thread?
 
I realize that there is a conceptual difference between a process, a connection, and a session so theoretically the answer to my question should be "no."
 
But is that the case in real life?

View Replies View Related

Web Services :: Share JDBC Datasource Connection Among All Servlets

Apr 20, 2015

I am new to java. I have recently learned JDBC connection pool in tomcat. To make code reuse I want to share the connection among all servlets without any conflict.

Here My code snippet:

public class GetConnection{
private DataSource ds;
public Connection getConnection(){
try {
InitialContext initialContext = new InitialContext();
Context context = (Context) initialContext.lookup("java:comp/env");
ds = (DataSource) context.lookup("connpool");

[Code] .....

Is this right way to do. Or I will get any problem due to concurrent threads.

View Replies View Related

Enabling SSL In JDBC Connection To SYBASE For Thick Client App

Apr 19, 2015

Connection from Java app (installed on desktop) to sybase database (deployed on AIX machine) is going unencrypted.i.e Traffic can be read by some hacking tool and to fix I need to enable SSL/TLS.I am using JDBC to connect to sybase. I believe apart from setting the jconnect properties there are several other things which needs to be done.

View Replies View Related

JDBC :: IO Error - Network Adapter Could Not Establish Connection

Jan 24, 2015

Yesterday, I established a connection with oracle 12c, codes is here:
 
ods.setURL("jdbc:oracle:thin:c##mytest/myt@//myhost:1521/orcl");Connection conn=ods.getConnection(); 
where "c##mytest/myt" is username and password. It worked well.

But, today, "IO Error:The Network Adapter could not establish the connection" appeared when I tried to run my program again.

I changed //myhost into 127.0.0.1, it worked again.(Before I did this, I checked lsnrctl and regedit and firewall....., no difference)

Here is my question:

1) What happens between //myhost to 127.0.0.1, hostname cannot be use to JDBC? If yes, how?
 
Besides, I have some other questions:
 
2) How import a *.dmp file which exported from 10g into 12c?
 
3)If I need upgrade 10g to 12c, what shall I do?

View Replies View Related

JDBC :: Connection Pool Keeping More Than Necessary Inactive Connections

Jun 19, 2015

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production0PL/SQL Release 12.1.0.2.0 - Production0CORE12.1.0.2.0Production0TNS for Linux: Version 12.1.0.2.0 - Production0NLSRTL Version 12.1.0.2.0 - Production0 

Using JavaSE-1.7
Using ucp.jar,ons.jar and OJDBC7.jar

I set up the datasource as follows :
 
pds = PoolDataSourceFactory.getPoolDataSource();
  pds.setConnectionFactoryClassName(factoryClassName);
  pds.setMaxPoolSize(maxPoolSize);                                                       maxPoolSize  10
  pds.setMinPoolSize(minPoolLimit);                                                        minPoolLimit 1

[Code] ....
 
In the class that actually uses it I create a method variable for the connection object.

Closing the connection as well as pds.getConnection().close();e

I am thinking that at the most I should have only one inactive connection showing up when I monitor the session. How do I configure the pool as to only show on inactive connection? I am running the test queries once every five minutes. But I am opening three connections each time.

View Replies View Related

Open / Send Multiple Messages Over TCP And Close Connection On Events

Oct 7, 2014

I have a simple method in Java through which I send commands to a machine over TCP. The problem is:

Machine can't accept more than two connections in 20 seconds.

I need to send 15-20 commands to the machine in 3 minutes.

This is my current method which is not working as it should, 2 commands get transmited but third command hangs because of the machine.

void sendCommand(String command) throws IOException {
String ipaddress = "192.168.0.2";
Socket commandSocket = null;
BufferedWriter out = null;
BufferedReader in = null;
BufferedWriter outToDetailFile = null;

[Code] .....

Basically what i need is:

1st: I need to open the connection by calling method

public void openConnection(String ipaddress, String port){
//Code to start the connection
}

2nd: I need to be able to send commands to the connection I have already opened (i will send multiple messages in time period of 5-10 minutes):

public void sendCommand(String message){
}

3rd: Close that connection

public void closeConnection(){
}

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

Establish Connection Using Connection Pool And Retrieve Username

Sep 1, 2014

I have created a JSP page, on click of a particular button, the control moves to the servlet "TestServlet".

This is the code under TestServlet:

import java.io.IOException;
import java.io.PrintWriter;
import java.security.Principal;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

[Code]...

Now, I have got a comment saying I should get the database connection from connection pool. And one more issue is that I have used the function System.getProperty("user.name") to get the username which i have logged in. But this code will be run on Unix which will not support this function. Any function where I can get the windows username. There is a function getUserPrincipal(), but this function returns a NULL. How to resolve this.

View Replies View Related

Servlets :: Closing DB Connection Retrieved From Connection Pool

Jan 11, 2015

I configured a connection pool in tomcat 7. For every database activity I get a connection from the pool. Do I have to close the connection like other regular connection after the database operation is done? If I close the connection will it have any effect on the connection pool?

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

How To Open J2SE SDK

Jan 27, 2014

I downloaded JDK 7 file. But, I don't know how to use it. First of all, I even don't know how to open it.

There are some files in 'Java development kit', and the one I can play with is 'Java mission control'.

But it looks strange to me...and it looks it is not the way.. I want to compile files but, I can't find how to open java compiler.

View Replies View Related

Swing/AWT/SWT :: Open GUI On Top Of Another GUI

Feb 12, 2014

how to open a GUI on top of another GUI? I have built a GUI and have a button that when pressed I want to open a new GUI which is another java application within the project, it seems pretty straight forward and I just need to insert 'new [name of application]()'

Button btnEdit = new Button(shell, SWT.NONE);
btnEdit.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
new edit();
}
});
btnEdit.setBounds(76, 10, 75, 25);
btnEdit.setText("Edit");

View Replies View Related

How To Give URL Connection To Code

May 11, 2014

how to give URL Connection to this?

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.net.*;
import java.io.*;
import javax.swing.*;
import javax.swing.event.*;
public class WebBrowser

[code]....

View Replies View Related

Connection To A Database In Its Own Class

Jan 15, 2015

I was wondering if I could take the following code and somehow put the connection to database in it's own class without the "public static void main(String[] args)" method. That way I could call it anytime i want to open a connection to the database.

Java Code:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Sample {
public static void main(String[] args) throws ClassNotFoundException

[Code] ....

View Replies View Related

Database Connection In Java

Oct 27, 2014

I'm using oracle 10g Database and Java 'jdk1.7.0_45' version.I have to a create program to insert data into a table.

View Replies View Related

Swing/AWT/SWT :: How To Open Another GUI With A Button

Apr 8, 2014

I'd like open a second GUI when I press a button that's on the first GUI, like a link in a website.

What I want to do is:

1- Open GUI_1;

2- Press a button on GUI_1; this button close GUI_1 and open another GUI (GUI_2).

How can I do it?

View Replies View Related

Cannot Open Jar File In Eclipse

Feb 27, 2015

i have an older file I was working on 2 months ago and when i try to open it in eclipse I get a message corruption error. I know this is not possible since I was just working on it a while back, and it's the same program version as what i am currently using..Or would I do a file import instead?

View Replies View Related

JSP / JSTL :: How To Open CHM File

Sep 13, 2012

Is there a way we can open a .chm file stored at server through jsp application without downloading the file and saving it to the local machine.

What I googled is : we cannot download .chm files from a web browser and simply click Open.  Download the .chm file to your computer first, right-mouse click it in Windows Explorer and select Properties.  Then click Unblock.

But I want my users to simply view the file without downloading it.

View Replies View Related

JSF :: Which Way Is Better For Holding Database Connection Parameters

Sep 16, 2014

I'm using JSF framework. I can let Netbeans to create the persistence unit and hardcodes connection parameters into the persistence.xml file or i can use resource tag in context.xml file or using another file like property file or class for holding connection parameters like username and password; what is the most secure way or expert way to use connection properties in my app or there is no difference?

View Replies View Related

Web Services :: Getting Connection Timeout Using Httpsconnection?

Mar 9, 2015

package com.dnex;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;

[code]....

I am getting the connection time out error in below line :-

System.out.println("response code"+httpConnection.getResponseMessage());

Note:-I need to pass user id and pwd in header parameter.and I am using https connection.

View Replies View Related

Servlets :: Database Connection And Tomcat

Mar 15, 2015

I am trying to make a simple login using netbeans, derby database included in netbeans and tomcat server. I made everything nice and separated: I have a model package with a class called DbConnector that has the following method:

public Connection connect() {
try {
return DriverManager.getConnection(url, user, pass);
} catch (SQLException ex) {
return null;
}
}

Then i have another class, an userDAODB that has a password check method:

public boolean checkPassword(String user, String password) {
try (Connection con = new DbConnector().connect(); Statement stmt = con.createStatement()) {
//checks the password in the database

In the main method of this class i tested everything, it works very nice, logs me in, other methods work too, no problem what so ever.But then i go to my servlet:

public class LoginTest extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String username = request.getParameter("username");
String pass = request.getParameter("pass");
UserDAODB userDAO = new UserDAODB();
boolean authe = userDAO.checkPassword(username, pass);

[code]....

So when i start the webpage and i try to click on the login button I get a NullPointerException com.model. UserDAODB. check Password (User DAODB. java:14) - so line 2 here

I have been googling a bit, i placed the derby.jar and the derbyclient.jar in the lib directory of tomcat, i tried to modify the context.xml of my application, but then it wouldn't even start anymore.

View Replies View Related







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