Background Installed Oracle Database 21c Express Edition in WINDOWS 11 machine. Using Oracle SQL Plus created necessary tablespace and user with DBA privilege. Also configured tnsnames.ora. These are the command in SQL Plus.
/* Creating Tablespace*/
create tablespace ts_Trading DATAFILE 'D:\Database\OracleTest\ORATest.dbf'
size 10m
autoextend on maxsize 1024m
extent management local uniform size 64k
/* Creating User */
create user ####### identified by #######
default tablespace ts_Trading
temporary tablespace temp
quota unlimited on ts_Trading
quota 0 on system
/
grant DBA to #######
Successfully test the newly created username from SQL Plus using the following style (user name / password @ instance name) #######/*****@XE and it works.
Also successfully tested tnsping utility to test the connectivity of the Oracle client.
But failed to connect with Oracle from VB.net Application (.Net 6 framework with OracleManagedDataAccess.Core) Write the following code in windows form
Imports System.Data.OracleClient
Imports Oracle.ManagedDataAccess.Client
Imports Oracle.ManagedDataAccess.Types
Public Class frmOracle
Private Sub frmOracle_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim oradb As String = "Data Source=XE;User Id=#######;Password=*****;"
Dim conn As New OracleConnection(oradb)
conn.Open()
End Sub
End Class
It is raising the following error message (Oracle.ManagedDataAccess.Client.OracleException: 'ORA-12154: Cannot connect to database. Cannot find alias XE in DataSources, , EZConnect)
Do I need to do something more with configuring oracle? or, Anything else?
XEneeds to be resolved, usually this is done with thetnsadmin.orafile. SQL*Plus uses a different search path to find this file than ODP.NET Managed Driver does. See stackoverflow.com/questions/28280883/… Most likely you have to loot at this: docs.oracle.com/cd/E63277_01/win.121/e63268/…