Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot connect to oracle using datadirect JDBC driver

 
Graham Thorpe
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello ,
can anybody help me here i got a problem
in connecting to oracle using datadirect jdbc driver.
this is the code i wrote below
import java.sql.*;
import java.util.*;
import java.io.*;
public class connect
{
public static void main(String args[])
{
try{
Class.forName
("com.ddtek.jdbc.oracle.OracleDriver");
Connection
con=DriverManager.getConnection
("jdbc dtek racle://localhost:1521;User=scott
;Password=tiger");
System.out.println("Connected...!"+con);
}
catch(Exception e)
{
System.out.println("Exception is :"+e);
}
}}
the error i found is :
----------------------
Exception is : java.sql.SQLException: No suitable driver
as i already have the oracle driver class when
i downloaded datadirect driver com\ddtek\jdbc\oracle\oracledriver.class
Ur response is highly appreciated...
thank u..
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
glkrrr
I asked you read our naming policy yesterday. Please do so now and change you display name. Or we'll be forced to lock your account and you'll have to reregister completely.
Thanks
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as your error message it sounds like there are no drivers you have loaded that are recognizing the jdbc url you're trying to connect to. Check out the documentation for the driver and see what it is looking for in a URL.
 
Graham Thorpe
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u mr. dave..
i already had oracle driver in my classpath
as it comes along with datadirect jdbc driver
and i got no compilation error but giving run
time error.
well, it works fine with sql server when url
of my code is as below:
Class.forName("com.ddtek.jdbc.sqlserver.SQLServerDriver");
Connection con=DriverManager.getConnection("jdbc atadirect:sqlserver://glkrr:1433;User=sa");
but whereas for Oracle its giving runtime error as
no suitable driver for this code below:
Class.forName("com.ddtek.jdbc.oracle.OracleDriver");
Connection con=DriverManager.getConnection("jdbc atadirect racle://localhost:1521;User=scott;Password=tiger");
where my SID=ORCL so, where can i use ORCL string to place. is it in place of localhost..? or where
thanks for the response.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic