restructure connection string for Azure

al4629740
al4629740 used Ask the Experts™
on
In order to open a connection on my VB6 app, I use the following info:

Set conn = New ADODB.Connection
Set rec = New ADODB.Recordset


conn.Open "Provider=sqloledb;Data Source=" & ConnectionIP & ",1433;Network Library=DBMSSOCN;Initial Catalog= xxxxxxxx; User ID=xx;Password=xxxx"

However, if I was going to use Microsoft Azure SQL database, I will need to change this connection string.  They provide  ADO.NET, JDBC, ODBC and PHP connection strings.  None of those are similar to what I'm using now, so what changes would I have to make in order to make this connection work?  I'm guessing that ODBC would be the choice which looks like this:

Driver={ODBC Driver 13 for SQL Server};Server=tcp:xxxxxxx,1433;Database=xxxxx;Uid=xxxxxx;Pwd={your_password_here};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;


How would I structure this in VB6 to connect?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Pawan KumarDatabase Expert
Awarded 2016
Top Expert 2016

Commented:
For any connection string related issues please refer -

https://www.connectionstrings.com/
IT Engineer
Distinguished Expert 2017
Commented:
Do you have access to the SQL Azure subscription where the database is? If so you can get the connection string from there and it even allows you to copy it so you can paste it in your application:
SQLAzure_ConnectionString.PNG
But basically is something like this:
Server=tcp:sqlazureservername.database.windows.net,1433;Initial Catalog=SQLAzureDBname;Persist Security Info=False;User ID={your_username};Password={your_password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

Author

Commented:
What changes here?

Set conn = New ADODB.Connection
Set rec = New ADODB.Recordset
Vitor MontalvãoIT Engineer
Distinguished Expert 2017

Commented:
Nothing. What changes is the line where you set the connection string.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial