codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  How to connect to oracle using java  vsphanindra at 19:08 on Tuesday, May 10, 2005
 

Hi frns,

I am stuck with a problem.I could'nt connect to oracle.
I am using oracle8i fully installed.

I have included classes12.rar file to classpath.

do I need to install any drivers. or need to set any other path
plz let me know

feel free to contact me at vsphanindra@yahoo.com

"the error I am getting is "


package oracle.jdbc does not exist
Class.forName(new oracle.jdbc.OracleDriver());


and the code I used to connect to database is


// import Oracle.*;
import java.sql.*;
//import package oracle.jdbc ;

public class Data {
public static void main(String[] args) {
Class.forName(new oracle.jdbc.OracleDriver());
//Connection con =
//DriverManager.getConnection"jdbc:oracle:thin:@hostname:1526:orcl","scott","ti ger");


}
}




thnx in advance
phanindra.



  Re: How to connect to oracle using java  InteractiveMind at 11:40 on Tuesday, May 24, 2005
 

Hello,

check out the stuff here; http://www.javaalmanac.com/cgi-bin/search/find.pl?words=oracle

Good luck.
Rob.


  Re: How to connect to oracle using java  suresh.chv at 12:35 on Thursday, September 24, 2009
 

jdbc:oracle:thin:[<user>/<password>]@//<host>[:<port>]/<service>
Example below connects to Oracle Database instance using JDBC-Thin Type 4 Driver.

import java.sql.*;

public class getOracleConnection
{
public static void main(String[] args)
{
DB db = new DB();
Connection conn=db.dbConnect(
"jdbc:oracle:thin:@localhost:1521/test", "scott", "tiger");
}

}

class DB
{
public DB() {}

public Connection dbConnect(String db_connect_string,
String db_userid, String db_password)
{
try
{
DriverManager.registerDriver(
new oracle.jdbc.OracleDriver());

Connection conn = DriverManager.getConnection(
db_connect_string, db_userid, db_password);

System.out.println("connected");
return conn;

}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
};
-----------------------------------------
So this datya can help you .................








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
• C++
• Re: refresh parent after closing pop up window
• Dynamic Insertion
• Date and Time function around the world???
• Significant Factors
• Perl array access
• Re: huffman encoding and decoding in C++...
• Perl One Liner: Replace {(
• Re: html including php, accessing the functions


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009