VS 2010 & Oracle 11g ORA 12514 - c#

I knew, there are thousands of topics similar to mine. I read them all. Nothing works for me. And there I will describe my problem: I created a Oracle database using Oracle SQL developer setting values:
connection name: test,
username: bob,
password: qwerty
Connection type: basic,
role: default,
Hostname: localhost,
port: 1521,
SID : orcl
Reason I'm writing all of this is that I really did everything possible, and I hope that by providing each kind of data someone will be able to help me.
My next step was downloading and installing ODAC 11.2 Release 4 (11.2.0.3.0) with Oracle Developer Tools for Visual Studio.
When I want make a connection to database from my application using server explorer I'm entering following data:
data source name: //localhost:1521/test
user name: ADMIN
password : qwerty
connection name is being set automatically.
When I'm trying to test connection I'm getting ORA 12514... and here it is how I changed my tnsname.ora:
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
orcl =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)

Make sure of the following:
Oracle service is running on windows.
Your pfile or spfile has local_listener='LISTENER_ORCL'
change the orcl config in tnsname.ora as :
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

Related

ERROR: Unable to connect to any of the specified MySQL hosts - Synology NAS - MariaDB 10 - C#

I have a problem to connect my C# application in Visual Studio 2019 to Database inside Snyology NAS using MariaDB 10. If I connected the Database with HeidiSQL works good, but if I try to connect C# App with the same credentials I see an error like this:
"Unable to connect to any of the specified MySQL hosts"
I tried to check and I verified that:
TCP functionality is enable on Synology NAS
User and password are correct and I have all the privileges
Database name is correct
Port is also correct 3307 (setting default on Synology)
This is the code that I use to check the connection:
string connectionString = "";
string server = "ip_address_NAS:3307";
string database = "my_Database";
string username = "my_user";
string password = "my_password";
MySql.Data.MySqlClient.MySqlConnection cn;
connectionString = "SERVER=" + server + ";DATABASE=" + database + ";UID=" + username + ";PASSWORD=" + password;
try
{
cn = new MySql.Data.MySqlClient.MySqlConnection(connectionString);
cn.Open();
label1.Text = "Database ONLINE!";
label1.ForeColor = System.Drawing.Color.Green;
cn.Close();
}
catch(Exception ex)
{
label1.Text = "Database OFFLINE!\n" + ex.Message;
label1.ForeColor = System.Drawing.Color.Red;
}
Why this error?
Can you help me? please.
Thank you.
Remove the port number from the hostname. If you are connecting to the default port, there's no need to specify a port. If you are connecting to a custom port, it has to be defined in the following way
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword
Docs
Edit
3307 is not the default port for MySQL or MariaDB. So if your database is running on port 3307 (because for whatever reason Synology has chosen it to be the initial setting) you need to specify that port in the connection string. But not as part of the servername but with the Port=3307 property.

Connect Sap B1 hana with C# Application using DI API

I am Trying to Connect MY Sap B1 HANA on C# Web Based Application using DI API but my connection is giving me error. Here is Error Screenshot Failed to Connect SLD,make Sure Your SLD Server is Available and Connected. Any Relevant Help would be Appreciated.
try{
oCompany.CompanyDB = "***";
oCompany.Server = "***";
oCompany.LicenseServer = "***:30015";
oCompany.SLDServer = "***:40000"; //
oCompany.DbUserName = "****"; //
oCompany.DbPassword = "****"; //
oCompany.UserName = "****"; //
oCompany.Password = "****"; //
oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_HANADB;
oCompany.UseTrusted = false;
int res = oCompany.Connect();
string errMsg = oCompany.GetLastErrorDescription();
int ErrNo = oCompany.GetLastErrorCode();
if (ErrNo != 0)
{
value1 = errMsg;
return errMsg;
}
else {
value1 = "Succes Connection To Sap B1 Hana";
return value1;
}
You must include the port number in the server. Usually, the port number is 30015.
you can also use below mention code.
SAPbobsCOM.Company oCompany = new SAPbobsCOM.Company();
oCompany = (SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany();
The following connection code should get you a step further:
// The actual database host
// With HANA the single-tenancy port 30015 needs to be provided together with the host (not so with MSSQL)
// When using HANA multi-tenancy the instance is prefixed and the port changed: INSTANCE#DB-HOST:30013
// OR the correct instance port needs to be provided, eg. DB-HOST:30017
sboCompany.Server = "DB-HOST:30015";
// The company database/schema name
// With MSSQL the instance is provided here like: INSTANCE\DB_NAME
sboCompany.CompanyDB = "SCHEMA";
// SLDServer is the new LicenseServer, don't forget the port with HANA
// Be aware: use either hostname or IP of SLD everywhere
sboCompany.SLDServer = "SLD-HOST:40000";
// Hell knows why the version needs to be provided for MSSQL...
sboCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_HANADB;
// DB credentials when using MSSQL authentication or HANA
sboCompany.UseTrusted = false;
sboCompany.DbUserName = "SYSTEM";
sboCompany.DbPassword = "password";
// SBO credentials
sboCompany.UserName = "manager";
sboCompany.Password = "password";
The next problems might be missing or wrong HANA drivers... your journey just began ;-)

Can`t Permit Microsoft.SqlServer.Management.Smo.Server via database permission

Can anyone plz explain which special permission require for doing Microsoft.SqlServer.Management.Smo.Server connection via server and client both end.
i have following scenario.
server PC With Sql Server 2012 database
client PC With Only Program Which will connect database of server
i successfully got the db connection via visual stdio sqlconnectin class of remote database
but when i use Microsoft.SqlServer.Management.Smo.Server it will thrwo error for permission
can anyone help?
var connectionString = ConfigurationManager.ConnectionStrings["AppConString"].ConnectionString;
SqlConnectionStringBuilder sqlconstrbldr = new SqlConnectionStringBuilder(connectionString.ToString());
ServerConnection connection = new ServerConnection();
Microsoft.SqlServer.Management.Smo.Server sqlServer = new Microsoft.SqlServer.Management.Smo.Server(sqlconstrbldr.DataSource);
ServerName = sqlconstrbldr.DataSource;
foreach (Microsoft.SqlServer.Management.Smo.Database dbServer in sqlServer.Databases)
{
if (dbServer.Name.StartsWith("AMCS"))
{
string year = dbServer.Name;
year = year.Substring(4);
string Fyear = year.Substring(0, 2);
string Lyear = year.Substring(2);
Fyear = "20" + Fyear;
Lyear = "20" + Lyear;
string dbYear = Fyear + " - " + Lyear;
cmbDbYear.Items.Add(dbYear);
}
}
Explaination
cmbDbYear is Just Combobox in which all database names will be bonded.
MY Question is That What Remission Needed for SQL Server Management Object (Microsoft.SqlServer.Smo) must required for SQL Server Database user to successfully perform operation
i can Do Normal Database Operation currently but want also SQL Server Management Object (Microsoft.SqlServer.Smo) on database.

Why i get ORA-12504 error in my connection string?

I'm beginner in oracle,want to connect oracle database with c# windows appliation
but why i try connect database i get this error:
my listener file is this:
MYLISTNER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-A5CFJSH)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_MYLISTNER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\BEHZAD-HUSH\product\11.2.0\dbhome_2)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\BEHZAD-HUSH\product\11.2.0\dbhome_2\bin\oraclr11.dll")
)
)
ADR_BASE_MYLISTNER = C:\app\BEHZAD-HUSH
and my tnsnames file is:
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
What happen?How can i solve that?thanks.
my tns ping is:
TNS Ping Utility for 64-bit Windows: Version 11.2.0.1.0 - Production on 02-NOV-2015 15:42:22
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\app\BEHZAD-HUSH\product\11.2.0\dbhome_2\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))) (CONNECT_DATA = (SID = CLRExtProc) (PRESENTATION = RO)))
TNS-12541: TNS:no listener
Server name should be from TNS (ORACLR_CONNECTION_DATA), not localhost.
EDIT:
TNS-12541: TNS:no listener
Check that tns listener is running.
CMD> lsnrctl
LSNRCTL> start
Before you start to develop application, you must first check database connection over tnsping/sqlplus. Only after you have successfully connected you can move forward.
If listener is curently runnig, you cant try to connect over tcp/ip, not over IPC (after changing tns connection string in tnsnames.ora) on this -
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = DESKTOP-A5CFJSH) (PORT = 1521))
(CONNECT_DATA = (SID = CLRExtProc))
)
TNS is a real double-edged sword. When it works, it works great, but if you don't have any control over the client machine where you are deploying an app, you may want to just skip it and connect directly.
Fortunately, Oracle came up with ezConnect, which dramatically simplifies connection strings. It's essentially:
server/port:service name (or SID)
By explicitly specifying the elements normally encapsulated in TNSNAMEs, you eliminate any chances that the target machine has a different definition for that TNS name or worse, no definition at all.
Or, if you use the Direct=true, you can still bypass TNSnames and explicitly spell out the server, port and service name:
String conString = String.Format("Direct=true;Server={0};" +
"Port={1};Service Name={2};User Id={3};Password={4};",
"myhost.foo.bar", 1521, "oraprod", "scott", "tiger");
or using the SID (I can never remember which works, so I try both):
String conString = String.Format("Direct=true;Server={0};" +
"Port={1};SID={2};User Id={3};Password={4};",
"myhost.foo.bar", 1521, "oraprod", "scott", "tiger");
and then:
OracleConnection conn = new OracleConnection(constring);
conn.Open();
(with appropriate error trapping, of course).
That was more info than you asked for, but the bottom line is when you are establishing the connection, I would use this as the "Server Name" in your dialog:
DESKTOP-A5CFJSH:1521/CLRExtProc

ORA-12533: TNS:illegal ADDRESS parameters

I'm trying to open an OracleConnection on Visual Studio (c#) to join a Database with this command:
OracleConnection conn = new OracleConnection("Data Source=((DESCRIPTION=(ADDRESS_LIST =(ADDRESS=(PROTOCOL=tcp)(HOST=XX.XXX.X.XXX)(PORT=XXXX)))(CONNECT_DATA=(SERVICE_NAME=DEPL_D)(SERVER=xxxxx0xx)));User Id=X_XXX_XXX; Password=XXXXXXXXXX");
conn.Open();
my tnsnames.Ora contains the connection string like this:
DEPL_D.WORLD=
(DESCRIPTION=
(ADDRESS_LIST =
(ADDRESS=
(PROTOCOL = tcp)
(HOST = XX.XXX.X.XXX)
(PORT = XXXX)
)
)
(CONNECT_DATA =
(SERVICE_NAME = DEPL_D)
(SERVER = XXXXXXXXXX)
)
)
On the conn.Open(); I have the message ORA-12533: TNS: illegual ADDRESS parameter
After having searched on the net, It seems it's a problem on my tnsnames.oRA
I have done a test SQL+ with the administrator of the database (on audio) and it works. But It doesn't with visual studio.
If anybody has any idea, everything can helps.
Thanks in advance,
Greetings,
Flo
EDIT1:
I have tried to edit the (CONNECT_DATA =
(SERVICE_NAME = DEPL_D)
(SERVER = XXXXXXXXXX)
) with (CONNECT_DATA =
(SID=DEPL_D) but it doesn't works too.
Guessing from what you've provided: The SERVICE_NAME in the connect string is not the same SERVICE_NAME from your tnsnames.ora file.
Also, why did you censor the SERVER parameter ? Only possible values are SHARED, DEDICATED or POOLED. No ip address or hostname here.

Categories

Resources