Newby Needs Help Connecting to Oracle Database
I'm very very new to java. I'm trying to write a program to connect to and read some fields in an oracle table. I'm having problems and am not sure how to correct it. I downloaded and installed the oracle thin driver. I'm using Eclipse 3.3 and JRE 1.6. This is my code:
import java.sql.*;
public class One {
public static void main(String[] args) {
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println("let's connect");
Connection conn=DriverManager.getConnection(
"jdbc:oracle:thin:@a571p05.pt.com:1521:orap1","username","password");
System.out.println("I'm connected");
Statement stmt=conn.createStatement();
ResultSet rset=stmt.executeQuery(
"select CUSTNUM,CUST_LNAME from TBL.CUSTOMER where " + "CUSTNUM=\"12345678900\"");
System.out.println("Result set?");
while (rset.next())
System.out.println(rset.getString(1)); //Print col 1
stmt.close();
catch(Exception x) {
System.out.println("Unable to connect!");
System.exit(0);
If I just run it, this is the output:
let's connect
I'm connected
Unable to connect!
So, it looks like it may be connecting, at least it runs the line that establishes the connection then the next line which prints a comment. However, it seems to fail at some point thereafter. I've tried debugging it and as far as I can tell, it's erroring out on thie line:
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
with this stack trace:
Thread [main] (Suspended)
ClassNotFoundException(Throwable).<init>(String, Throwable) line: 217
ClassNotFoundException(Exception).<init>(String, Throwable) line: not available
ClassNotFoundException.<init>(String) line: not available
ClassLoader.findBootstrapClass(String) line: not available [native method]
Launcher$ExtClassLoader(ClassLoader).findBootstrapClass0(String) line: not available
Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available
Launcher$AppClassLoader.loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available
Launcher$AppClassLoader(ClassLoader).loadClassInternal(String) line: not available
One.main(String[]) line: 8
I checked the project properties\java build path and I have JDBC_THIN_DRIVER and JRE_SYSTEM_LIBRARY listed there. Do I need something else? I'm not quite sure what I'm missing or what the errors are telling me. Any help, or pointers are appreciated. Thanks much!
I would write that class more like this, assuming that customer ID is a String:
import java.sql.*;
public class One
private static final String DEFAULT_DRIVER = "com.oracle.jdbc.Driver";
private static final String DEFAULT_URL = "jdbc:oracle:thin:@a571p05.pt.com:1521:orap1";
private static final String DEFAULT_USERNAME = "username";
private static final String DEFAULT_PASSWORD = "password";
private static final String SQL = "select CUSTNUM,CUST_LNAME from TBL.CUSTOMER where CUSTNUM=?";
private static final String DEFAULT_CUSTOMER_ID = "12345678900";
public static void main(String[] args)
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rset = null;
try
Class.forName(DEFAULT_DRIVER);
conn = DriverManager.getConnection(DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
stmt = conn.prepareStatement(SQL);
String customerId = ((args.length > 0) ? args[0] : DEFAULT_CUSTOMER_ID);
stmt.setString(1, customerId);
rset = stmt.executeQuery();
while (rset.next())
System.out.println(rset.getString(1));
catch (Exception x)
x.printStackTrace();
finally
close(rset);
close(stmt);
close(conn);
private static void close(Connection conn)
try
if (conn != null)
conn.close();
catch (SQLException e)
e.printStackTrace();
private static void close(Statement stmt)
try
if (stmt != null)
stmt.close();
catch (SQLException e)
e.printStackTrace();
private static void close(ResultSet rset)
try
if (rset != null)
rset.close();
catch (SQLException e)
e.printStackTrace();
}%
Similar Messages
-
Help needed in connecting to oracle database in unity
Hi,
I have been trying to connect to Oracle database in my codes. I have tried using OdbcConnection and OleDbconnection. But both did not allowed me to connect to the database. The database, testDb, can be accessed using SQL plus as well as the SQL developer. I even tested the connection successful using ODBC data source administrator.
the following is my code for the connection string:
OdbcConnection connectionString = "Driver={Oracle ODBC Driver};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP )(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=Te stDb)));Uid=scott;Pwd=password;";
the error i got is [ODBC Driver Manager] Data Source name not found and no default driver specified.
for the driver parameter, i have tried using "Microsoft ODBC for Oracle". It gives me another error stating that the oracle and network components are not installed.
I even tried "Oracle in OraDb11g_home1" which was specified in the ODBC Data Source Administrator. The same error came out.
Below are some of my specifications:
Platform: Windows 7 64bit
Oracle: Oracle Database 11g Release 2 (64bit)
Unity: 4.1.2
Can someone please help me with this? What is it that i have done wrong?
Thanks.1008737 wrote:
Hi,
I have been trying to connect to Oracle database in my codes. I have tried using OdbcConnection and OleDbconnection. But both did not allowed me to connect to the database. The database, testDb, can be accessed using SQL plus as well as the SQL developer. I even tested the connection successful using ODBC data source administrator.
the following is my code for the connection string:
OdbcConnection connectionString = "Driver={Oracle ODBC Driver};Server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP )(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=Te stDb)));Uid=scott;Pwd=password;";
whenever localhost (127.0.0.1) is used, this means that no remote client can ever connect to this system
The problem involves ODBC configuration & has nothing to do with Oracle. -
Need help connecting to Oracle to create database
Am student taking DBA course; have altered pfile so that path shows where createdb is located. Cannot connect to Oracle; keep getting message "insufficient privileges." Createdb file amended per book to "REMOTE_LOGIN_PASWORDFILE=exclusive" and still can't connect. Can I grant connect privileges to internal/oracle? Tried several times to create database and am now using new database name to try again, but when I get to svrmgrl and type in "connect internal" and give password "oracle" as book says to do I get the "insufficient privileges" message again. Need help.
Linda,
when you use exclusive in remote_login_passwordfile is necessary make one file. Use the following instructions:
orapw file=orapw<SID> password=<password> entries=<users>
where
file=name of password file (mandatory)
password=password for SYS and INTERNAL (mandatory)
entries=maximum number of distinct DBA and OPERs (opt)
There are no spaces around the equal to (=) character.
Find orapwd.exe by Windows Explorer
Bye,
DQC -
Need help connecting to Oracle 7
Hi!
My name is Patrick and I have a question regarding Oracle 7. First I need to clarify that I usually don't work with Oracle products at all and there I'm a total newbie in this area; please be gentle! :)
I work for a company that installs/builds/integrate healthcare systems, and we have now encountered a problem that involves Oracle 7. We need to create a connection between a workstation with a Oracle database (version 7) provided by another company and a product of ours using ODBC. We have been in contact with the other company that informed us that we need to install the Oracle 7 ODBC driver that is found on a Oracle Client CD. The problem is that this CD is gone and the customer wasn’t even aware of it. As I understand it there is no way of just downloading and installing the driver by itself, but you need the Oracle installer - is this correct?
Anyway, what would the quickest solution for this problem? Is it even possible to buy Oracle 7 nowadays? Would a later version than 7 work?
Thank you for your help!
Regards,
PatrickHi,
In theory it is possible with a 9.0.1 client (but not with 9.2). See note 207303.1 in Metalink.
https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=207303.1
If this is true, you can download ODBC 9.0 from here
http://www.oracle.com/technology/software/tech/windows/odbc/index.html
A 9.0.1 is more difficult to find, but it might be included as part of some other product, eg an old version Discoverer Desktop (such as 4.1 or 9.0.4)
http://www.oracle.com/technology/software/products/discoverer/index.html
or an old version of Designer...
http://www.oracle.com/technology/software/products/designer/index.html
Another option is a third-party ODBC stack with their own wire-level implementation of Oracle SQL*Net.
Good luck.
Cheers,
Colin -
Need help connecting to a database with an applet
I am making a Java game that runs in an applet and needs to connect to a Java DB database. I created the database and table in NetBeans and now I have no idea how to connect this applet to the database. I tried using a DataSource and an InitialContext and I got a NoInitialContextException. Any help would be appreciated thanks.
Already made the InitialContext. This is the code I used in the applet:
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc:derby://localhost:1527/GameDatabase");
Connection con = ds.getConnection();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM Scenery"); -
Need help on Upgrading oracle database on windows
Dear All,
We have installed Oracle 11.2.0.1 Ent Edition on Windows server 2008 64 bit
Can anybody help me to get guide for upgrading oracle 11.2.0.1 to 11.2.0.3 on windows?Install 11.2.0.3 into a new ORACLE_HOME, apply the latest PSU patch - then follow the steps in the Upgrade Guide - http://docs.oracle.com/cd/E11882_01/server.112/e23633/toc.htm
These MOS Docs may also help
Oracle Database Upgrade Path Reference List [ID 730365.1]
Important Changes to Oracle Database Patch Sets Starting With 11.2.0.2 [ID 1189783.1]
Complete Checklist to Upgrade the Database to 11gR2 using DBUA [ID 870814.1]
Things to Consider Before Upgrading to 11.2.0.3 to Avoid Poor Performance or Wrong Results [ID 1392633.1]
Best approach for Oracle database patching sequence to latest/required patchset along with CPU/PSU/any-other-one-off patch [ID 865255.1]
Quick Reference to Patchset Patch Numbers [ID 753736.1]
HTH
Srini -
Need help connecting to Oracle 8i db
I'm trying to build a very simple jsp page that connects to a Oracle 8i schema I already have.
Here's the entry in the data-sources.xml for the project:
<native-data-source name="jdev-connection-native-VacationTest" jndi-name="jdbc/VacationTestCoreDS" url="jdbc:oracle:thin:@xxxxxx:1521:ORCL" user="xxxxx" password="xxxx" data-source-class="oracle.jdbc.pool.OracleDataSource"/>
In the Index.jsp page I have:
<sql:query var="adminQuery" dataSource="jdbc/VacationTestCoreDS"
sql="select * from persons where type=\'Admin\'"/>
I have this defined in my web.xml file:
<resource-ref>
<res-ref-name>jdbc/VacationTestCoreDS</res-ref-name>
<res-type>oracle.jdbc.driver.OracleDriver</res-type>
<res-auth>Container</res-auth>
</resource-ref>
When I run the application, I get the error below which I have not been able to resolve. I have also tried the jdev-connection-managed source but the application couldn't find the jndi definition. Any ideas on what could be causing this problem?
thanks
Ash
500 Internal Server Error
java.lang.NullPointerException
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.connector.ApplicationConnectionManager.getOracleConnectionManager(ApplicationConnectionManager.java:304)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.administration.ApplicationResourceFinder.getJCAConnectionResource(ApplicationResourceFinder.java:455)
at com.oracle.naming.J2EEContext.addResourceEntries(J2EEContext.java:743)
at com.oracle.naming.J2EEContext.create(J2EEContext.java:81)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpApplication.getEnvironmentContext(HttpApplication.java:6797)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.ApplicationContext.getEnvironmentContext(ApplicationContext.java:365)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.ApplicationContext.lookupInJavaContext(ApplicationContext.java:318)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.ApplicationContext.unprivileged_lookup(ApplicationContext.java:234)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.ApplicationContext.lookup(ApplicationContext.java:199)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.apache.taglibs.standard.tag.common.sql.DataSourceUtil.getDataSource(DataSourceUtil.java:72)
at org.apache.taglibs.standard.tag.common.sql.SetDataSourceTagSupport.doStartTag(SetDataSourceTagSupport.java:91)
at index.jspService(_index.java:50)
[index.jsp]I still haven't solved this; but I understand that I need to use the managed pool connection (jdbc/VacationTestDS) and this is defined in the workspace-data-source.xml file
However, when I run the application, I now get this error:
WARNING J2EE JNDI0002 Resource reference jdbc/VacationTestDS not found. Allowing J2EEContext creation to continue anyway.
Is there nobody who has seen this problem before? -
Not able to connect remote oracle database over VPN
I can not connect remote oracle database over VPN. tnsping is ok and it shows the server information of remote database. i can also telnet the 1521 port of remote database server. I can connect the same server when it is located in the same LAN. Please help me out this is very urgent.
6b6c669e-6baa-45c4-a6dc-444aef2d5e7a wrote:
I can not connect remote oracle database over VPN. tnsping is ok and it shows the server information of remote database. i can also telnet the 1521 port of remote database server. I can connect the same server when it is located in the same LAN. Please help me out this is very urgent.
First, this is a forum of volunteers. There is no "urgent" here.
"Urgent" means one of two things -
1) people are dying, or
2) you have a customer-facing, revenue-producing production system that is down.
(And to get some perspective on the second case, keep the first in mind.)
For the first, you call whatever civil emergency service seems appropriate.
For the second, you open an SR with Oracle - which requires a paid-up support contract. For *them* to consider your problem "urgent", you will need to demonstrate that your problem falls under item #2. I seriously doubt your problem fits that criteria.
You don't have a support contract? Now you know the exact dollar figure that your company places on the data.
That said, you need to understand a few things about your specific problem,
First, port 1521 is only used by the listener to accept a connection request. Once it gets that request (and finds that it is for a service (sid) that it knows about, it will fork a server process and tell the requesting client that it can communicate with that server process over some other port .. a randomly chosen port number in the "high" range. It could be your vpn is blocking that other port, whereas your internal firewall is not.
But this is just an educated guess since I cannot find "can not connect remote oracle database over VPN" in any error message manual. If you had mentioned the VPN along with an actual oracle error message we could be much more precise in our diagnoses and recommendations.
---- edit 22 Sep
It occurred to me that I just assumed you were using the same client machine in both cases ... a laptop that you use both at work (local network) and home (vpn). If that assumption is false, there are probably problems with your tns setup on the home (vpn) machine.
But again, it would be much easier to help if you gave us an actual error message. -
Unable to connect to Oracle database running on Windows machine from linux.
Hi,
I'm not able to connect to oracle database running on Windows machine from Linux machine. I'm geting the below mentioned error. I have given below the code I used to connect to database and database propertes.Do I need to use any specific driver?
Please help me.
Thanks,
Sunjyoti
Code :
import oracle.jdbc.pool.OracleDataSource;
import java.sql.Connection;
import java.util.*;
import java.sql.*;
import java.io.*;
class try2{
public static void main(String args[]) {
try {
System.out.println("hi");
// Load the properties file to get the connection information
Properties prop = new Properties();
prop.load(new FileInputStream("/home/sreejith/EDIReader/Connection.properties"));
// Create a OracleDataSource instance
OracleDataSource ods = new OracleDataSource();
System.out.println("prop is "+prop);
configureDataSource(ods, prop);
Connection conn=null;
// Create a connection object
conn = ods.getConnection();
System.out.println("Connection is"+conn);
// Sets the auto-commit property for the connection to be false.
conn.setAutoCommit(false);
} catch (SQLException sqlEx){ // Handle SQL Errors
System.out.println("In exception "+sqlEx);
} catch(Exception excep) { // Handle other errors
System.out.println(" Exception "+ excep.toString());
private static void configureDataSource(OracleDataSource ods, Properties prop) {
// Database Host Name
ods.setServerName(prop.getProperty("HostName"));
// Set the database SID
ods.setDatabaseName(prop.getProperty("SID"));
// Set database port
ods.setPortNumber( new Integer( prop.getProperty("Port") ).intValue());
// Set the driver type
ods.setDriverType ("thin");
// Sets the user name
ods.setUser(prop.getProperty("UserName"));
// Sets the password
ods.setPassword(prop.getProperty("Password"));
Connection properties :
# Your Database Connection details
HostName = 10.20.3.19
SID = EDIREAD
Port = 1521
UserName = dbuser
Password = dbuser
Error I'm getting is
error while trying to connect with odbc datasource
[root@iflexpau2217 EDIReader]# java try2
hi
prop is {HostName=10.20.3.19, Password=dbuser, UserName=dbuser, SID=EDIREAD, Port=1521}
In exception java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
Also I tried to connect with weblogic JDBC driver
Code is here:
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
//import com.entrust.toolkit.util.ByteArray;
public class trial{
public static void main(String args[]) throws IOException{
System.out.println("hi");
Connection p_conn = null;
PreparedStatement xml_insert = null;
try {
// Load the JDBC driver
System.out.println("hi2");
// String driverName = "oracle.jdbc.driver.OracleDriver";
String driverName = "weblogic.jdbc.oracle.OracleDriver";
System.out.println("hi2");
Class.forName(driverName);
// Create a connection to the database
String serverName = "10.20.3.19";
String portNumber = "1521";
String sid = "EDIREAD";
//String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String url = "jdbc:bea:oracle://10.20.3.19:1521";
String username = "dbuser";
String password = "dbuser";
System.out.println("connection is:"+p_conn+"user name is"+username+"password is"+password);
p_conn = DriverManager.getConnection(url, username, password);
System.out.println("connection is:"+p_conn+"user name is"+username+"password is"+password);
xml_insert=p_conn.prepareStatement("insert into PRTB_SUBUNIT (SUBUNT_ID,SUBUNT_SUB_UNIT,SUBUNT_PHYUNT_ID) values (?,?,?)");
//InputStream in=null;
File l_file=new File("/home/sreejith/EDIReader/propertyfiles/inputfile/BUG_10802_ES_CSB19_68.txt");
BufferedReader input =null;
input=new BufferedReader(new FileReader(l_file));
String line = null;
StringBuffer trial=new StringBuffer();
while (( line = input.readLine()) != null){
trial.append(line);
trial.append(System.getProperty("line.separator"));
//InputStream is = new BufferedInputStream(new FileInputStream(l_file));
System.out.println(trial.toString());
//Blob b ;
//byte[] bytes=trial.toString().getBytes();
//System.out.println("Size-->"+bytes.length);
xml_insert.setString(1,new String("SpecailChar"));
//xml_insert.setBinaryStream(2,new ByteArrayInputStream(bytes),15920);
xml_insert.setString(3,"SpecailChar");
xml_insert.executeUpdate();
p_conn.commit();
} catch (ClassNotFoundException e) {
System.out.println("ClassNotFoundException:"+e.getMessage());
// Could not find the database driver
} catch (SQLException e) {
System.out.println("SQEXCEPTIN:"+e.getMessage());
// Could not connect to the database
}catch (FileNotFoundException e) {
System.out.println("filenot found:"+e.getMessage());
// Could not connect to the database
Error I'm getting is
error while trying with jdbc:
SQEXCEPTIN:[BEA][Oracle JDBC Driver]Error establishing socket to host and port: 10.20.3.19:1521. Reason: Connection refusedIs the Windows firewall active? Have you enabled the port on the firewall, if it is?
-
How to connect to Oracle database from webdynprojava application
Hi
How to connect to Oracle database from webdynprojava application. where can we provide the code to connect to database.?
Thank You.Hi,
You need to create Java Bean model. The bean is a typical java bean with default constructor, getter and setter. You can have additional methods for query etc. The attributes in the class will be your model node and attributes.
However you need to configure the connection and create JNDI using visual administrator before writing the code.
You can also consider writing Session EJB with oracle and using them in WD.
http://help.sap.com/saphelp_nwce10/helpdata/en/45/dcaa4f05535591e10000000a1553f7/frameset.htm
Srini -
OBIEE 11g not connect the Oracle database
Hi All,
We installed 11.1.1.6.0 version on Linux 64 bit it works fine after some reason we delete that one and re install on same Linux box,we place old catalog and rpd.
But when you login all reports is showing errors bellow
In log file..........
[nQSError: 43119] Query Failed:
[2013-10-19T19:47:24.000+00:00] [OracleBIServerComponent] [ERROR:1] [] [] [ecid: 24cef0e6e960bda3:-7f74eefb:141d239504e:-8000-0000000000000d97] [tid: 44b5a940] [nQSError: 17014] Could not connect to Oracle database. [[
[nQSError: 17001] Oracle Error code: 12154, message: ORA-12154: TNS:could not resolve the connect identifier specified
at OCI call OCIServerAttach.
[nQSError: 43119] Query Failed:
[nQSError: 43113] Message returned from OBIS.
In report level
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 17001] Oracle Error code: 12154, message: ORA-12154: TNS:could not resolve the connect identifier specified at OCI call OCIServerAttach. [nQSError: 17014] Could not connect to Oracle database. (HY000)
Pls help thanks in advance.There are 2 places you need to keep TNS names.ora file for OBIEE to connect.
1. Oracle client which is in your machine
2. OBIEEhome>Oracle_BI1\network\admin
I'm sure you would have it in your oracle client. Copy paste the same TNS names in this path too.
Then open rpd and right click on any table in physical layer and click view data. You should see the results.
if this doesn't work check your credentials.
mark if this helps -
Connect to Oracle database from SQL Sever
Can you help on an issue of connection from SQL Server to Oracle database:
In SQL Server, I create a "linked server" to connect to Oracle database on a different machine. But it will take a unreasonable time (about 30 seconds) to call a Oracle query from SQL Server.No there are no entries required in the TNSNAMES.ORA
When you are using ODBC for connection, Oracle does not look fo rany enteries in TNSNAMES.ORA file.
Now I am able to connect to both SQL Plus and Forms 6i. But while connecting to SQL Plus its giving an error
Error accessing PRODUCT_USER_PROFILE
Warning: Product user profile information not loaded!
You may need to run PUPBLD.SQL as SYSTEM
Server not available or version too low for this feature
Connected to:
Oracle Open Client Adapter for ODBC 6.0.5.35.0
Microsoft SQL Server 08.00.0534
Also while disconnecting the Windows Program Error comes, and the application closes abruptly. -
Oracle Client to connect to oracle database 7.x
Hi,
I want to connect to oracle database 7.x from a win2K using ODBC.
I know I need sql*net to make a connection .
Can you tell me where can I find it on the site to download/purchase?
If it is not available,can you suggest me the other options available for my situation.
Thanks
Sushma.Thank You Justin.
Can you provide me the link to the download/purchasing the oracle client.
Because when I searched on OTN ,I get only documentation,nothing to software downloads.
I really need some help.
Is oracle client called as oracle tools etc.????????
Thanks in advance
Sushma. -
Using php to connect to Oracle Database 11g Release 2 Enterprise Edition EE
Greetings everyone!
Please i dont know how to connect to Oracle Database 11g Release 2 Enterprise Edition with php even though i connected with php successfully with Oracle Database 11g Express Edition with the php code below. can someone help please...Note im referring to oracle EE not XE.
define('ORA_CON_UN', 'hr'); // User name
define('ORA_CON_PW', 'Adlibs14$'); // Password
define('ORA_CON_DB', '//localhost/EE'); // Connection identifier
// use constants defined in anyco_cn.inc
$conn = oci_pconnect(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB);
if (!$conn) {
db_error(null, __FILE__, __LINE__);
Edited by: user11273096 on Jul 15, 2011 12:03 AMFind the hostname and service name of the database and use those values in the ORA_CON_DB constant.
Use 'lsnrctl status' on the database host to find the service name.
If you use a "tns" alias, you may need to create a tnsnames.ora file where PHP can access it.
Set the environment variable TNS_ADMIN (on Linux) to the directory containing the file.
See the section "Oracle Database Name Connection Identifiers" p 102 of the free book
http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html -
Hello,
I am trying to connect to oracle database 10.1.0.2.0 from jdeveloper 11.1.2.1.0 to develop an ADF application.
But it is giving me the error
Test failed: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
connection type:oracle(JDBC)
Role :SYSDBA
Driver:thin
Host:localhost
JDBC port:1521
SID:webaid
I am able to connect to the database using SQL*Plus with the same credentials.
Any help is appreciated!I take it you solved this problem, since you posted this: installing Oracle 10.1.0.2.0 (32 bit) on windows 2003 server
Maybe you are looking for
-
Sharing Itunes library between an admin and user account on one imac G5
Hello, Please forgive the repetitive question. i have set up an admin and a user account on my iMac. I set the itunes library to users/shared/music/itunes/itunes library on both accounts. The music shows up on the admin account but not the user accou
-
File open on more than one computer at a time
I maintain a network of four Macs (Cube, G4 Tower, Mini, and G5 Tower) all running OS 10.4.11. Recently two people working on the network discovered that they both had a certain file open at the same time. In order to determine the extent of the prob
-
ATI HD3400 in Lenovo T400: xf86-video-ati from testing docking issues
Hi everyone, I have a Lenovo T400 which I exclusively use with the discrete ATI HD3400 graphics chip because I need the DVI output from my Lenovo Advanced Mini Dock to drive a large display. When I recently updated to xf86-video-ati 6.9.0.91-1 (from
-
Errors tracking through log file(tomcat5)/jsp
Hi All! Can anyone find out errors in this log file ..pls its urgent.. I got to make jsp package run perfectly ...but its not finding out class files. log4j: Finished configuring. Oct 12, 2005 2:04:24 PM org.apache.catalina.core.StandardHostDeployer
-
HT204053 how do I get my music in itunes to my iphone
I put an album on itunes today and want to put it in my music icon on my iphone 4- used to be easy but haven't been on itunes for a while and the page has changed and having trouble locating how to transport music from itunes on laptop to iphone