wood burning stoves 2.0*
The moose likes JDBC and the fly likes thin driver connection problem @thin: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "thin driver connection problem @thin:" Watch "thin driver connection problem @thin:" New topic
Author

thin driver connection problem @thin:

Rayudu addagarla
Ranch Hand

Joined: Aug 17, 2000
Posts: 39
hello i have some problem in connecting to the oracle server.
do i have to set any dsn in the 32odbc for type4 driver ir. thin driver. i guess no but please help me out.
is there anything to do with the string after the port number ie "ORCL" in getconnection. how to find out what my oracleserver uses here.
DriverManager.getconnection("....@thin:abc.edu:1521:ORCL","uid",pwd");
please help me
import java.sql.*;
import java.io.*;
/*
i have set the classpath and also set classpath to classes12.zip
*/
public class Mysql {
Connection con;
Statement st;
ResultSet rs;
String uid="scott";
String pwd="tiger";
public Mysql()
{
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc racle:thin:@spd.louisville.edu:1521:ORCL",uid,pwd);
System.out.println("connection established \n");
}catch(Exception e){System.out.println(e +"\n \n"); e.printStackTrace();}
}
public static void main (String args[])
{
Mysql ms=new Mysql();
System.out.println("\n IN MAIN after constructor invoked");
} //main
}//class
/* OutPut Errors
C:\CHAK\rayudu>javac Mysql.java
C:\CHAK\rayudu>java Mysql
java.sql.SQLException: Io exception: The Network Adapter could not establish the
connection
java.sql.SQLException: Io exception: The Network Adapter could not establish the
connection
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:323)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:260)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va, Compiled Code)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(DriverManager.java:457)
at java.sql.DriverManager.getConnection(DriverManager.java:137)
at Mysql.<init>(Mysql.java:14)
at Mysql.main(Mysql.java:20)
*/


Good luck for Certfication.
naga bush
Greenhorn

Joined: Jan 29, 2001
Posts: 7
Hi.,
The jdbc url for thin drivers is.
Connection con= DriverManager.getConnection(
"jdbc racle:thin:@dbhostname ort:sid","username","password").
SID stands for System Identifier. which identifies the specific oracle database instance to which you want to connect.
Are u using correct dbhostname,port,SID.username and password are according to software instalation.
I hope u r using oracle 8i .Along with this software u will get thin drivers.
To find the hostname and sid in oracle8.
go to
start -->programs -->oracle for winnt -->oracle net8 easy config
click that one. In Next screen give Yes.The next screen is
welcome to service name wizard.In that (Choose actions) select modify radio button and in (existing services) choose available servers(any one). Next screen is Select Networking Protocol
In that one choose tcp/ip. next screen is u will find out the dbhostname and port number. Note down the dbhostname and port and next screen is sid(system identifier).note down the sid.
In oracle8i
start-->programs-->oracle_default_home1 -->network administration
-->net8 assistant-->net 8 confifuration.
In this u will get local.Click the local,the service naming will appear. Click it u will get all the available service names.
Click any one , then u will get the service name, dbhostname,port.
If u have problem please ask your database administrator about the dbhostname,port,sid.
If u r working on oracle 8i the thin driver will be coming along with the software.i don't know about the oracle8.
The classpath what u have specified is o.k.,
All the best.
Inform if u got any problem regarding this.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: thin driver connection problem @thin:
 
Similar Threads
Oracle JDBC unable to get connection
JDBC Error
Connect to Oracle via JDBC using JSP..
Reconnecting to an oracle DB
Oracle 8i thin Driver problem