Created
April 8, 2024 09:28
-
-
Save Apurer/bb8e6a6c9bc285934d5a39b6516aba21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"database/sql" | |
_ "github.com/microsoft/go-mssqldb" | |
_ "github.com/microsoft/go-mssqldb/integratedauth/krb5" | |
) | |
func main() { | |
// Replace with actual values | |
connectionString := "authenticator=krb5;server=your_server_name;database=your_database_name;user id=your_username;krb5-realm=comani.com;krb5-configfile=/etc/krb5.conf;" | |
// Open connection using the connection string | |
conn, err := sql.Open("mssql", connectionString) | |
if err != nil { | |
panic(err) | |
} | |
defer conn.Close() | |
// Execute SQL statements using the connection (replace with your queries) | |
rows, err := conn.Query("SELECT * FROM your_table") | |
if err != nil { | |
panic(err) | |
} | |
defer rows.Close() | |
// Process rows (implement your logic here) | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment