Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JDBCDriver[
- "Name" -> "Microsoft SQL Server (MS6 driver)",
- "Driver" -> "com.microsoft.sqlserver.jdbc.SQLServerDriver",
- "Protocol" -> "jdbc:sqlserver://",
- "Description" -> "Microsoft SQL Server using Microsoft's jdbc 6.0 driver",
- "Location" -> "C:\Users\vriessc\AppData\Roaming\Mathematica\DatabaseResources\sqljdbc6.m"
- ]
- DatabaseResourcesPath[]
- {
- {"C:\Program Files\Wolfram Research\Mathematica\11.0\SystemFiles\Links\DatabaseLink\DatabaseResources", "DatabaseLink"},
- {"C:\Users\vriessc\AppData\Roaming\Mathematica\DatabaseResources", None},
- {"C:\ProgramData\Mathematica\DatabaseResources", None}
- }
- conn =
- OpenSQLConnection[
- JDBC["Microsoft SQL Server (MS6 driver)", "ServerName"],
- "Properties" -> {"integratedSecurity" -> "true"},
- "Catalog" -> "DatabaseName"
- ]
- SQLConnection[
- JDBC["Microsoft SQL Server (MS6 driver)", "wsrv2143"],
- "Location" -> "C:\Users\vriessc\AppData\Roaming\Mathematica\DatabaseResources\MyArbitraryConnectionName.m",
- "Name" -> "MyArbitraryConnectionName",
- "Catalog" -> "DatabaseName",
- "Description" -> "My descripion",
- "Password" -> "",
- "Properties" -> {"integratedSecurity" -> "true"},
- "ReadOnly" -> Automatic,
- "RelativePath" -> False,
- "TransactionIsolationLevel" -> Automatic,
- "UseConnectionPool" -> Automatic,
- "Username" -> ""
- ]
- conn = OpenSQLConnection["MyArbitraryConnectionName"]
- In[32]:= << DatabaseLink`
- In[34]:= $Version
- Out[34]= "11.0.1 for Mac OS X x86 (64-bit) (September 21, 2016)"
- In[36]:= JDBCDrivers["Microsoft Access(UCanAccess)"]
- Out[36]:JDBCDriver["Name" -> "Microsoft Access(UCanAccess)",
- "Driver" -> "net.ucanaccess.jdbc.UcanaccessDriver",
- "Protocol" -> "jdbc:ucanaccess://", "Version" -> 3.1,
- "Description" -> "Open-source Java JDBC driver implementation that allows Java developers and JDBC client programs to read/write Microsoft Access databases.",
- "Location" ->"/Applications/Mathematica11.0.1.app/Contents/SystemFiles/Links/DatabaseLink/DatabaseResources/accessjdbc.m"]
- In[37]:= conn =
- OpenSQLConnection[
- JDBC["Microsoft Access(UCanAccess)",
- "/Users/damanjits/databaselink/Tests/AccessDB.accdb"]];
- In[38]:= SQLCreateTable[conn, SQLTable["TEST"],
- SQLColumn["id", "DataTypeName" -> "integer", "PrimaryKey" -> True]]
- Out[38]= 0
- In[39]:= SQLTables[conn]
- Out[39]= {SQLTable["TEST", "TableType" -> "TABLE"]}
- Needs["DatabaseLink`"];
- openConn[]:=Block[
- {},
- If[$System==="Microsoft Windows (64-bit)",
- Return[OpenSQLConnection[JDBC["Microsoft SQL Server(jTDS)",
- "SERVERNAME/DATABASENAME"],
- "Username"->"USERNAME",
- "Password"->"PASSWORD"]]];
- If[$System==="Microsoft Windows (32-bit)",
- Return[OpenSQLConnection[JDBC["ODBC(DSN)",
- "DRIVER={SQL Server};"<>
- "SERVER=SERVERNAME;"<>
- "DATABASE=DATABASENAME"],
- "Username"->"USERNAME",
- "Password"->"PASSWORD"]]];
- Null
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement