pyodbc conn string formatConverting string into datetimeIs there a way to substring a string?Does Python have a string 'contains' substring method?Python string formatting: % vs. .formathow connect to vertica using pyodbcHow to connect to Netezza/PureData for Analytics using PythonHow to escape character '{' in string method format()?Python - Pyodbc for SQL Anywhere 16?pyodbc DSN - connection to SQL Server without UID and PWD in connection stringHow to connect python with mysql database using pyodbc API?

Why the "ls" command is showing the permissions of files in a FAT32 partition?

Review your own paper in Mathematics

Air travel with refrigerated insulin

Why would five hundred and five be same as one?

How to make a list of partial sums using forEach

What is the smallest number n> 5 so that 5 ^ n ends with "3125"?

Sound waves in different octaves

ContourPlot — How do I color by contour curvature?

Mimic lecturing on blackboard, facing audience

Does Doodling or Improvising on the Piano Have Any Benefits?

Deciphering cause of death?

How to test the sharpness of a knife?

SOQL query causes internal Salesforce error

The Digit Triangles

Typing CO_2 easily

Sigmoid with a slope but no asymptotes?

What the heck is gets(stdin) on site coderbyte?

What in this world is she trying to say?

Ways of geometrical multiplication

How to I force windows to use a specific version of SQLCMD?

What should be the ideal length of sentences in a blog post for ease of reading?

Given this phrasing in the lease, when should I pay my rent?

Giving feedback to someone without sounding prejudiced

Would a primitive species be able to learn English from reading books alone?



pyodbc conn string format


Converting string into datetimeIs there a way to substring a string?Does Python have a string 'contains' substring method?Python string formatting: % vs. .formathow connect to vertica using pyodbcHow to connect to Netezza/PureData for Analytics using PythonHow to escape character '{' in string method format()?Python - Pyodbc for SQL Anywhere 16?pyodbc DSN - connection to SQL Server without UID and PWD in connection stringHow to connect python with mysql database using pyodbc API?













0















I come from C# background, with SqlClient connection strings to Microsoft SQL server looks like this:



Data Source=somedbserver.com;Initial Catalog=MyAppDb;User Id=someServiceAcct;Password=myDirtySecret


I managed to connect also from python using pyodb - but connection string format different.



connstr = "driver=SQL Server;server=somedbserver.com;database=MyAppDb;uid=someServiceAcct;pwd=myDirtySecret"
connection = pyodbc.connect(connstr)


The question I want to ask is: Can python use the kind of connection strings we used in C#SqlClient?
Reason i am asking is: Our firm - connection strings all stored in env variables and they are those in C# format. I want to avoid add new env variables for same database connection simply because looks pyodbc conn string format is different.



Thanks










share|improve this question






















  • You could parse the ENV string to extract the information and then format the string to match what python expects.

    – Ubica
    Mar 7 at 2:54















0















I come from C# background, with SqlClient connection strings to Microsoft SQL server looks like this:



Data Source=somedbserver.com;Initial Catalog=MyAppDb;User Id=someServiceAcct;Password=myDirtySecret


I managed to connect also from python using pyodb - but connection string format different.



connstr = "driver=SQL Server;server=somedbserver.com;database=MyAppDb;uid=someServiceAcct;pwd=myDirtySecret"
connection = pyodbc.connect(connstr)


The question I want to ask is: Can python use the kind of connection strings we used in C#SqlClient?
Reason i am asking is: Our firm - connection strings all stored in env variables and they are those in C# format. I want to avoid add new env variables for same database connection simply because looks pyodbc conn string format is different.



Thanks










share|improve this question






















  • You could parse the ENV string to extract the information and then format the string to match what python expects.

    – Ubica
    Mar 7 at 2:54













0












0








0








I come from C# background, with SqlClient connection strings to Microsoft SQL server looks like this:



Data Source=somedbserver.com;Initial Catalog=MyAppDb;User Id=someServiceAcct;Password=myDirtySecret


I managed to connect also from python using pyodb - but connection string format different.



connstr = "driver=SQL Server;server=somedbserver.com;database=MyAppDb;uid=someServiceAcct;pwd=myDirtySecret"
connection = pyodbc.connect(connstr)


The question I want to ask is: Can python use the kind of connection strings we used in C#SqlClient?
Reason i am asking is: Our firm - connection strings all stored in env variables and they are those in C# format. I want to avoid add new env variables for same database connection simply because looks pyodbc conn string format is different.



Thanks










share|improve this question














I come from C# background, with SqlClient connection strings to Microsoft SQL server looks like this:



Data Source=somedbserver.com;Initial Catalog=MyAppDb;User Id=someServiceAcct;Password=myDirtySecret


I managed to connect also from python using pyodb - but connection string format different.



connstr = "driver=SQL Server;server=somedbserver.com;database=MyAppDb;uid=someServiceAcct;pwd=myDirtySecret"
connection = pyodbc.connect(connstr)


The question I want to ask is: Can python use the kind of connection strings we used in C#SqlClient?
Reason i am asking is: Our firm - connection strings all stored in env variables and they are those in C# format. I want to avoid add new env variables for same database connection simply because looks pyodbc conn string format is different.



Thanks







python pyodbc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 2:50









user3761555user3761555

368




368












  • You could parse the ENV string to extract the information and then format the string to match what python expects.

    – Ubica
    Mar 7 at 2:54

















  • You could parse the ENV string to extract the information and then format the string to match what python expects.

    – Ubica
    Mar 7 at 2:54
















You could parse the ENV string to extract the information and then format the string to match what python expects.

– Ubica
Mar 7 at 2:54





You could parse the ENV string to extract the information and then format the string to match what python expects.

– Ubica
Mar 7 at 2:54












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55035297%2fpyodbc-conn-string-format%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55035297%2fpyodbc-conn-string-format%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

Алба-Юлія

Захаров Федір Захарович