How would I go about connecting to oracle from F#? Is there a drive or can I load up the C# driver? I'm very new to F#.
You can use Microsoft Excel to access data from a Oracle database using ODBC connector. With ODBC Driver, you can import the data directly into an Excel Spreadsheet and present it as a table.
You can use the same libraries as you use in C# - .NET interoperability is one of the key features of F#. There are some classes in the Base Class Library which you could use (in System.Data.Oracle.dll), but these have been deprecated in favor of Oracle's own .NET drivers (Oracle Data Provider for .NET).
F# code using ODP.NET might look something like:
#if INTERACTIVE
#r "System.Data"
#r "Oracle.DataAccess"
#endif
open System.Data
open Oracle.DataAccess.Client
let conn = OracleConnection("User Id=scott;Password=tiger;Data Source=oracle")
conn.Open()
let cmd = conn.CreateCommand()
cmd.CommandText = "select * from emp"
let rdr = reader = cmd.ExecuteReader()
let empIds =
[while reader.Read() do
yield reader.GetInt32(0)]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With