
i have installed oracle 10g (both ee and xe) editions... while am installing i found port num as 1521 for ee, 1522 for xe.... and my program is......
import java.sql.*;
import java.io.*;
public class DBConnect{
public static void main(String ar[])throws SQLException{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println("driver is registered");
Connection con=
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1522:xe","lms","xyz");
System.out.println(con);
System.out.println("connection is established");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("insert into emp values(3,'c')");
while(rs.next()){
int eno=rs.getInt("eno");
System.out.println(eno);
String name=rs.getString("name");
System.out.println(name);
}
}
}...... while i run this prog.... i got error like
driver is registered
oracle.jdbc.driver.T4CConnection@929206
connection is established
Exception in thread "main" java.sql.SQLException: ORA-00942: table or view does
not exist
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1169)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:
1273)
at DBConnect.main(DBConnect.java:12)
E:\jdbcex>
and in sql i have create user lms and, table emp(eno, name).
please tell me wts the resolution for this problem....
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.