JAVA DATABASE CONNECTIVITY
ORACLE:
Download ORACLE 21C
Open Ellipse
1. Create New Project and Select Java Project and Click ‘Finish’
2. Delete module-info,.java
[Link] jar File and Include in Build Path
Coding:
package ecomm;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class jdbc_conn {
public static void main(String[] args) throws IOException {
Connection conn1 = null;
try {
[Link]("[Link]");
conn1 = [Link]("jdbc:oracle:thin:@localhost:1521:xe","admin","admin123!");
if (conn1 != null) {
[Link]("Sucess ");
}
PreparedStatement psmt = [Link]("INSERT INTO EMP (ENAME) VALUES (?)");
BufferedReader br = new BufferedReader(new InputStreamReader([Link]));
int count =0;
while(true)
{
[Link]("Enter the Name");
String ename1 = [Link]();
[Link](1, ename1);
count = count +1;
if (count <= 3)
{
[Link](count+ " Record Inserted ");
}
else
{
[Link]("Total Racords Inserted "+count+"");
break;
}
count++;
}
}
catch (ClassNotFoundException ex) {
[Link]();
} catch (SQLException ex) {
[Link]();
} finally