1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5075],{4584:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/tools/sql-server-connection-string-builder",function(){return a(7662)}])},9824:function(e,t,a){"use strict";a.d(t,{A1:function(){return m},PU:function(){return x},V4:function(){return f}});var r=a(2676),n=a(5271),s=a(137),i=a.n(s),o=a(9965),c=a.n(o),l=a(4032),d=a(1831),u=a(3349),p=a(2427),h=a(6904);let m=e=>{let{label:t,value:a,onChange:s,placeholder:i,readOnly:o,rows:c=10}=e,[l,d]=(0,n.useState)(!1);return(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("label",{className:"text-sm font-semibold text-[#B8AFCA]",children:t}),o&&(0,r.jsx)("button",{type:"button",className:"text-xs px-3 py-1 rounded-full border border-[#3E30A8] hover:bg-[#3E30A8] transition-colors",onClick:()=>{navigator.clipboard.writeText(a),d(!0),setTimeout(()=>d(!1),1500)},children:l?"Copied!":"Copy"})]}),(0,r.jsx)("textarea",{className:"w-full rounded-[12px] bg-[#16151A] border border-[#2A2440] focus:border-[#3E30A8] focus:outline-none p-4 font-mono text-sm text-white",rows:c,value:a,onChange:e=>null==s?void 0:s(e.target.value),placeholder:i,readOnly:o,spellCheck:!1})]})},f=e=>{let{onClick:t,children:a}=e;return(0,r.jsx)("button",{type:"button",onClick:t,className:"px-6 py-2 rounded-full bg-[#3E30A8] hover:bg-[#4E40C8] transition-colors font-semibold",children:a})},x=e=>{let{label:t,value:a,onChange:n,options:s}=e;return(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm text-[#B8AFCA]",children:[t,(0,r.jsx)("select",{className:"bg-[#16151A] border border-[#2A2440] rounded-[8px] px-2 py-1 text-white",value:a,onChange:e=>n(e.target.value),children:s.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))})]})};t.ZP=e=>{let{slug:t,title:a,description:n,h1:s,intro:o,children:m,howTo:f,faq:x,afterTool:v}=e,b=h.K.filter(e=>e.slug!==t);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.Z,{title:a,description:n}),x&&x.length>0&&(0,r.jsx)(i(),{children:(0,r.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify({"@context":"https://schema.org","@type":"FAQPage",mainEntity:x.map(e=>({"@type":"Question",name:e.q,acceptedAnswer:{"@type":"Answer",text:e.a}}))})}})}),(0,r.jsxs)("div",{className:"min-h-screen flex flex-col pt-[80px] bg-black text-white",children:[(0,r.jsx)(l.Z,{}),(0,r.jsxs)("main",{className:"w-full max-w-5xl mx-auto px-4 md:px-8 flex-1",children:[(0,r.jsxs)("header",{className:"pt-10 pb-6 text-center",children:[(0,r.jsx)("h1",{className:"font-archivo-black text-3xl md:text-5xl font-bold mb-4",children:s}),(0,r.jsx)("p",{className:"text-[#9289A4] max-w-3xl mx-auto",children:o})]}),(0,r.jsx)("section",{className:"mb-10",children:m}),(0,r.jsxs)("section",{className:"my-12 rounded-[20px] border border-[#3E30A8] bg-[#16151A] p-8 text-center",children:[(0,r.jsxs)("h2",{className:"text-2xl font-bold mb-3",children:["Do more than ",s.toLowerCase()," â meet Chat2DB"]}),(0,r.jsx)("p",{className:"text-[#9289A4] max-w-2xl mx-auto mb-6",children:"Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace."}),(0,r.jsxs)("div",{className:"flex gap-4 justify-center flex-wrap",children:[(0,r.jsx)(c(),{href:"/download",children:(0,r.jsx)(p.Z,{variant:"primary",children:"Download Chat2DB Free"})}),(0,r.jsx)("a",{href:"https://app.chat2db.ai",target:"_blank",rel:"noopener noreferrer",children:(0,r.jsx)(p.Z,{variant:"secondary",children:"Try Chat2DB Web"})})]})]}),v,f&&f.length>0&&(0,r.jsxs)("section",{className:"my-10",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold mb-4",children:"How to use"}),(0,r.jsx)("ol",{className:"list-decimal list-inside space-y-2 text-[#B8AFCA]",children:f.map((e,t)=>(0,r.jsx)("li",{children:e},t))})]}),x&&x.length>0&&(0,r.jsxs)("section",{className:"my-10",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold mb-4",children:"Frequently asked questions"}),(0,r.jsx)("div",{className:"space-y-6",children:x.map((e,t)=>(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg font-semibold mb-1",children:e.q}),(0,r.jsx)("p",{className:"text-[#9289A4]",children:e.a})]},t))})]}),(0,r.jsxs)("section",{className:"my-12",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold mb-4",children:"More free SQL tools"}),(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:b.map(e=>(0,r.jsxs)(c(),{href:"/tools/".concat(e.slug),className:"block p-4 rounded-[12px] border border-[#2A2440] hover:border-[#4A4460] transition-colors",children:[(0,r.jsx)("div",{className:"font-semibold mb-1",children:e.name}),(0,r.jsx)("div",{className:"text-sm text-[#9289A4]",children:e.short})]},e.slug))})]})]}),(0,r.jsx)(d.Z,{})]})]})}},7662:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return q}});var r=a(2676),n=a(5271),s=a(9824);let i="****",o="ODBC Driver 18 for SQL Server",c={sql:{label:"SQL Server authentication",ado:"",odbc:"",jdbc:"",go:""},windows:{label:"Windows (Integrated Security)",ado:"",odbc:"",jdbc:"",go:""},"aad-password":{label:"Microsoft Entra ID - Password",ado:"Active Directory Password",odbc:"ActiveDirectoryPassword",jdbc:"ActiveDirectoryPassword",go:"ActiveDirectoryPassword"},"aad-interactive":{label:"Microsoft Entra ID - Interactive",ado:"Active Directory Interactive",odbc:"ActiveDirectoryInteractive",jdbc:"ActiveDirectoryInteractive",go:"ActiveDirectoryInteractive"},"aad-default":{label:"Microsoft Entra ID - Default",ado:"Active Directory Default",odbc:"",jdbc:"ActiveDirectoryDefault",go:"ActiveDirectoryDefault"},"aad-msi":{label:"Microsoft Entra ID - Managed Identity",ado:"Active Directory Managed Identity",odbc:"ActiveDirectoryMsi",jdbc:"ActiveDirectoryManagedIdentity",go:"ActiveDirectoryManagedIdentity"}},l=e=>"sql"===e||"aad-password"===e,d=()=>({host:"",port:"",instance:"",database:"",tcpPrefix:!0,auth:"sql",user:"",password:"",encrypt:"",trustServerCertificate:"",connectTimeout:"",appName:"",mars:!1,readOnlyIntent:!1,multiSubnetFailover:!1,minPoolSize:"",maxPoolSize:"",extra:[]}),u=e=>{let t=e.port.trim();return t&&"1433"!==t?t:""},p=(e,t)=>t.maskPassword?i:e.password;function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.tcpPrefix,a=e.host.trim()||"localhost";e.instance.trim()&&(a+="\\"+e.instance.trim());let r=u(e);return r&&(a+=","+r),t?"tcp:"+a:a}let m=e=>e.replace(/=/g,"=="),f=e=>e.map(e=>
1{let[t,a]=e;return"".concat(t,"=").concat(a)}).join(";")+";";function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=[["Driver","{".concat(o,"}")]],r=(e,t)=>a.push([e,/[;{}=]/.test(t)||/^\s|\s$/.test(t)?"{".concat(t.replace(/}/g,"}}"),"}"):t]);return r("Server",h(e)),e.database&&r("Database",e.database),"windows"===e.auth?r("Trusted_Connection","yes"):(c[e.auth].odbc&&r("Authentication",c[e.auth].odbc),e.user&&r("Uid",e.user),l(e.auth)&&(e.password||t.maskPassword)&&r("Pwd",p(e,t))),e.encrypt&&r("Encrypt",{true:"yes",false:"no",strict:"strict"}[e.encrypt]),e.trustServerCertificate&&r("TrustServerCertificate","true"===e.trustServerCertificate?"yes":"no"),e.appName&&r("APP",e.appName),e.mars&&r("MARS_Connection","yes"),e.readOnlyIntent&&r("ApplicationIntent","ReadOnly"),e.multiSubnetFailover&&r("MultiSubnetFailover","yes"),f(a)}let v=e=>/^[A-Za-z0-9_.,:\/@%+=-]+$/.test(e)?e:"'".concat(e.replace(/'/g,"'\\''"),"'"),b=e=>encodeURIComponent(e).replace(/%20/g,"+");function y(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.instance.trim())return"mssql+pyodbc:///?odbc_connect="+encodeURIComponent(x(e,t));let a="";"windows"!==e.auth&&e.user&&(a=encodeURIComponent(e.user),l(e.auth)&&(e.password||t.maskPassword)&&(a+=":"+(t.maskPassword?i:encodeURIComponent(e.password))));let r=u(e),n=(e.host.trim()||"localhost")+(r?":"+r:""),s=e.database?"/"+encodeURIComponent(e.database):"/",d=["driver=".concat(b(o))];return"windows"!==e.auth&&c[e.auth].odbc&&d.push("authentication=".concat(c[e.auth].odbc)),e.encrypt&&d.push("Encrypt=".concat({true:"yes",false:"no",strict:"strict"}[e.encrypt])),e.trustServerCertificate&&d.push("TrustServerCertificate=".concat("true"===e.trustServerCertificate?"yes":"no")),e.appName&&d.push("APP=".concat(b(e.appName))),e.mars&&d.push("MARS_Connection=yes"),e.readOnlyIntent&&d.push("ApplicationIntent=ReadOnly"),e.multiSubnetFailover&&d.push("MultiSubnetFailover=yes"),"mssql+pyodbc://".concat(a,"@").concat(n).concat(s,"?").concat(d.join("&"))}let g=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"');function w(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],a=e.length,r=[],n=0;for(;n<a;){for(;n<a&&(";"===e[n]||/\s/.test(e[n]));)n++;if(n>=a)break;let s="";for(;n<a&&";"!==e[n];){if("="===e[n]){if("="===e[n+1]){s+="=",n+=2;continue}break}s+=e[n++]}if(n>=a||";"===e[n])return{pairs:r,error:'Missing "=" after "'.concat(s.trim(),'"')};for(n++;n<a&&(" "===e[n]||" "===e[n]);)n++;let i="",o=e[n],c="{"===o?"}":t&&('"'===o||"'"===o)?o:"";if(c){n++;let t=!1;for(;n<a;){if(e[n]===c){if(e[n+1]===c){i+=c,n+=2;continue}n++,t=!0;break}i+=e[n++]}if(!t)return{pairs:r,error:'Unterminated quoted value for "'.concat(s.trim(),'"')};for(;n<a&&";"!==e[n];){if(!/\s/.test(e[n]))return{pairs:r,error:'Unexpected text after quoted value of "'.concat(s.trim(),'"')};n++}}else{for(;n<a&&";"!==e[n];)i+=e[n++];i=i.trim()}r.push([s.trim(),i])}return{pairs:r,error:""}}let S=e=>/^(true|yes|sspi)$/i.test(e.trim()),C=e=>/^\d+$/.test(e.trim()),A=Object.keys(c).map(e=>({value:e,label:c[e].label})),j=[{value:"",label:"(driver default)"},{value:"true",label:"True / yes (Mandatory)"},{value:"false",label:"False / no (Optional)"},{value:"strict",label:"Strict (TDS 8.0)"}],D=[{value:"",label:"(default: false)"},{value:"true",label:"true"},{value:"false",label:"false"}],N=[{value:"adonet",label:"ADO.NET (SqlClient)"},{value:"odbc",label:"ODBC"},{value:"jdbc",label:"JDBC"},{value:"sqlcmd",label:"sqlcmd"},{value:"python",label:"Python (pyodbc)"},{value:"sqlalchemy",label:"SQLAlchemy URL"}],P=e=>{let{label:t,value:a,onChange:n,width:s="w-32",placeholder:i}=e;return(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm text-[#B8AFCA]",children:[t,(0,r.jsx)("input",{type:"text",className:"".concat("bg-[#16151A] border border-[#2A2440] rounded-[8px] px-3 py-1.5 text-white focus:border-[#3E30A8] focus:outline-none font-mono text-sm"," ").concat(s),value:a,placeholder:i,onChange:e=>n(e.target.value)})]})},T=e=>{let{label:t,checked:a,onChange:n}=e;return(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm text-[#B8AFCA] cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:a,onChange:e=>n(e.target.checked)}),t]})},E={...d(),host:"sql01.example.com",database:"AppDb",user:"app_user",password:'p@ss;w"rd',encrypt:"true",trustServerCertificate:"false",connectTimeout:"30",appName:"my-service"};var q=!0;t.default=()=>{var e;
1let[t,a]=(0,n.useState)(E),[i,b]=(0,n.useState)(!1),[q,O]=(0,n.useState)("adonet"),[L,k]=(0,n.useState)(""),[I,B]=(0,n.useState)(""),[M,z]=(0,n.useState)([]),Q=e=>t=>a(a=>({...a,[e]:t})),F=(0,n.useMemo)(()=>({...function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{adonet:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=[],r=(e,t)=>a.push([m(e),/[;\u0000]/.test(t)||/^\s|\s$/.test(t)||/^['"]/.test(t)?t.includes('"')&&!t.includes("'")?"'".concat(t,"'"):'"'.concat(t.replace(/"/g,'""'),'"'):t]);for(let[a,n]of(r("Server",h(e)),e.database&&r("Database",e.database),"windows"===e.auth?r("Integrated Security","True"):(c[e.auth].ado&&r("Authentication",c[e.auth].ado),e.user&&r("User ID",e.user),l(e.auth)&&(e.password||t.maskPassword)&&r("Password",p(e,t))),e.encrypt&&r("Encrypt",{true:"True",false:"False",strict:"Strict"}[e.encrypt]),e.trustServerCertificate&&r("TrustServerCertificate","true"===e.trustServerCertificate?"True":"False"),e.connectTimeout&&r("Connection Timeout",e.connectTimeout),e.appName&&r("Application Name",e.appName),e.mars&&r("MultipleActiveResultSets","True"),e.readOnlyIntent&&r("ApplicationIntent","ReadOnly"),e.multiSubnetFailover&&r("MultiSubnetFailover","True"),e.minPoolSize&&r("Min Pool Size",e.minPoolSize),e.maxPoolSize&&r("Max Pool Size",e.maxPoolSize),e.extra))r(a,n);return f(a)}(e,t),odbc:x(e,t),jdbc:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=u(e),r="jdbc:sqlserver://".concat(e.host.trim()||"localhost").concat(a?":"+a:""),n=[],s=(e,t)=>n.push([e,/[;{}]/.test(t)||/^\s|\s$/.test(t)?"{".concat(t.replace(/}/g,"}}"),"}"):t]);return e.instance.trim()&&s("instanceName",e.instance.trim()),e.database&&s("databaseName",e.database),"windows"===e.auth?s("integratedSecurity","true"):(c[e.auth].jdbc&&s("authentication",c[e.auth].jdbc),e.user&&s("user",e.user),l(e.auth)&&(e.password||t.maskPassword)&&s("password",p(e,t))),e.encrypt&&s("encrypt",e.encrypt),e.trustServerCertificate&&s("trustServerCertificate",e.trustServerCertificate),e.connectTimeout&&s("loginTimeout",e.connectTimeout),e.appName&&s("applicationName",e.appName),e.readOnlyIntent&&s("applicationIntent","ReadOnly"),e.multiSubnetFailover&&s("multiSubnetFailover","true"),n.length?"".concat(r,";").concat(f(n)):"".concat(r,";")}(e,t),sqlcmd:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=["sqlcmd","-S",v(h(e))],r="";return e.database&&a.push("-d",v(e.database)),"windows"===e.auth?a.push("-E"):"sql"===e.auth||"aad-password"===e.auth?("aad-password"===e.auth&&a.push("-G"),e.user&&a.push("-U",v(e.user)),(e.password||t.maskPassword)&&a.push("-P",v(p(e,t)))):(r="# --authentication-method requires the Go-based sqlcmd (go-sqlcmd)\n",a.push("--authentication-method=".concat(c[e.auth].go)),e.user&&a.push("-U",v(e.user))),"true"===e.encrypt?a.push("-N"):"strict"===e.encrypt?a.push("-Ns"):"false"===e.encrypt&&a.push("-No"),"true"===e.trustServerCertificate&&a.push("-C"),e.connectTimeout&&a.push("-l",v(e.connectTimeout)),e.readOnlyIntent&&a.push("-K","ReadOnly"),e.multiSubnetFailover&&a.push("-M"),r+a.join(" ")}(e,t),python:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=g(x(e,t)),r=g(y(e,t)),n=e.connectTimeout?", timeout=".concat(e.connectTimeout):"",s=e.connectTimeout?', connect_args={"timeout": '.concat(e.connectTimeout,"}"):"";return"# pip install pyodbc sqlalchemy (needs ".concat(o,' installed)\nimport pyodbc\n\nconn = pyodbc.connect("').concat(a,'"').concat(n,')\nprint(conn.cursor().execute("SELECT @@VERSION").fetchone()[0])\n\n# SQLAlchemy\nfrom sqlalchemy import create_engine, text\n\nengine = create_engine("').concat(r,'"').concat(s,')\nwith engine.connect() as c:\n print(c.execute(text("SELECT DB_NAME()")).scalar())')}(e,t),sqlalchemy:y(e,t)}}(t,{maskPassword:i}),warnings:function(e){let t=[];
1for(let[a,r]of(e.host.trim()||t.push("Server is required (localhost is used as a placeholder)."),e.port.trim()&&!(C(e.port)&&+e.port>0&&65535>=+e.port)&&t.push("Port must be a number between 1 and 65535."),[["Connection Timeout",e.connectTimeout],["Min Pool Size",e.minPoolSize],["Max Pool Size",e.maxPoolSize]]))r.trim()&&!C(r)&&t.push("".concat(a," must be a whole number."));return C(e.minPoolSize)&&C(e.maxPoolSize)&&+e.minPoolSize>+e.maxPoolSize&&t.push("Min Pool Size is larger than Max Pool Size."),e.instance.trim()&&u(e)?t.push("Both a named instance and a port are set: the client connects straight to the port and the instance name is not used to look it up (JDBC ignores instanceName when a port is given)."):e.instance.trim()&&t.push("A named instance without a port is resolved through the SQL Server Browser service (UDP 1434). Make sure it is running and reachable, or enter the instance's TCP port."),"sql"!==e.auth&&"aad-password"!==e.auth||e.user||t.push("This authentication mode needs a user name."),"windows"===e.auth&&t.push("Windows authentication uses the account running the client process. On Linux/macOS it needs a Kerberos setup; JDBC on Windows needs the mssql-jdbc_auth DLL (or authenticationScheme=JavaKerberos)."),"aad-default"===e.auth&&t.push("Active Directory Default is a Microsoft.Data.SqlClient / JDBC option. The ODBC and SQLAlchemy outputs leave Authentication out â choose Managed Identity, Interactive or Password for ODBC-based clients."),"true"===e.trustServerCertificate&&("strict"===e.encrypt?t.push("With Encrypt=Strict the server certificate is always validated; TrustServerCertificate is ignored."):t.push("TrustServerCertificate=True skips certificate validation and allows man-in-the-middle attacks. Use it only for local/dev servers with self-signed certificates.")),"false"===e.encrypt&&t.push("Encrypt=False/Optional: only the login is encrypted unless the server forces encryption â query data travels in clear text."),e.mars&&t.push("MultipleActiveResultSets has no JDBC equivalent and is omitted from the JDBC URL."),(e.minPoolSize||e.maxPoolSize)&&t.push("Min/Max Pool Size are ADO.NET keywords; ODBC and JDBC pooling is configured outside the connection string."),t}(t)}),[t,i]),_="windows"!==t.auth,R=l(t.auth),U="aad-msi"===t.auth||"aad-default"===t.auth?"Client ID (optional)":"aad-interactive"===t.auth?"User (optional)":"User";return(0,r.jsx)(s.ZP,{slug:"sql-server-connection-string-builder",title:"SQL Server Connection String Builder",description:"Build or parse SQL Server connection strings for ADO.NET, ODBC, JDBC, sqlcmd, pyodbc and SQLAlchemy, with Entra ID, named instances and Encrypt.",h1:"SQL Server Connection String Builder & Parser",intro:"Enter a server, database and credentials to get a correct Microsoft SQL Server connection string for Microsoft.Data.SqlClient (ADO.NET), ODBC Driver 18, the Microsoft JDBC driver, sqlcmd, Python pyodbc and SQLAlchemy â or paste an existing string or jdbc:sqlserver:// URL to break it into fields. Named instances, SQL, Windows and Microsoft Entra ID authentication, Encrypt and TrustServerCertificate are handled, and passwords with semicolons or quotes are escaped the way each driver expects. Everything runs in your browser; nothing is uploaded.",howTo:["Enter the server host, an optional port or named instance (e.g. SQLEXPRESS) and the database, then pick SQL Server, Windows or Microsoft Entra ID authentication.","Set Encrypt, TrustServerCertificate, timeout, application intent and pooling options â or paste an existing ADO.NET, ODBC or JDBC string and click Parse to fill every field.","Review the warnings, switch between the ADO.NET, ODBC, JDBC, sqlcmd, Python and SQLAlchemy tabs and copy the result (enable Mask password before sharing)."],faq:[{q:"What is the SQL Server connection string format?",a:"For .NET (Microsoft.Data.SqlClient) it is a list of key=value pairs separated by semicolons, for example Server=tcp:sql01.example.com,1433;Database=AppDb;User ID=app_user;Password=secret;Encrypt=True;. Keywords are case-insensitive and have synonyms: Data Source, Address and Addr mean Server, Initial Catalog means Database. A named instance is written host\\SQLEXPRESS and a non-default port is appended after a comma. ODBC uses the same shape with a Driver={ODBC Driver 18 for SQL Server} entry and Uid/Pwd, while JDBC uses a URL such as jdbc:sqlserver:
1//host:1433;databaseName=AppDb;encrypt=true;."},{q:"Why do I get a certificate error after upgrading the driver?",a:"Microsoft.Data.SqlClient 4.0 and ODBC Driver 18 for SQL Server changed the default of Encrypt to true (Mandatory), and JDBC driver 10.2 did the same. The client now validates the server's TLS certificate, so servers that use a self-signed certificate â typical for local installs and Docker containers â fail with an error like 'The certificate chain was issued by an authority that is not trusted'. The proper fix is to install a certificate your clients trust; for development you can add TrustServerCertificate=True (yes for ODBC). Encrypt=Strict (TDS 8.0, SQL Server 2022 and Azure SQL) always validates the certificate."},{q:"How do I escape a semicolon or quote in a SQL Server password?",a:'In an ADO.NET string, wrap the value in double quotes and double any double quote inside it, e.g. Password="p@ss;w""rd"; a value that contains double quotes but no single quotes can be wrapped in single quotes instead. ODBC and JDBC wrap the value in braces and double any closing brace, e.g. Pwd={p@ss;w}}rd}. URL forms such as SQLAlchemy need percent-encoding instead: p@ss:w/rd becomes p%40ss%3Aw%2Frd. This builder applies the right rule for every output. Once connected, you can query and manage SQL Server with Chat2DB â download it free at https://chat2db.ai/download.'}],children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap gap-3 items-end",children:[(0,r.jsx)(s.A1,{label:"Parse an existing connection string (optional)",value:L,onChange:k,rows:2,placeholder:"Data Source=myhost\\SQLEXPRESS;Initial Catalog=AppDb;Integrated Security=SSPI; or jdbc:sqlserver://myhost:1433;databaseName=AppDb"}),(0,r.jsx)(s.V4,{onClick:()=>{if(B(""),z([]),!L.trim())return;let{config:e,error:t,notes:r}=function(e){let t;let a=d(),r=[],n=e.trim(),s=/^jdbc:sqlserver:\/\/([\s\S]*)$/i.exec(n);if(s){let e=s[1],n=e.indexOf(";"),i=(n>=0?e.slice(0,n):e).trim(),o=n>=0?e.slice(n+1):"",c=i,l=/:(\d*)$/.exec(c);l&&!/^\[[^\]]*$/.test(c.slice(0,l.index))&&(a.port=l[1],c=c.slice(0,l.index));let d=c.indexOf("\\");d>=0&&(a.instance=c.slice(d+1),c=c.slice(0,d)),a.host=c;let u=w(o,!1);if(u.error)return{config:a,error:u.error,notes:r};t=u.pairs}else{if(/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return{config:a,error:"Only ADO.NET / ODBC key=value strings and jdbc:sqlserver:// URLs are supported.",notes:r};let e=w(n,!0);if(e.error)return{config:a,error:e.error,notes:r};t=e.pairs}for(let[e,n]of t)!function(e,t,a,r){switch(t.toLowerCase().replace(/[\s_]/g,"")){case"server":case"datasource":case"address":case"addr":case"networkaddress":return!function(e,t,a){let r=t.trim(),n=/^(tcp|np|lpc|admin):/i.exec(r);e.tcpPrefix=!1,n&&(r=r.slice(n[0].length),"tcp"===n[1].toLowerCase()?e.tcpPrefix=!0:a.push('Protocol prefix "'.concat(n[0],'" was dropped.')));let s=r.lastIndexOf(",");s>=0&&(e.port=r.slice(s+1).trim(),r=r.slice(0,s));let i=r.indexOf("\\");i>=0&&(e.instance=r.slice(i+1).trim(),r=r.slice(0,i)),e.host=r.trim()}(e,a,r),!0;case"servername":return e.host=a.trim(),!0;case"instancename":return e.instance=a.trim(),!0;case"port":case"portnumber":return e.port=a.trim(),!0;case"database":case"initialcatalog":case"databasename":return e.database=a,!0;case"userid":case"uid":case"user":case"username":return e.user=a,!0;case"password":case"pwd":return e.password=a,!0;case"integratedsecurity":case"trustedconnection":return S(a)&&(e.auth="windows"),!0;case"authentication":return function(e,t,a){let r=t.replace(/[\s_-]/g,"").toLowerCase(),n={sqlpassword:"sql",activedirectorypassword:"aad-password",activedirectoryinteractive:"aad-interactive",activedirectorydefault:"aad-default",activedirectorymanagedidentity:"aad-msi",activedirectorymsi:"aad-msi"};return n[r]?(e.auth=n[r],!0):"notspecified"===r||(a.push('Authentication "'.concat(t,'" is not supported by this builder and was kept as an extra option.')),!1)}(e,a,r);case"encrypt":{let t=a.trim().toLowerCase();if("true"===t||"yes"===t||"mandatory"===t)e.encrypt="true";else if("false"===t||"no"===t||"optional"===t)e.encrypt="false";else{if("strict"!==t)return!1;e.encrypt="strict"}return!0}case"trustservercertificate":return e.trustServerCertificate=S(a)?"true":"false",!0;case"connecttimeout":case"connectiontimeout":case"timeout":case"logintimeout":return e.connectTimeout=a.trim(),!0;case"applicationname":case"app":return e.appName=a,!0;case"multipleactiveresultsets":case"marsconnection":return e.mars=S(a),!0;case"applicationintent":return e.readOnlyIntent="readonly"===a.trim().toLowerCase(),!0;case"multisubnetfailover":return e.multiSubnetFailover=S(a),!0;case"minpoolsize":return e.minPoolSize=a.trim(),!0;case"maxpoolsize":return e.maxPoolSize=a.trim(),!0;case"driver":return r.push('Driver "'.concat(a,'" was ignored â the ODBC output always uses ').concat(o,".")),!0;default:return!1}}(a,e,n,r)&&a.extra.push([e,n]);return a.host?{config:a,error:"",notes:r}:{config:a,error:"No server / Data Source found in the string.",notes:r}}(L);if(t){B(t);return}a(e),z(r.concat(e.extra.length?["Kept ".concat(e.extra.length," other option(s) in the ADO.NET output: ").concat(e.extra.map(e=>e[0]).join(", "))]:[]))},children:"Parse"})]}),I&&(0,r.jsx)("div",{className:"text-sm text-red-400",children:I}),M.map(e=>(0,r.jsx)("div",{className:"text-sm text-[#B8AFCA]",children:e},e)),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,r.jsx)(P,{label:"Server",value:t.host,onChange:Q("host"),width:"w-56",placeholder:"localhost"}),(0,r.jsx)(P,{label:"Port",value:t.port,onChange:Q("port"),width:"w-20",placeholder:"1433"}),(0,r.jsx)(P,{label:"Instance",value:t.instance,onChange:Q("instance"),width:"w-32",placeholder:"SQLEXPRESS"}),(0,r.jsx)(P,{label:"Database",value:t.database,onChange:Q("database"),width:"w-32",placeholder:"(default)"}),(0,r.jsx)(T,{label:"tcp: prefix",checked:t.tcpPrefix,onChange:Q("tcpPrefix")})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,r.jsx)(s.PU,{label:"Authentication",value:t.auth,onChange:e=>Q("auth")(e),options:A}
1),_&&(0,r.jsx)(P,{label:U,value:t.user,onChange:Q("user"),width:"w-40"}),R&&(0,r.jsx)(P,{label:"Password",value:t.password,onChange:Q("password"),width:"w-40"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,r.jsx)(s.PU,{label:"Encrypt",value:t.encrypt,onChange:e=>Q("encrypt")(e),options:j}),(0,r.jsx)(s.PU,{label:"TrustServerCertificate",value:t.trustServerCertificate,onChange:e=>Q("trustServerCertificate")(e),options:D}),(0,r.jsx)(P,{label:"Connection Timeout (s)",value:t.connectTimeout,onChange:Q("connectTimeout"),width:"w-16",placeholder:"15"}),(0,r.jsx)(P,{label:"Application Name",value:t.appName,onChange:Q("appName"),width:"w-36"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-4 items-center",children:[(0,r.jsx)(T,{label:"MultipleActiveResultSets",checked:t.mars,onChange:Q("mars")}),(0,r.jsx)(T,{label:"ApplicationIntent=ReadOnly",checked:t.readOnlyIntent,onChange:Q("readOnlyIntent")}),(0,r.jsx)(T,{label:"MultiSubnetFailover",checked:t.multiSubnetFailover,onChange:Q("multiSubnetFailover")}),(0,r.jsx)(P,{label:"Min Pool Size",value:t.minPoolSize,onChange:Q("minPoolSize"),width:"w-16",placeholder:"0"}),(0,r.jsx)(P,{label:"Max Pool Size",value:t.maxPoolSize,onChange:Q("maxPoolSize"),width:"w-16",placeholder:"100"})]})]}),(0,r.jsxs)("div",{className:"rounded-[12px] border border-[#2A2440] bg-[#16151A] p-3 text-sm text-[#B8AFCA]",children:[(0,r.jsx)("strong",{className:"text-white",children:"Encryption defaults:"}),' Microsoft.Data.SqlClient 4.0+ and ODBC Driver 18 for SQL Server default to Encrypt=True (Mandatory), so the client validates the server\'s TLS certificate. Local and Docker SQL Server instances often use a self-signed certificate, which then fails with "certificate chain was issued by an authority that is not trusted". For development only, set TrustServerCertificate=True; in production install a trusted certificate instead.']}),F.warnings.length>0&&(0,r.jsx)("ul",{className:"flex flex-col gap-1 rounded-[12px] border border-[#6B4E16] bg-[#2A2110] p-3 text-sm text-[#F5C451]",children:F.warnings.map(e=>(0,r.jsxs)("li",{children:["â ",e]},e))}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[N.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>O(e.value),className:"text-sm px-4 py-1.5 rounded-full border border-[#3E30A8] transition-colors ".concat(q===e.value?"bg-[#3E30A8] text-white":"text-[#B8AFCA] hover:bg-[#3E30A8]"),children:e.label},e.value)),(0,r.jsxs)("label",{className:"flex items-center gap-2 text-sm text-[#B8AFCA] cursor-pointer ml-auto",children:[(0,r.jsx)("input",{type:"checkbox",checked:i,onChange:e=>b(e.target.checked)}),"Mask password"]})]}),(0,r.jsx)(s.A1,{label:(null===(e=N.find(e=>e.value===q))||void 0===e?void 0:e.label)||"Output",value:F[q],readOnly:!0,rows:"python"===q?12:4})]})})}}},function(e){e.O(0,[9257,9045,5812,7799,2888,9774,179],function(){return e(e.s=4584)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.