473,545 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle JDBC Connection Problem

8 New Member
Please go through the JAVA code below:
Expand|Select|Wrap|Line Numbers
  1. class Main{
  2. public Connection getConnection(){
  3.         Connection l_con = null;
  4.         try {
  5.             String hostname = "172.10.23.1:1527";    //Host IP:port No
  6.             String dbsid = "TESTSID";            //SID Name or Service Name
  7.             String username = "TESTUSER";    //Database user
  8.             String password = "password";        //User password
  9.             String connectingString = "jdbc:oracle:thin:@" + hostname + ":" + dbsid; 
  10.  
  11.             DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
  12.             l_con = DriverManager.getConnection(connectingString,username,password);
  13.  
  14.         } catch (SQLException ex) {
  15.             Logger.getLogger(SQLUtil.class.getName()).log(Level.SEVERE, null, ex);
  16.         }
  17.         return l_con;
  18.     }
  19.  
  20.  
  21.             public static void main(String s[]){
  22.             Main main= new Main();
  23.            Connection l_con = sqlutil.getConnection();              
  24. }
  25.  
  26. }
  27.  
  28.  
When I run the following code we found some error like that:

<ERROR>
java.sql.SQLExc eption: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
172.10.23.1:152 7:TESTSID
</ERROR>


Please give me the solution. Thank you.
Feb 23 '09 #1
1 4558
JosAH
11,448 Recognized Expert MVP
@Debabrata Jana
The error message says it all: it can't find the TESTSID service/database. Check the spelling, access rights etc.

kind regards,

Jos
Feb 23 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3132
by: Paul | last post by:
hi, i'm getting the following error when i try to run the code below to connect to an oracle db: java.lang.ClassnotfoundException:oracle.jdbc.driver.OracleDriver java.sql.SQLException No suitable driver. i'm using jdk1.4 installed on a Windows NT 2000 machine. I don't have any oracle client installed on my machine. I'm basically...
3
17861
by: David | last post by:
Hello all, I have been trying to use the OCI driver to connect to Oracle 9i, but have been getting the following error: java.sql.SQLException: Closed Connection at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at...
3
7533
by: hilz | last post by:
Hi all: I have an oracle 9i server running behind a firewall. i set up the machine that has the oracle server as a DMZ zone. i can connect to the oracle server from the local network but not from outside (using the oracle THIN driver) can anyone tell me what is the problem and how to solve it? thanks
1
10665
by: CM | last post by:
Hi, when i want connect me in my BD with a JSP (with this simple code), this exception is throw. Thank's for ur help Mathieu CODE of my JSP ---------------------
0
4733
by: JWM | last post by:
I am trying to implement Oracle connection pooling for the following code, which was written by someone else. Here is my main question -- this java file creates code that is executed every hour, but once per week, the oracle server is brought down for backup. At that time, I get an error that looks like I have the wrong credentials for the...
3
2476
by: owen | last post by:
Hi, I've been trying for ages to connect to my Oracle 9.2.0 database from Java. I am attempting to create a thin connection. The necessary drivers were installed with the database and I have all the relevant files under the folder C:\oracle\ora92\jdbc\lib Initially I had JDK 6 downloaded from Sun's website, but I didn't think it would...
2
14212
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers: Additional Array INSERT and SELECT Syntax Support by Pro*C/C++ and Pro*COBOL Precompilers: Dynamic SQL Statement Caching in Pro*C/C++ and Pro*COBOL ...
0
4077
by: anuptosh | last post by:
Hi, I have been trying to run the below example to get a Oracle Array as an output from a Java code. This is an example I have found on the web. But, the expected result is that the code should return me Array element type code 1, but it is returning me type code 12 and the array in a junk or unreadable format . Our environment is JDK 1.4,...
0
1586
by: Rauf Sarwar | last post by:
Originally posted by Nelson Broat Have you included Oracle jdbc driver in your classpath? Depending on your Oracle version, it would be ORACLE_HOME/jdbc/lib/classesXXX.zip or classesXXX.jar file. Regards /Rauf
0
7475
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3465
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1900
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
720
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.