PHP connecting on Oracle by hostname
Hello,
I need to know if is possible to connect PHP on remote Oracle 10g through Easy Connect(hostname), without Oracle Client.
Regards
Amanda
No, it is not possible.
Similar Messages
-
Problem with local apache w/php connect to oracle 9i server
Is any way to connect to oracle 9i server listening on default port 1521 at any host using local apache w/php on windows xp...
I've already installed all dlls oci drivers...
but it seems doesn't work...I don't know how to make connection from php to oracle db...
any suggestions and help?
thx in advance
btw I'm using client appliation to connecti witth that oracle db and it work fine..Lucas Mierzwa what error are you getting when you try to connect. Am using PHP 4.x on w2k and oracle 10g and Appach server and all work fine. I also run mysql and and IIS all on thesame local machine. They are all functioning fine. I can help you if i know what the problem is.
-
PHP connection to Oracle basic question.
Forgive me if I am missing a very basic piece of knowledge here.
I have a small local web server I run with Apache 2.2.3 and PHP 5.1.6.
I am working on a project that uses Oracle tables located on the corporate network servers.
These tables are normally maintained by the IT department using TOAD. I'd like for the business process 'owners' to be able to maintain the tables themselves - but the company has limited TOAD licensing and some of the dependencies between tables are not readily apparent (especially to a non-IT person).
Therefore I am trying to develop a simple web app to allow table updates, using PHP to connect to the Oracle tables. The idea is I'll put the app and web server on a USB stick for the designated business person to use. (yeah, I know - seems crazy, but the paperwork to get this all into a true 'production' system is impossible, and I really don't want to have to maintain these tables myself for the rest of my working life)
I've got the basics of the app working through some MySQL tables, now I just need to know how to connect to the 'real' Oracle tables.
Here's what I've gathered from my reading:
I need to download Instant Client and install to my 'server' (on my USB stick)
I need to change PHP.ini to enable the extension for php_oci8.dll
I need to set some environment variables....and here is where I am lost.
Are these environment variables on my web server?
I am running my USB web server on a Windows XP system (as will the business users). But it doesn't make sense to me to set my PC's environment variables, because then I'd need to worry about ever PC the USB stick got used on.
Could someone clear this up for me? I am sure I am just missing something very basic.
Oh, and is there anything else I'm missing?
Thanks for any help!
maryGet it working on a full machine first, and then move to using the USB stick. Refer to Underground PHP and Oracle Manual for standard installation information.
PHP/Apache will need to be able to find the Oracle Instant Client libraries. Normally on WIndows this is done with the PATH environment variable on the machine running the web server.
-- cj
PS your IT department might like the free SQL Developer tool from Oracle instead of TOAD. -
ORA- 12154 Error: while php connect to oracle?
While I use OCILogon connect to Oracle9i,show error message as follow:
Warning: ociopen_server: Error while trying to retrieve text for error ORA-12154 in /var/www/html/inc/sev.inc.php on line 57
most of people think of its tnsname' problem,but I modify my tnsnames.ora,and sqlplus can connect with correct username and password.
page source as follow:
<?
function db_connect()
//putenv("ORACLE_SID=test");
//putenv("NLS_LANG=SIMPLIFIED CHINESE.ZHS16CGB231280");
putenv("ORACLE_HOME=/home/oracle/OraHome1");
$connect = OCILogon("system","manager","test");
if ($connect)
return $connect;
else
return -1;
?>
server Env: linux red hat 8.0,apache 2.0.44,php4.3.1,oracle9.2.0
please! Thank in advance!Do you have more than ONE oracle homes created?
Does your PATH env. variable correctly references the ORACLE_HOME directory? -
Apache/PHP connection to Oracle 9i under OpenVMS
Hello,
With CSWS 2 (apache)/PHP 1.3 (4.3.2) under OpenVMS 7.3.2 i'm actually trying to interface an Oracle 9i database located on the same server with no success.
In my php.ini i've uncommented "extension=php_oci8.exe"
In my apache$www:[000000]login.com i've added @orauser.com <SID>
But... no connexion at that time... (php:ocilogon failed)
Someone can help me ?
Someone experienced such interface ?
thanks in advance for allFrankly, I haven't seen an openvms setup :)
Do you have the required oci libraries ? are they accessible to php?
regards,
--karthik -
Php connect to oracle 8i,it occur ORA-12154
Warning: ociopen_server: Error while trying to retrieve text for error ORA-12154 in /SOHU/community/bbs/html/inc/dbcon.php3 on line 4
Do you have more than ONE oracle homes created?
Does your PATH env. variable correctly references the ORACLE_HOME directory? -
Cannot Connect to Oracle, PHP cannot load oci dlls
Hello,
I have installed wamp on windows server, and oracle 9, When I try to connect to oracle in php I get:
Fatal error: Call to undefined function oci_connect() in C:\wamp\www\project2\index.php on line 3
Also when I start wamp, it cannot load the oci dlls found on:
C:\wamp\bin\php\php5.3.0\ext
I have configured the php.ini file and commented as much options
extension_dir = "C:/wamp/bin/php/php5.3.0/ext/"
extension=php_oci8.dll ; Use with Oracle 10gR2 Instant ...
extension=php_oci8_11g.dll ; Use with Oracle 11g Instant Client
extension=php_oracle.dll
extension=oci8.so
I am unable to either connect to the database through php, also when I start wamp, i get pop up windows that it cannot load the dynamic procedures related to oracle: php_oce.dll, php_oce8.dll, php_pdo_oci,
I have even eddited the http.conf file
Also have done this:
•Add the following entries to the "C:\Apache\Apache\conf\httpd.conf" file:
LoadModule php4_module c:\php\sapi\php4apache.dll (approx line 193)
AddModule mod_php4.c (approx line 241)
AddType application/x-httpd-php .php (approx line 851)
I have included the phpinfofile attached as well, part of it below is:
System Windows NT SELECAO 5.2 build 3790 (Windows Server 2003 Standard Edition Service Pack 2) i586
Build Date Jun 29 2009 21:23:30
Compiler MSVC6 (Visual C++ 6.0)
Architecture x86
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=D:\php-sdk\oracle\instantclient11\sdk,shared" "--with-enchant=shared"
Server API Apache 2.0 Handler
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\WINDOWS
Loaded Configuration File C:\wamp\bin\php\php5.3.0\php.ini
Configuration
apache2handler
Apache Version Apache/2.2.11 (Win32) PHP/5.3.0
Apache API Version 20051115
Server Administrator admin@localhost
Hostname:Port localhost:80
Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100
Timeouts Connection: 300 - Keep-Alive: 5
Virtual Server No
Server Root C:/wamp/bin/apache/Apache2.2.11
Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_authn_default mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif mod_php5I get this error, i decided to change directory for oracle_home
putenv("ORACLE_HOME=C:/oracle/product/10.2.0/db_1/bin");
to
putenv("ORACLE_HOME=C:/oracle/product/10.2.0/db_1");
it functioned.
my code
<?php
putenv("ORACLE_HOME=C:/oracle/product/10.2.0/db_1");
putenv("ORACLE_SID=PLSExtProc");
$user ="name"; // set user
$senha="password"; // set password
$banco="(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)
(HOST=127.0.0.1)(PORT=1521)
(CONNECT_DATA=(SERVICE_NAME=orcl))
)"; // configuracoes do banco (isso muda um pouco no oracle)
if ($conexao = OCILogon($user,$senha,$banco))
echo "Conexão bem sucedida.";
else
echo "Erro na conexão com o Oracle.";
?> -
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 -
hi,
I am making a site with a connection to oracle Xe but I am not able to connect me;
here script:
<?php $user = @$_post['login'];
$passwd = @$_post['pass'];
$bd = "(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)
(HOST = titanium)(PORT = 1521))
(CONNECT_DATA=(SERVER = DEDICATED)
(SERVICE_NAME = XE)))";
$conn = ocilogon($user, $passwd, $bd);
$query = "select * from cabine";
$stid = OCIParse($conn, $query);
ociexecute($stid);
while (ocifetch($stid)) {
echo "\n";
$ncols = ocinumcols($stid);
for ($i = 1; $i <= $ncols; $i++) {
$column_name = ocicolumnname($stid, $i);
$column_value = ociresult($stid, $i);
echo $column_name . ': ' . $column_value . "\n";
echo "\n";
ocifreestatement($stmt);
?>
I use easyphp 1.0, and oracle express edition;
here error message:
Warning: ocilogon(): OCISessionBegin: ORA-01017: nom utilisateur/mot de passe non valide ; connexion refusée in c:\program files\easyphp1-8\www\facture.php
what must I modify to make function the connection. ThankTry echo'ing the username & password to check they are set correctly.
Is the user account created and unlocked?
This free book has some useful information on PHP and Oracle: http://tinyurl.com/f8jad
-- cj -
Using php to connect to Oracle Database 11g Release 2 Enterprise Edition
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...
define('ORA_CON_UN', 'hr'); // User name
define('ORA_CON_PW', 'Adlibs14$'); // Password
define('ORA_CON_DB', '//localhost/XE'); // 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 14, 2011 3:41 PMNote that this forum is for XE Beta, not EE.
Can you connect from some other client tool, such as sqlplus?
There's a {forum:id=178} forum that may be more suitable, if basic connectivity outside php works (i.e. issue is only php specific). -
I'm looking for the right syntax to connect php 5 to oracle 9i and the right php configuration. I enabled the php_oci8.dll extension in the php.ini file and I copied the php5ts.dll into the Windows System folder. Could you suggest me ?Thanks!!
cool, a PHP question in a java forum. How lost are you?
-
How PHP connect Oracle for RHLE AS4.0
I have a RHLE AS4.0 with php-4.3.9-3.1 and httpd-2.0.52-9.ent. I have just installed Oracle 10.1.0.4.0 and it did well.
I run phpinfo() and it's OK. However, I have another program :
<html>
<?php
echo "I come here";
if ($c=OCILogon("giao", "tiger", "//localhost/bk119")) {
echo "Successfully connected to Oracle.\n";
OCILogoff($c);
} else {
$err = OCIError();
echo "Oracle Connect Error " . $err[text];
?>
<html>
It only appears
I come here
Because acording to the article at
http://www.oracle.com/technology/pub/notes/technote_php_instant.html
"Typically the database will be on another machine. If the database is local then Oracle components will generally already be available and Instant Client is not required."
How can I use PHP to connect Oracle
Thank youI downloaded php-5.1.4.tar.bz2 but I don't know how to complile php with RHLE.
My system has 2 accounts: root and oracle. Which account should I stand to compile php and after I complied, my system has 2 php. The first is the original php in /etc and the second is in $HOME
Besides, according to http://uk.php.net/manual/en/ref.oci8.php, the path /www/apache/bin/httpd doesn't exist. I think the article is not suitable for my situation.
Please tell me solution -
Hello
I have problems to connect to Oracle database from PHP. I use php_oracle.dll. (I can't use OCI8 because the version of our oracle is 8.0).
We have 2 oracle servers:
One of them connect ok. But I can't connect to the second server. The main difference is the user. In the second server is like 'ops$p123lmn'. In the first server is only text, e.g. 'dbaper'. Can be a problem the '$' in the username?
I connected through ODBC in PHP and ok both oracle servers.
I use ora_logon like:
$ora_conn = ora_logon("ops$p123mln@siap","pass");
when ops$p123mln is the user, siap is the SID and pass is the password.
I'm desperate because I don't find a solution.
Thanks in advance to all.
Jose MartinIf I had to guess, I would say that PHP is probably seeing the string "ops$p123mln@siap" and interpreting it as "ops${p123mln}@siap", which would resolve to "ops@siap", which is way wrong.
Try replacing the string with 'ops$p123mln@siap' (single-quotes around the string instead of double-quotes).
Hope that helps. -
Client unable to connect to Oracle 10g on linux
I have installed Oracle 10g on an Intel box running RedHat AS 3.0. The database installation was succesful but I am unable to connect to it from the client on my laptop running Oracle 10g client and Winfdows XP Pro. The server ip is 192.168.1.10 and I can ping it from the client:
C:\>ping attila.n3kje.net
Pinging attila.n3kje.net [192.168.1.10] with 32 bytes of data:
Reply from 192.168.1.10: bytes=32 time<1ms TTL=64
Reply from 192.168.1.10: bytes=32 time<1ms TTL=64
Reply from 192.168.1.10: bytes=32 time<1ms TTL=64
Reply from 192.168.1.10: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.1.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Here is some info about the 2 environments:
[oracle@attila bin]$ uname -a
Linux attila.n3kje.net 2.4.21-9.0.1.ELsmp #1 SMP Mon Feb 9 22:26:51 EST 2004 i686 i686 i386 GNU/Linux
Server hosts file
======================================================
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 attila.n3kje.net attila localhost.localdomain localhost
hostname output
======================================================
[root@attila root]# hostname
attila.n3kje.net
ifconfig output
=======================================================
[root@attila root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:C0:9F:1D:0C:C8
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13772171 errors:0 dropped:0 overruns:0 frame:0
TX packets:13748842 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1269613311 (1210.7 Mb) TX bytes:4065314800 (3876.9 Mb)
Interrupt:16 Base address:0xecc0 Memory:fe100000-fe120000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5513840 errors:0 dropped:0 overruns:0 frame:0
TX packets:5513840 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:865454291 (825.3 Mb) TX bytes:865454291 (825.3 Mb)
Client TNSNAMES.ORA
======================================================
# tnsnames.ora Network Configuration File: C:\Oracle\product\10.1.0\Client_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLE10G =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DEV10G)
PRDSRR =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = dev10g)
Client SQLNET.ORA
======================================================
# sqlnet.ora Network Configuration File: C:\Oracle\product\10.1.0\Client_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (EZCONNECT, TNSNAMES)
Server TNSNAMES.ORA
======================================================
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.1.0/db_1/n
etwork/admin/tnsnames.ora
# Generated by Oracle configuration tools.
DEV10G =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = attila.n3kje.net)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = DEV10G)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
Server LISTENER.ORA
======================================================
# listener.ora Network Configuration File: /u01/app/oracle/product/10.1.0/db_1/n
etwork/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.1.0/db_1)
(PROGRAM = extproc)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = attila.n3kje.net)(PORT = 1521))
Results from the TNSPING command issued at the client
=================================================================
C:\>tnsping prdsrr
TNS Ping Utility for 32-bit Windows: Version 10.1.0.2.0 - Production on 02-APR-2
004 09:26:11
Copyright (c) 1997, 2003, Oracle. All rights reserved.
Used parameter files:
C:\Oracle\product\10.1.0\Client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.1.10)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = dev10g)))
TNS-12541: TNS:no listener
C:\>tnsping oracle10g
TNS Ping Utility for 32-bit Windows: Version 10.1.0.2.0 - Production on 02-APR-2
004 09:26:38
Copyright (c) 1997, 2003, Oracle. All rights reserved.
Used parameter files:
C:\Oracle\product\10.1.0\Client_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.1.10)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVI
CE_NAME = DEV10G)))
TNS-12541: TNS:no listener
C:\>
Trying to connect to the database from the server
==================================================
[oracle@attila bin]$ echo $ORACLE_SID
DEV10G
[oracle@attila bin]$ ./sqlplus system
SQL*Plus: Release 10.1.0.2.0 - Production on Fri Apr 2 12:22:29 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Pr
oduction
With the Partitioning, OLAP and Data Mining options
[oracle@attila bin]$ ./sqlplus system@dev10g
SQL*Plus: Release 10.1.0.2.0 - Production on Fri Apr 2 12:23:09 2004
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
tnsping issued at the server
======================================================
[oracle@attila bin]$ tnsping dev10g
TNS Ping Utility for Linux: Version 10.1.0.2.0 - Production on 02-APR-2004 12:3
:44
Copyright (c) 1997, 2003, Oracle. All rights reserved.
Used parameter files:
/u01/app/oracle/product/10.1.0/db_1/network/admin/sqlnet.ora
TNS-03505: Failed to resolve name
What am I doing wrong?
Thanks
RenatoOk, I was able to succesfully connect to the database from the client. I made the following changes to the sqlnet.ora, tnsnames and listener. Here are the changes I made:
sqlnet.ora
==============================
# SQLNET.ORA Network Configuration File: /u01/app/oracle/product/9.2.0.1.0/netwo
rk/admin/sqlnet.ora
# Generated by Oracle configuration tools.
# NAMES.DIRECTORY_PATH= (EZCONNECT)
NAMES.DIRECTORY_PATH= (EXCONNECT, TNSNAMES, ONAMES, HOSTNAME)
listener.ora
==============================
# listener.ora Network Configuration File: /u01/app/oracle/product/10.1.0/db_1/n
etwork/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.1.0/db_1)
(PROGRAM = extproc)
(SID_DESC =
(GLOBAL_DBNAME = DEV10G)
(ORACLE_HOME = /u01/app/oracle/product/10.1.0/db_1)
(SID_NAME = DEV10G)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
tnsnames.ora
===========================================
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.1.0/db_1/n
etwork/admin/tnsnames.ora
# Generated by Oracle configuration tools.
DEV10G =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.10)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = DEV10G)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
Here is the new problem!
I start the dbconsole using the folowing command:
[oracle@attila bin]$ ./emctl start dbconsole
TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.1.0.2.0
Copyright (c) 1996, 2004 Oracle Corporation. All rights reserved.
http://attila.n3kje.net:5500/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control ........................
... started.
Logs are generated in directory /u01/app/oracle/product/10.1.0/db_1/attila.n3kje
.net_DEV10G/sysman/log
When I try and access it from the client I get the following error message:
"The database status is currently unavailable. It is possible that the database is in mount or nomount state. Click 'Startup' to obtain the current status and open the database. If the database cannot be opened, click 'Perform Recovery' to perform an appropriate recovery operation."
What am I doing wrong this time?
Your help would be greatly appreciated
Thanks
Renato -
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?
Maybe you are looking for
-
How can I add dots after text to fill the remaining space in a table cell?
What is the most efficient way to add dots after text to fill the remaining space in a table cell? I know it is possible using tabs but is this possible using a table?
-
HT1349 How to send my iPod touch applications to my iPad 2
How to send my iPod touch application to my iPad 2
-
Is there a way to get the cover wall (in music app) in ipad as it is for the iphone?
Hi there Is there a way to have the cover wall in the ipad ios7 as it is in the iphone? (This is a very convenient way to browse a library) Thanks
-
OS 5.0.1 Update Causing SIM Failure?
I updated my OS 5.0 to the new 5.0.1 yesterday and ever since I get these messages "SIM Failure". My phone goes to "No Service" and I have to turn the phone off and back on again to get service. Is anyone else having trouble with this and, if so, doe
-
WHEN TRYING TO PURCHASE FROM iTUNES I ALWAYS RECEIVE A POP-UP "COULD NOT PURCHASE (NAME OF SONG) A REQUIRED iTUNES COMPONENT IS NOT INSTALLED (-43404) TRY AGAIN. EXPERIENCED THIS DURING FALL OF 2012 AND HAD NO SATISFACTION AND AFTER A PERIOD OF 4-6