• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with connection

 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
String url = "jdbc racle:thin:@:myDataSource";
con = DriverManager.getConnection(url, "scott", "tiger");
Now mydatasource is host,port,databasename Can anyone tell me how to find it out?
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could speak with your database administrator. Hostname is the computer name or IP address of the computer the database resides on. The default port for an Oracle database is 1521. The database name is, well the name of the database.
 
Dhanashree Mankar
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using oracle8,jdk1.4 and windows2000 server. I got oracle thin driver in itself.I unzipped classes111.zip and addded classes111.zip file in classpath. And i made the connection as folllows
String url = "jdbc racle:thin:@host123:1521 RCL";
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url, "scott", "tiger");
stmt = con.createStatement();
stmt.executeUpdate(createString);
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
But when i run this i am getting error as
F:\>java CreateCoffees
ClassNotFoundException: myDriver.ClassName
SQLException: No suitable driver
Can anyone tell me what is wrong in this?
 
Dhanashree Mankar
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dhanashree Mankar:
I am using oracle8,jdk1.4 and windows2000 server. I got oracle thin driver in itself.I unzipped classes111.zip and addded classes111.zip file in classpath.
But when i run this i am getting error as
F:\>java CreateCoffees
ClassNotFoundException: myDriver.ClassName
SQLException: No suitable driver
Can anyone tell me what is wrong in this?


-------------------------------------------------------------------------
Now i downloaded classes 12.zip and placed it in ORANT i.e oracle directoty and then unzipped it My classpath is as follows:
CLASSPATH=.;f:\j2sdk1.4.1_06\jre\lib\rt.jar;f:\ORANT\jdbc\lib\classes12.zip;f:\ORANT\jdbc\lib;
And path is:
PATH=f:\J2SDK1~1.1_0\bin;F:\ORANT\bin;F:\WINNT\system32;F:\WINNT;F:\WINNT\System
32\Wbem;F:\MSSQL7\BINN;c:\jdk1.4\bin;
But still same error is coming
plz help
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are having problems with setting classpath
Search for classes111.zip on your m/c and delete them.
Copy Classes_12.zip to your %JAVA_HOME%\jre\lib\ext

Alternately you could set it as:
set classpath=.;<location of the classes_12.zip>;%classpeth%
This should work.
 
Anurag Gupta
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are having problems with setting classpath
Search for classes111.zip on your m/c and delete them.
Copy Classes_12.zip to your %JAVA_HOME%\jre\lib\ext

Alternately you could set it as:
set classpath=.;<location of the classes_12.zip>;%classpath%
This should work.
 
Dhanashree Mankar
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone tell me what does this error mean?
F:\>java CreateCoffees
SQLException: Io exception: The Network Adapter could not establish the connection
 
Dhanashree Mankar
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my url:
String url = "jdbc racle:thin:@host123:1521 RCL";
This is my TNSNMAES.ORA entery:
CMEXAMPLE.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = host23)(PORT = 1521))
)
(CONNECT_DATA = (SID = ORCL))
(SOURCE_ROUTE = yes)
)
 
Dhanashree Mankar
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IT'S WORKING NOW
THANX
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic