Java connect to oracle
I have 2 database server to store data and 2 backup database server to backup data. I want to use java connect to 2 database server (or more) When 2 database server die, Java will automacally connect to 2 backup database server. How can I do ?
Oracle has features for standby databases; their configuration has nothing to do with Java, it all happens within Oracle software...
There are books about this, such as "Oracle Database 10g High Availability with RAC, Flashback, and Data Guard"...
Similar Messages
-
VisualAge Java Connection to Oracle
Does anyone have any suggestions for this problem?
I am trying to connect to an Oracle 8 database from within VisualAge Java Prof. 3.5. I am using a servlet to access this database.
I can connect to this instance using SQL*Plus without a problem.... This SQL*Plus connection is done using the same connection string as I have coded in VA (after the @ sign).
The connection string I am using is:
jdbc:oracle:thin:@(description=(address_list=(address=(protocol=tcp)(port=1521)(host=172.17.1.57)))(connect_data=(sid=iasdev))(source_route=yes))
The oracle.jdbc drivers are found...I imported classes111.zip into VisualAge and set the project in my ClassPath.
The registerDriver or Class.forName methods work fine. The problem is on the DriverManager.getConnection() call. The error message is:
'No more data to read from socket'.
Any suggestions would be appreciated. Thanks!
dmorrisAhbaid Gaffoor (guest) wrote:
: I'm trying to run the TestInstallJDBC program off of your site
: on a RedHat Linux 5.1 box with Oracle 8.0.5 for linux
installed.
: However it cannot seem to find the following classes when
trying
: to import them:
: import oracle.sqlj.runtime.Oracle;
: import sqlj.runtime.ref.DefaultContext;
: How do I solve this problem?
: Do I need to download them separately from sun?
: thanks,
: there is no $ORACLE_HOME/jdbc directory on my installation, I
: think that's where it should be...
: Ahbaid.
Just to confirm for u. U should have
$ORACLE_HOME/jdbc/lib/classes111.zip or classess102.zip. There is
also a README there which show how to connect, sample code etc.
If these files already installed, then i don't know what is the
problem. U have to have these files, dirs.
Nathan Phan
null -
Java connection to oracle 8.0.5 on linux
I'm trying to run the TestInstallJDBC program off of your site
on a RedHat Linux 5.1 box with Oracle 8.0.5 for linux installed.
However it cannot seem to find the following classes when trying
to import them:
import oracle.sqlj.runtime.Oracle;
import sqlj.runtime.ref.DefaultContext;
How do I solve this problem?
Do I need to download them separately from sun?
thanks,
there is no $ORACLE_HOME/jdbc directory on my installation, I
think that's where it should be...
Ahbaid.
nullAhbaid Gaffoor (guest) wrote:
: I'm trying to run the TestInstallJDBC program off of your site
: on a RedHat Linux 5.1 box with Oracle 8.0.5 for linux
installed.
: However it cannot seem to find the following classes when
trying
: to import them:
: import oracle.sqlj.runtime.Oracle;
: import sqlj.runtime.ref.DefaultContext;
: How do I solve this problem?
: Do I need to download them separately from sun?
: thanks,
: there is no $ORACLE_HOME/jdbc directory on my installation, I
: think that's where it should be...
: Ahbaid.
Just to confirm for u. U should have
$ORACLE_HOME/jdbc/lib/classes111.zip or classess102.zip. There is
also a README there which show how to connect, sample code etc.
If these files already installed, then i don't know what is the
problem. U have to have these files, dirs.
Nathan Phan
null -
Unable to get database connection from loaded java class in oracle
Hi all,
I am trying to call java class method from oracle function, but getting below exception, while creating connection.
SQL> select charge_calculation(1,'2011-06-01', 'E') from dual;
select charge_calculation(1,'2011-06-01', 'E') from dual
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.ExceptionInInitializerError
inside main method
inside main method1
inside main method2
inside main method3
inside main method3
Exception in thread "Root Thread" java.lang.ExceptionInInitializerError
at javax.crypto.Cipher.getInstance(DashoA12275)
at oracle.security.o5logon.O5LoginClientHelper.decryptAES(Unknown Source
at oracle.security.o5logon.O5LoginClientHelper.generateOAuthResponse(Unk
nown
Source)
at
oracle.jdbc.driver.T4CTTIoauthenticate.marshalOauth(T4CTTIoauthenticate.java)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:367)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
501)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
at
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
at java.sql.DriverManager.getConnection(DriverManager.java)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at SPEodPricing.spEodPricing(SPEODPRICING:98)
at SPEodPricing.main1(SPEODPRICING:47)
Caused by: java.lang.SecurityException: Cannot set up certs for trusted CAs
at javax.crypto.SunJCE_b.<clinit>(DashoA12275)
... 13 more
Caused by: java.security.PrivilegedActionException: java.io.IOException
at java.security.AccessController.doPrivileged(Native Method)
... 14 more
Caused by: java.io.IOException
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java)
at sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:177)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:165)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:43)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:70)
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.ja
va:102)
at
sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:1
24)
at javax.crypto.SunJCE_d.a(DashoA12275)
at javax.crypto.SunJCE_b.g(DashoA12275)
at javax.crypto.SunJCE_b.e(DashoA12275)
at javax.crypto.SunJCE_q.run(DashoA12275)
... 15 more
SQL> select charge_calculation(1,'2011-06-01', 'E') from dual;
select charge_calculation(1,'2011-06-01', 'E') from dual
ERROR at line 1:
ORA-29549: class BBVA_MERGED.SPEodPricing has changed, Java session state
cleared
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64
bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
JAVA Sample code:-
public String method1(int pi_ctry_id,String pi_cur_busi_date ,String pi_eod_bod_flag)
System.out.println("inside main method1");
CachedRowSet tmplcrs = null;
HashMap resMap = new HashMap();
Double ln_candidate_extra = 0.0;
Double ln_calculate_on_val = 0.0;
int lv_calculate_on = 0;
int lv_cand_attribute = 0;
// int pi_ctry_id = 0;
// String pi_cur_busi_date = null;
int pi_bch_id = 0;
// String pi_eod_bod_flag = null;
Date ldt_cur_busi_date = null;
Date lstr_next_calc_date = null;
int li_bch_id = 0;
int li_chg_ac_branch = 0;
int calFrequency = 0;
DbUtils dbObj = new DbUtils();
Map reqMap = new HashMap();
CachedRowSet updtcrs = null;
Connection conn = null;
try
System.out.println("inside main method2");
reqMap.put("pi_ctry_id", ""+pi_ctry_id);
reqMap.put("pi_cur_busi_date", ""+pi_cur_busi_date);
reqMap.put("pi_eod_bod_flag", ""+pi_eod_bod_flag);
System.out.println("inside main method3");
Class.forName("oracle.jdbc.driver.OracleDriver");
// Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@10.1.56.85:1521:orcl", "bbva_merged", "bbva_merged");
// conn = DriverManager.getConnection("jdbc:oracle:thin:@10.1.50.104:1521:cmsdb6", "bbva_base", "bbva_base");
System.out.println("inside main method3");
conn = DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.50.129)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.50.130)(PORT = 1521))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = BBVASIT)))", "BBVA_MERGED", "BBVA_MERGED");
conn.setAutoCommit(false);
System.out.println("inside main method4");
}29532, 00000, "Java call terminated by uncaught Java exception: %s"
// *Cause: A Java exception or error was signaled and could not be
// resolved by the Java code.
// *Action: Modify Java code, if this behavior is not intended. -
Run a java class in Oracle db to connect to Sybase
Hi All, I'm looking for a way to connect to Sybase database at no-license-cost (meaning Oracle Gateway or similar 3rd party products), first coming idea was JDBC, I know I can run a java class in Oracle, the simple idea is to write a java class which connects to Sybase via JDBC thin driver and return the resultset of given query in a java class, the resultset will be presented in Oracle Apex framework. Does anyone know if this can be done or not, and how? Any howto articles are welcomed.
HenryHenry:
To connect to Sysbase or MsSQL Server you could use jTDS open source driver.
http://sourceforge.net/projects/jtds/
upload above driver (jar file) using loadjava, and grants the port connection using dbms_java.grant_permission procedure.
Because jTDS is pure java driver (mode 4) is possible to use directly inside the RDBMS.
Best regards, Marcelo.
PD: Latest jtds driver is compiled against 1.6 sources, but oldest version will work with 1.5 for 11g. -
Hi,
I have installed Oracle 10g on Fedora Core 6. I've been trying to connect to the database via java using jdk1.5(using both drivers, classes12.jar and ojdbc14.jar). But its giving an error Network Adapter Failed. Can any one shed some light on this. Individually both are working fine, oracle 10g and jdk1.5
Thanks in advance
ShankyYeah....i was tryin to connect from the same system. And also i have checked the version of java to be jdk1.6. Are there any new drivers from oracle side for jdk1.6?
Also which oracle driver should be used for jdk1.5?
And btw....what is tnsping?
I am able to connect to Oracle using SQL*Plus normally. What is meant by name resolution?
Thanks in advance for your patience
Regards
Shanky -
Problems in SQL Connection from Java program to Oracle 8.1.7
Hi,
I am java program that connects to Oracle 8.1.7 .
Client: java code on Windows 2000
Server: oracle 8.1.7 on Solaris
Java code uses two types of Connection Pools. One Pool uses "thin" connections and other pool uses "OracleConnectionPoolDataSource" class.
The methods which use "thin" pool work great however the methods which use "OracleConnectionPoolDataSource" fail after 5 to 10 calls.
Given below is the exception that I see in my log file.
February 26, 2002 10:17:38 AM UTC: Debug.INFO: searchByNameCommono.jsp Error : Tpd2.openConnection(1)failed:DBConnPool2.getConnection(String) failed:Closed Connection
com.commerceone.msbtpdapi.util.DBConnException: Tpd2.openConnection(1)failed:DBConnPool2.getConnection(String) failed:Closed Connection
at com.commerceone.msbtpdapi.api.Tpd2.openConnection(Tpd2.java:138)
at com.commerceone.msbtpdapi.api.TpdDBApi.searchTpsByCompanynameAndStatus(TpdDBApi.java:1685)
Windows java code uses JDK 1.3.1
Oracle machine has java version 1.2.2.
Do I need to check for any settings like LD_LIBRARY_PATH on oracle machine ?
Thanks a lot.
Regards
MandarHi,
I am java program that connects to Oracle 8.1.7 .
Client: java code on Windows 2000
Server: oracle 8.1.7 on Solaris
Java code uses two types of Connection Pools. One Pool uses "thin" connections and other pool uses "OracleConnectionPoolDataSource" class.
The methods which use "thin" pool work great however the methods which use "OracleConnectionPoolDataSource" fail after 5 to 10 calls.
Given below is the exception that I see in my log file.
February 26, 2002 10:17:38 AM UTC: Debug.INFO: searchByNameCommono.jsp Error : Tpd2.openConnection(1)failed:DBConnPool2.getConnection(String) failed:Closed Connection
com.commerceone.msbtpdapi.util.DBConnException: Tpd2.openConnection(1)failed:DBConnPool2.getConnection(String) failed:Closed Connection
at com.commerceone.msbtpdapi.api.Tpd2.openConnection(Tpd2.java:138)
at com.commerceone.msbtpdapi.api.TpdDBApi.searchTpsByCompanynameAndStatus(TpdDBApi.java:1685)
Windows java code uses JDK 1.3.1
Oracle machine has java version 1.2.2.
Do I need to check for any settings like LD_LIBRARY_PATH on oracle machine ?
Thanks a lot.
Regards
Mandar -
How to connect with Oracle in java
Hello!
I would like to use java for my graduation project. And connect with Oracle in java.
I used j2sdk1.4.2_04 and Oracle 9i release 9.2.0.1.0
May I ask where could supply me information or content ?
Thanks!!hi jus a sample code
public class DbUtil {
// Connection instance
private static Connection conn = null;
private Object connection;
public DbUtil() {
// Connect to the database
dbConnect();
* This method performs the clean up action and closes the application
void exitDbUtil(){
// If connected to database
if (conn != null) {
try {
// Close the connection
conn.close();
conn=null;
catch (Exception ex){ // Trap errors
System.out.println(" Error while Closing the connection: "+ex.toString());
* Creates a database connection object
private void dbConnect() {
try {
String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName);
String url = "jdbc:oracle:thin:@" + ConnectionParams.s_hostName +
":" + ConnectionParams.s_portNumber +
":" + ConnectionParams.s_databaseSID;
// Create a connection object
conn = DriverManager.getConnection(url, ConnectionParams.s_userName,
ConnectionParams.s_password);
catch(Exception e){ -
Hey Gurus,
Please help me .
MY Current requirement is to connect to multiple oracle 7.1( and other variants) servers running on different operating systems, through Java/JDBC.
My FIrst question is, can i connect to older versions of database using latest drivers?
I could connect to the server running on SCO-oracle 7.1 using SQLNet8.1.7 under windows. But the same is not happening when the client is on Linux.But I need to connect from linux
It says ORA-03113 - End of communication channel.
What may be th problem.
If any one could show some pointers where I can get more information about this problem would be helpfull
THanks
LokeshI tried the classpath suggestion above (not the one modifying the .xml file) , but it didnt work for me , I am using WLI 10.3.1 and trying to connect DB on 8.1.7 V . I downloaded the classes12.jar and the ojdbc14.jar file from the oracle and placed in lib and the even included the classpath , but i again got the same exception .
All this while i was selecting the option Oracle Driver Thin from the DataBase Driver when creating the connection pool from console . I tried with "BEA Oracle Driver (Type 4)" and it worked for me .. Although the option "BEA Oracle Driver (Type 4)" lists only the DBs from 9.0.1 to 11 G , but in my case using this driver i am able to connect to Oracle DB 8.1.7 . So all you guys if it classpath doesnt fix the issue try out by selecting Driver , "BEA Oracle Driver (Type 4)" .
Manoj , this will fix the Connection pool part of the ques, but for the java part Try to load the Driver class "weblogic.jdbc.oracle.OracleDriver" before connecting to DB with Class.forName.
Thx
Yatin Mehta -
Java Class to connect to oracle
Hi all,
I am a new in Java in database...
I have written a java class to connect to oracle and to get some information from the databse. In the class i use the driver oracle.jdbc.driver.OracleDriver.
When I exeute the code in JDeveloper it works fine.
I have loaded the classes to database (10gR2), have written the wrapper function. That all was compilled without errors.
But when I execute the wrapper function I get in SQL*Plus my custom Error-Message from Java Code "Not able to connect to oracle".
The oracle driver classes are owned by sys. Should SYS grant to the user any special rights with dbms_java.grant_permission?
Or is it any other way to connect to the database, in which the java classes are loaded? The user is connected with SQL*Plus. The Java Classes are owned by the user. Should I use JDBC to connect to the same database?
Best regards,Hi
You don't need to re-connect... Have a look here...
http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/ssid.htm#i1024903
HTH
Chris -
User permission issue in connecting to Oracle using java in Cent OS
Hi ,
I am facing a peculiar issue and since I am new to Cent OS, I hope somebody can help me.
I am using Cent OS 4.2 and I installed Oracle client 10.2 in cent os 4.2.
I am having a java application which connects to Oracle server in another Linux system using Oracle OCI driver which comes along with Oracle client
I have a user called user1 which belongs to group group1 as primary group and my application runs under this user user1.
This user is a member of oinstall group (which is the group for oracle uesr which has access to oracle client directories/files)
But when my application tries to connect to Oracle server, I am getting connectivity error saying "Oracle driver not found" or "cannot load libocijdbc10.so". All environment variables like ORACLE_HOME, PATH,CLASSPATH, LD_LIBRARY_PATH are set properly.
The permissions to Oracle folder/files are rwx for owner(oracle user) , rx for group(oinstall) and none for others
What we observed are
1. When the application is start under root user, it works
2. When we give rx permission to others, it works
3. When we make oinstall group as the primary group for my user user1, it works
My questions here
1. Why it is not working even though my user user1 is a member of oinstall group
2. Why it is working when I make oinstall as the primary group
3. Is there any difference in security policy of RHEL and Cent OS
4. How can I access libraries from multiple folders which created by different user and belongs to different groups, if this is the case
I never faced this issue in RHEL4
Hope some body can help me.
Regards
SunilSorry, I should have been more specific. The error message I was referring to shows up in a pop-up windows when I try to run the program. The actual java error message (that shows up in the command prompt window) is as follows:
"Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\WINNT\system32\ocijdbc8.dll: The specified procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1397)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:192)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:142)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:214)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:193)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at lookup.main(lookup.java:16)"
I'm running the program through Windows 200 Pro command prompt, and the version of java is, as I mentioned in the previous message, 1.4.1:
java -version
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode) -
Error in connection to oracle using java
hi ,
i am tring to make a connection to oracle database using java with this code
public class DataBase {
public DataBase(){
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "oracle.jdbc.dirver.OracleDriver";
Class.forName(driverName);
// Create a connection to the database
String serverName = "http://localhost:7777";
String portNumber = "1521";
String sid = "ora9i";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "scott";
String password = "tiger";
connection = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException e) {
JOptionPane.showMessageDialog(null,"Coud not find the database driver ");
// Could not find the database driver
} catch (SQLException e) {
JOptionPane.showMessageDialog(null,"Coud not connect to the database ");
// Could not connect to the database
public static void main(String[] args) {
new DataBase();
i always got the compilation error Coud not find the database driver
i am using oracle9i and jdk1.5.0_04 and my classpath is C:\oracle\ora92\jdbc\lib\ojdbc14.zip;C:\oracle\ora92\jdbc\lib\orai18n.zip
i am realy stuck with this so any one can help me with this probelm
thanks alot,thanks for your reply,
yes i changed the server name and i verified the location of the JDBC driver file(s) on my computer. any way i solved my problem.
you know there was a misunderstanding in what you mean by classpath, i thought that i have to change the classpath from control panel>system>advance>enviroment variable
and then select classpaht and edit it. i was doing this but this is didn't work.
then i don't know why i did that
i went to java program and select my project,right click on it and then select properties>java build path and then select "add external Jars" button and then i simply choose them and add them to my project. and finaly it worked.
thanks alot -
I cant connect to my java application to oracle 11
i am posting my question after alot of research and alot of google stuff .
i have an oracle 11g 11.1.0.6.0 that is installed on my Laptop all i am trying to do is to connect my java application to the database
i am geting this exception : java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection .
the listener is giving me an error as i show below .
i cant telnet the port also 1521 .
i couldnt connect also through sql developer .
the microsoft windows firewall is off .
the code that i am using to connect :
Connection con=null ;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("The driver has been loaded");
con=DriverManager.getConnection("jdbc:oracle:thin:@AMRO-PC:1521:XE", "aa" , "aa");
System.out.println("Connection was established");
catch (Exception e)
System.out.println(e.toString() );
}//catch
my tnsnames.ora is like this
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = Amro-PC)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
the full stacktrace :
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Main.main(Main.java:31)
Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:392)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:434)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:687)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:247)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320)
... 7 more
Caused by: java.net.UnknownHostException: //localhost
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(Unknown Source)
at java.net.InetAddress.getAddressesFromNameService(Unknown Source)
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:117)
at oracle.net.nt.ConnOption.connect(ConnOption.java:133)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:370)
... 12 more
the listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\oracle\app\oracle\product\11.2.0\server)
(PROGRAM = extproc)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = Amro-PC)(PORT = 1521))
DEFAULT_SERVICE_LISTENER = (XE)
it gives me an error when I try to start the listener through LSNCTRL that says :
Message 1070 not found; No message file for product=NETWORK, facility=TNSTNS-125
60: Message 12560 not found; No message file for product=NETWORK, facility=TNS
TNS-00530: Message 530 not found; No message file for product=NETWORK, facility
=TNS
And when I try to see the status of the Listener it says :
Message 1053 not found; No message file for product=NETWORK, facility=TNSTNS-125
41: Message 12541 not found; No message file for product=NETWORK, facility=TNS
TNS-12560: Message 12560 not found; No message file for product=NETWORK, facili
ty=TNS
TNS-00511: Message 511 not found; No message file for product=NETWORK, facilit
y=TNS
32-bit Windows Error: 61: Unknown error
So please can someone help me ?! Thanks in advance
Edited by: 913402 on Feb 9, 2012 12:10 AMYou put the machine name as the host name. I would put the (internal) network address of the laptop there and try again - and make sure that Oracle is actually listening on your internal network address in stead of only the localhost. Or are you running the java application on the same laptop? Then you can simply use 'localhost' as the host name.
-
How we build Java Database Connectivity for Oracle 8i Database
Can any one send me a sample code for Java Database Connectivity for Oracle 8i Database
it will be a grat help
Thanks & Regards
RasikaYou don't need a DSN if you use Oracle's JDBC driver.
You didn't read ANY of the previous replies. What makes you think this one willk help? Or any instruction, for that matter?
Sounds like you just want someone to give it to you. OK, I'll bite, but you have to figure out the rest:
import java.sql.*;
import java.util.*;
* Command line app that allows a user to connect with a database and
* execute any valid SQL against it
public class DataConnection
public static final String DEFAULT_DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
public static final String DEFAULT_URL = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\Edu\\Java\\Forum\\DataConnection.mdb";
public static final String DEFAULT_USERNAME = "admin";
public static final String DEFAULT_PASSWORD = "";
public static final String DEFAULT_DRIVER = "com.mysql.jdbc.Driver";
public static final String DEFAULT_URL = "jdbc:mysql://localhost:3306/hibernate";
public static final String DEFAULT_USERNAME = "admin";
public static final String DEFAULT_PASSWORD = "";
/** Database connection */
private Connection connection;
* Driver for the DataConnection
* @param command line arguments
* <ol start='0'>
* <li>SQL query string</li>
* <li>JDBC driver class</li>
* <li>database URL</li>
* <li>username</li>
* <li>password</li>
* </ol>
public static void main(String [] args)
DataConnection db = null;
try
if (args.length > 0)
String sql = args[0];
String driver = ((args.length > 1) ? args[1] : DEFAULT_DRIVER);
String url = ((args.length > 2) ? args[2] : DEFAULT_URL);
String username = ((args.length > 3) ? args[3] : DEFAULT_USERNAME);
String password = ((args.length > 4) ? args[4] : DEFAULT_PASSWORD);
System.out.println("sql : " + sql);
System.out.println("driver : " + driver);
System.out.println("url : " + url);
System.out.println("username: " + username);
System.out.println("password: " + password);
db = new DataConnection(driver, url, username, password);
System.out.println("Connection established");
Object result = db.executeSQL(sql);
System.out.println(result);
else
System.out.println("Usage: db.DataConnection <sql> <driver> <url> <username> <password>");
catch (SQLException e)
System.err.println("SQL error: " + e.getErrorCode());
System.err.println("SQL state: " + e.getSQLState());
e.printStackTrace(System.err);
catch (Exception e)
e.printStackTrace(System.err);
finally
if (db != null)
db.close();
db = null;
* Create a DataConnection
* @throws SQLException if the database connection fails
* @throws ClassNotFoundException if the driver class can't be loaded
public DataConnection() throws SQLException,ClassNotFoundException
this(DEFAULT_DRIVER, DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
* Create a DataConnection
* @throws SQLException if the database connection fails
* @throws ClassNotFoundException if the driver class can't be loaded
public DataConnection(final String driver,
final String url,
final String username,
final String password)
throws SQLException,ClassNotFoundException
Class.forName(driver);
this.connection = DriverManager.getConnection(url, username, password);
* Get Driver properties
* @param database URL
* @return list of driver properties
* @throws SQLException if the query fails
public List getDriverProperties(final String url)
throws SQLException
List driverProperties = new ArrayList();
Driver driver = DriverManager.getDriver(url);
if (driver != null)
DriverPropertyInfo[] info = driver.getPropertyInfo(url, null);
if (info != null)
driverProperties = Arrays.asList(info);
return driverProperties;
* Clean up the connection
public void close()
close(this.connection);
* Execute ANY SQL statement
* @param SQL statement to execute
* @returns list of row values if a ResultSet is returned,
* OR an altered row count object if not
* @throws SQLException if the query fails
public Object executeSQL(final String sql) throws SQLException
Object returnValue;
Statement statement = null;
ResultSet rs = null;
try
statement = this.connection.createStatement();
boolean hasResultSet = statement.execute(sql);
if (hasResultSet)
rs = statement.getResultSet();
ResultSetMetaData meta = rs.getMetaData();
int numColumns = meta.getColumnCount();
List rows = new ArrayList();
while (rs.next())
Map thisRow = new LinkedHashMap();
for (int i = 1; i <= numColumns; ++i)
String columnName = meta.getColumnName(i);
Object value = rs.getObject(columnName);
thisRow.put(columnName, value);
rows.add(thisRow);
returnValue = rows;
else
int updateCount = statement.getUpdateCount();
returnValue = new Integer(updateCount);
finally
close(rs);
close(statement);
return returnValue;
* Close a database connection
* @param connection to close
public static final void close(Connection connection)
try
if (connection != null)
connection.close();
connection = null;
catch (SQLException e)
e.printStackTrace();
* Close a statement
* @param statement to close
public static final void close(Statement statement)
try
if (statement != null)
statement.close();
statement = null;
catch (SQLException e)
e.printStackTrace();
* Close a result set
* @param rs to close
public static final void close(ResultSet rs)
try
if (rs != null)
rs.close();
rs = null;
catch (SQLException e)
e.printStackTrace();
* Close a database connection and statement
* @param connection to close
* @param statement to close
public static final void close(Connection connection, Statement statement)
close(statement);
close(connection);
* Close a database connection, statement, and result set
* @param connection to close
* @param statement to close
* @param rs to close
public static final void close(Connection connection,
Statement statement,
ResultSet rs)
close(rs);
close(statement);
close(connection);
}% -
Connecting to Oracle using Java API
I'm fairly new to Oracle, but what I'm trying to do should be straight forward (at least that's what I thought). I'm simply trying to connect to an Oracle database using the latest java API (J2SE 1.4.1).
I downloaded JDBC OCI (type 2) driver form the Oracle Web site along with the appropriate DLL; however when I try to run the following two lines
String dbUrl = "jdbc:oracle:oci8:@test";
String user = "user";
String password = "password";
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection c = DriverManager.getConnection(dbUrl, user, password);
I get the following error message:
"java.exe - Entry Point Not Found
The procedure entry point slzsetevar could not be located in the dynamic link library oracore8.dll."
Please note that I am running under Windows 2000 Pro, have Oracle Client 8.1.5 installed, and am able to connect to the same Oracle database using ODBC and PowerBuilder native drivers.
Then I read somewhere that I should use 8.1.7 version of the Oracle client software, so I downloaded it from the Oracle Web site. However when I try to install it under Windows 2000 (by double-clicking on the setup.exe) nothing happens!!!
Any ideas?!Sorry, I should have been more specific. The error message I was referring to shows up in a pop-up windows when I try to run the program. The actual java error message (that shows up in the command prompt window) is as follows:
"Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\WINNT\system32\ocijdbc8.dll: The specified procedure could not be found
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1397)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:192)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:142)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:214)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:193)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at lookup.main(lookup.java:16)"
I'm running the program through Windows 200 Pro command prompt, and the version of java is, as I mentioned in the previous message, 1.4.1:
java -version
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
Maybe you are looking for
-
I have been uploading my CD's to itunes but only copying them to my ipod in small quantities. If I copy, say, six albums they show up on the ipod but they are nowhere to be found once I copy others which seem to take their place. Can anyone tell me i
-
Photoshop CS2 Crashes on Launch
Before I detail all that info I just noticed some information about "ACTIVATION." My hard drive was recently replaced by Apple service and perhaps when I reinstalled the software it had a 30 day timebomb? The instructions say to "TRANSFER ACTIVATION"
-
I'm doing a lab using Cisco ACS 4.1 LEAP Proxy RADIUS External User Databaser, and works fine but I don't understand why. So, I don't know if it's a stable solution. I have the following scenario: WinXP SP2 PEAPv0 (EAP-MSCHAPv2) | v Cisco 3640 802.1x
-
BB Desktop will not display properly in Windows 7
I installed BB Desktop 7 on my Windows 7 64bit machine. It runs but the display is either all white or all black. How can I get desktop to display correctly? Solved! Go to Solution.
-
Hi, I did look thorugh the posts, but I can't seem to see anything similar (usuall I guess). I closed the lid on my laptop this morning (had a DVD in the drive and some photoshop files open. When I got to work, I opened the lid and it decided to not