Reputation: 71
I've an oracle[11g] database on a remote Server(on LAN). How to configure oracle jdbc drivers then how to connect with my database. I've tried a lot of code samples but nothing worked. I just want to read some data from table and put it into an access(.accdb) file. regards
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Oracle Drivers loaded");
String dburl="jdbc:oracle:thin:@[ip goes here]:xe";
String user="reportuser"; String pwd="report";
Connection conn=null;
conn=DriverManager.getConnection(dburl,user, pwd);
Statement stmt=conn.createStatement();
}
catch(ClassNotFoundException e){
System.out.println("There is an Error in Connection "+e);
}
Upvotes: 0
Views: 92
Reputation: 303
The question is too generic on scenario on how exactly you are connecting to database.
If you are using eclipse for your java development you can configure jpa in your project and define url(your lan machine ip where DB is running) user name and password. Set the jar in the path.
if you are not using eclipse then open ODBC datasource administrator (use odbcad32.exe in Run) Make sure you have appropriate driver for Oracle over there
Or if you downloaded the jar then just copy the jar in the lib folder.
Upvotes: 1