Results 1 to 1 of 1
Thread: JDBC and Oracle 10g
- 10-30-2011, 06:04 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 2
- Rep Power
- 0
JDBC and Oracle 10g
Hello ,
Im new to java . I'm trying to connect to my own Oracle 10g database ( Release 2 ) . But it isnt working .
import java.sql.*;
import oracle.*;
public class conectareSQL {
public static void main(String[] args) throws InstantiationException, IllegalAccessException {
Connection connection = null;
try {
// Load the JDBC driver
String driverName = "oracle.jdbc.driver.OracleDriver";
Class.forName(driverName);
// Create a connection to the database
String serverName = "robert-pc";
String portNumber = "5561";
String sid = "orcl2";
String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
String username = "Student1";
String password = "student";
connection = DriverManager.getConnection(url, username, password);
} catch (ClassNotFoundException e) {
System.err.println("Error could not find the datavase driver" + e);
// Could not find the database driver
} catch (SQLException e) {
// Could not connect to the database
System.err.println("Error Could not connect to the database " + e);
}
}
}
I get this error : Error Could not connect to the database java.sql.SQLException: Io exception: Bad packet type
Any help ?
Similar Threads
-
Querying in JDBC to oracle DB
By 123456.kiran in forum JDBCReplies: 6Last Post: 03-31-2011, 11:47 AM -
JDBC Oracle Connection
By Bean in forum New To JavaReplies: 13Last Post: 11-06-2009, 08:06 PM -
oracle JDBC java
By silia_motor in forum JDBCReplies: 4Last Post: 05-10-2009, 09:37 AM -
Jdbc Driver For Oracle
By Swamipsn in forum New To JavaReplies: 0Last Post: 08-14-2007, 04:31 AM -
Oracle and JDBC
By Eric in forum JDBCReplies: 3Last Post: 08-11-2007, 08:49 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks