File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Type-2 Driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Type-2 Driver" Watch "Type-2 Driver" New topic
Author

Type-2 Driver

shailendra vasale
Ranch Hand

Joined: Dec 17, 2000
Posts: 38
Hi all !
Can any help me out for connecting type-2 driver with oracle,I have installed oracle8 personal edition in my computer its working well with odbc(Type one).I have set classpath for OrcaleDriver.
But while using type-2
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc racle:MyDb","scott","tiger");
it throws following exception:
java.sql.SQLException:Sub Protocol must be specified in connection URL
Thankx in advance.

Shailendra.
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
Originally posted by shailendra vasale:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc: oracle:MyDb","scott","tiger");
it throws following exception:
java.sql.SQLException:Sub Protocol must be specified in connection URL

Yeah, its obviously throws exception. I guess ur using OCI drivers.what is MyDb.
The format should be
protocol:sub-protocol:driver-type:user-name: pwd

jdbc: oracle:driver-type:user/password@database
For a detailed explanation, follow the link,
Goto Oracle .

HTH..
Anil

[This message has been edited by Anil Vupputuri (edited June 14, 2001).]
[This message has been edited by Anil Vupputuri (edited June 14, 2001).]


SCJP 1.5, SCEA, ICED (287,484,486)
vaibhav punekar
Ranch Hand

Joined: Jan 20, 2001
Posts: 134
I think you just replaced JDBC:ODBC with JDBC:ORACLE keeping DSN name as it is.What Anil suggests is right.There is no DSN name as such Instead we have driver type.


VAIBHAV <BR>SCJP
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Type-2 Driver
 
Similar Threads
J2EE + MS SQL SERVER
Establishing Connections to a Data base on a different machine
type 4 jdbc driver
Make JDBC and JBuilder work together?
Can't run a JSP page due to error 500