jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes getting connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "getting connection" Watch "getting connection" New topic
Author

getting connection

steffy john
Greenhorn

Joined: Sep 07, 2001
Posts: 25
Hi,
I do have Personal oracle installed in my machine.
Now I log in that using scott and tiger.
I want to get connected to the same using the foillowing code:
con = DriverManager.getConnection("jdbc racle:thin:@machinename:1521:","scott","tiger");
But I am not getting a connection.
Can anyone correct me ?
Steff
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Hi,
java.util.Properties props = new java.util.Properties();
props.put("user", "your_user");
props.put("password", "the_password");
java.sql.Driver d = (java.sql.Driver)Class.forName("oracle.jdbc.driver.OracleD
river").newInstance();
java.sql.Connection conn = d.connect("jdbc racle:thin:@HOST_ADRESS:PORT:ORACLE",
p
rops);
OR:

Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
java.sql.Connection conn =
Driver.connect("jdbc racle:thin:@HOST_ADRESS:PORT:ORACLE", "user", "password");
OR:

java.util.Properties props = new java.util.Properties();
props.put("user", "your_username");
props.put("password", "the_password");
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
java.sql.Connection conn =
Driver.connect("jdbc racle:thin:@HOST_ADRESS:PORT:ORACLE", props);
regards.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting connection