ORA-17059 SQL Exception (Fixed)

50 views Asked by At

so while using Java JDBC I tried to make a Driver Connection to my database so i could run some code but i received this error:

java.sql.SQLException: ORA-17059: Failed to convert to internal representation
https://docs.oracle.com/error-help/db/ora-17059/

I checked if i could connect to the database in SQL Plus but I got another error:

ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Process ID: 0
Session ID: 0 Serial number: 0

code:

package com.hydrogen.UserProject;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class d {
    public static void main(String args[]) {
        try {
//step1 load the driver class  
            Class.forName("oracle.jdbc.driver.OracleDriver");
//step2 create  the connection object  
            Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "SYSTEM", "Admin123");

//step3 create the statement object  
            Statement stmt = con.createStatement();

//step4 execute query  
            ResultSet rs = stmt.executeQuery("select * from MyUsers");
            while (rs.next())
                System.out.println(rs.getInt(1) + "  " + rs.getString(2) + "  " + rs.getString(3));

//step5 close the connection object  
            con.close();

        } catch (Exception e) {
            System.out.println(e);
        }

    }
}
0

There are 0 answers