Click here to Skip to main content
15,508,200 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Quartz for .Net service that retrievs data from an Oracle 12c database using
System.Data.OracleClient
. I am able to connect and get values when attempting this from a Console application but once i migrate the code and bundle it into a Quartz scheduler service i get the error
Connection parameter not supported: 'DATABASE' 
when the job runs.

I have implemented the service on several Quartz.net jobs that connect to Sql Server without such issues. It appears this problem is particular to connection strings for the Oracle provider.

My Quartz service implementation is taken from the example here :

https://medium.com/better-programming/asp-net-core-windows-service-task-scheduler-daily-weekly-monthly-700a569d502a

and my connection string is as below :
C#
<pre><connectionStrings>
    <add name="FCUBS" connectionString="user id=MYUSERNAME;password=mypassword*;data source=10.167.67.667:6767/COMPANYLIVE" />   
  </connectionStrings>


and for context the accompanying query operation is :

C#
public static double GetExchangeRate()
        {
            var flex = new FrontOfficeTransaction();
            double rate = 0.00;
            try
            {
                using (OracleConnection connp = new OracleConnection(FCUBSConnection))
                {
                    connp.Open();
                    OracleCommand cmd1 = new OracleCommand("select * from fgpreprod.xxxx_rates where ccy4 in ('USD','GBP') AND ccy2 in ('USD','GBP') and branch_code='089' and RATE_TYPE='MIDRATE'", connp);
                    OracleDataReader dr1 = cmd1.ExecuteReader();
                    while (dr1.Read())
                    {                        
                        flex.ExchangeRate = Convert.ToDouble(dr1["MID_RATE"]);                       
                        rate = flex.ExchangeRate;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionLogging.SendErrorToText(ex);
            }
            return rate;
        }


What I have tried:

I have tried using Server instead of data source as per suggestions from some sources but im still getting the error :

C#
<pre><connectionStrings>
    <add name="FCUBS" connectionString="user id=MYUSERNAME;password=mypassword*;Server=10.167.67.667:6767/COMPANYLIVE" />   
  </connectionStrings>
Posted
Updated 17-Apr-21 21:42pm

1 solution

Often the connection details are defined in tnsnames.ora[^]. In such case you would use the name of the tnsnames.ora entry as your data source

You can also omit the tnsnames and define the full details in the connection string. Have a look at Oracle connection strings - ConnectionStrings.com[^]

In both cases you don't define a database separately since the connection target (host, port....) already is the database.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900