cancel
Showing results for 
Search instead for 
Did you mean: 

How to dynamically pass parameters to SimbaDSN in code

Quinnche
Discoverer
0 Kudos

How to dynamically pass parameters to SimbaDSN in code ,For example, passing "key file path" as a dynamic parameter?

Quinnche_1-1712799588677.png

Quinnche_2-1712799643100.png

 

 

 

View Entire Topic
DellSC
Active Contributor
0 Kudos

Are you getting an error when you run you try to set up the ODBC DSN?  When you run your code?  If so, what is the error message?

Passing parameters to the report should not be any different than with any other type of data connection.  However, I don't see in the supported platforms document that Crystal supports connections to Google BigQuery, so you probably won't be able to use that for data in Crystal.

-Dell

Quinnche
Discoverer
0 Kudos

Dear Dell,

I tried using DSN-Less but it doesn't work. I put the "key file path" in the connection string

such as :

.Servername = "Driver={Simba ODBC Driver for Google BigQuery};OAuthMechanism=0;Email=your-service-account@your-project.iam.gserviceaccount.com;KeyFilePath=path\to\your\service-account-key-file.json;Catalog=your-project-id;"

Quinnche_0-1712892534604.png

 

But I set the Connection String in the crystal report tool and it can connect to the big query and get the data.

such as :

Quinnche_1-1712892298649.png

 

 

Quinnche
Discoverer
0 Kudos
Dear Dell,There are no errors and it works when running the code using Simba ODBC.I want to pass "key file path" as a parameter instead of setting it in simba UI. "key file path" is a json and is the authentication key of GCP.
DellSC
Active Contributor
0 Kudos

Is there a JDBC driver available? If so, you could use that and configure the key file path as part of that connection string. That's the only way I can think of to be able to pass that value.  You can't use a parameter to pass information like this to the connection.

Also, just because you have a working connection does not mean that SAP will actually support connecting to that type of database.  If it's not in the Data Sources documentation (https://help.sap.com/docs/link-disclaimer?site=https%3A%2F%2Fassets.cdn.sap.com%2Ftools%2Fsap-cr-202...) then it's not officially supported.

-Dell

Quinnche
Discoverer
0 Kudos
Dear Dell, How to useing JDBC driver in Visual Basic?Is there any documents or example?
DellSC
Active Contributor
0 Kudos

First, set up the connection in the report itself instead of in code. It will ask for a URL as part of the configuration for the JDBC connection.  If you'll only ever use that connection for the report, you should then be able to just set the credentials to log in to the database in order to get the report to run.

If you need to be able to change the connection, I would debug your application and look at the properties of the report connection to find where you need to set the URL for JDBC.

-Dell