Cloud Coaching – Oracle Autonomous Database for Rust Developers
- January 12, 2024
- Posted by: MainInstructor
- Category: BASIC C Go Java JavaScript Oracle Database Python Rust SQL
Video Title: Cloud Coaching – Oracle Autonomous Database for Rust Developers
Uh speaking about uh Our Guest so as I said uh today we are very happy to be joined by Herman and I will um let him tell a few things about himself shortly one more thing from from my side and then I will pass over to to Herman is
That you need to be aware that everything you see in this call has an educational scope so if you like to use our services for you may connect with somebody from the Oracle account team also if you watch any of our sessions recordings in the future keep in mind
That there might be some slightly differences in the cloud console menu since we enhance our products um on a regular basis that was all on my side Herman over to you okay thank you beleta you’re welcome I’m going to share my screen can you see your presentation yes all good great
Okay so first of all thank you to the organizers Veta tomor thank you for organizing this and giving me this slot today I’m going to talk about rust and I want to uh basically take you through my journey of uh you know connecting autonomous database to rust I’m not not a rust
Expert you know I’m Herman biscuso I’m a database expert especially when it comes to aut to the autonomous database but I do have a developer background I have been de developing in Java and JavaScript for for a long time but I’m new to rust right so I said okay let’s
Learn rust and let’s connect it to autonomous database and let’s see how it works etc etc so I want to share that Journey with you today and uh my main objective is to get you up and running is basically you configure everything to start playing with a couple of Bindings
That are available for us and you are up and running to basically test how how uh how it works basically test the performance later etc etc we won’t we won’t have time to go deep into like let’s say Advanced usage of those bindings because we’ll have to set them
Up and configure it uh the configure the whole thing but we will uh take a look at the basics how to basically do queries how to maybe maybe create a table how to maybe insert some some brows there in the tables Etc but we
Have to do uh to go through a lot of back okay because we have to do a lot to get everything correctly set up so if you are on a Mac right now if you are on on an M1 or M2 based Mac then you are in
Luck because that’s my current setup and I had to go through some hoops to basically get everything up and running and so uh I will give you a lot of information regarding to that so uh I unfortunately I cannot cover like multiple platforms like Windows etc etc
So this is basically what I got and what I had to go through I think that for developers is very common to have maybe M1 and M2 Max okay so okay let’s get started first of all the prerequisites okay what do I need to uh follow this uh
Webinar and basically to run the demos later so what you need this rust obviously right so uh I’m uh running uh version 1730 and I’m running those crates that you see there basically I have dependencies uh one of them is called Oracle which is the Oracle rust uh
Binding I’m going to talk about that we are going to take a look at another binding called civil so two for the price of one we be checking out two different type of bindings and but I’m also using uh Tokyo and artics web for uh let’s say nonblocking capabilities
Which we are also going to to see today okay so basically when you use these findings you can opt for a blocking way of doing it where you where basically the code waits for the database code to return or you can opt for a sync right
Non blocking and you can go do something else while you’re waiting for the for the database call to come back okay so uh I I use cargo obviously uh if you’re familiar with rust cargo is like the package manager okay and I you and I install cargo edit there because I like
To add dependencies toing cargo ad so for example if you install this cargo edit uh extension and you want to add the Oracle dependency you go to the root folder of your project and you just say cargo add Oracle and that’s really cool because you can
Create a project doing cargo new uh and the name of the project that creates a folder for you you CD into that folder and then you do cargo add Oracle and that’s being added for you in the cargo. Tom toml file which is where the dependencies are okay then you will need
Oracle instant client why do we need Oracle instant client because this bindings are using Dynamic are loading D Dynamic libraries uh that are part of the Oracle instant client to actually connect to the database so the Oracle instant client has uh several uh libraries inside uh
Both simpler like o ODI PC and oci I’m going to cover you know the differences between those those those libraries but basically this is a requirement because we need the libraries to connect to the auton to the autonomous database uh now uh if you go and look for the Mac
Versions of this Oracle client you will see that they are only available for Intel based Macs and that is a problem because I’m running on M1 Mac right that’s arm so you will have to use Rosetta 2 which is a like a translation layer that basically allows you to run
Inel uh compile Intel code in an M1 or M2 based map and that’s what I’m using here and I will basically cover that okay finally we need the Oracle Cloud infrastructure because we are going to run the autonomous database is uh in the cloud okay and the good news is that
It’s enough to have the always free tier so uh even if we don’t have credits like maybe we’re on the free trial we run out of credits you know you get $300 something like that so even if you revert it back to always free you can
Run this uh this code okay no problem we can use the always free autonomous database now optional I like to install the oci CLI the OC the oci is pretty cool because it allows allows me to basically set an oci configuration that later the visual studio plug-in extension the or
Oracle developer tools will basically use right away so if you configure the O these two lines the first line is basically uh uh The Bash line is installing the OC I and the second line is configuring it when you configure it you get a guide you get like wizard that
Will basically walk you through how to configure the oci CLI uh will connect you to your o oci tency and once that’s ready you will see that in your home uh your home directory you will find a oci folder with all the configuration files that’s what the visual studio extension for the Oracle
Developer tools are going it’s going to read okay and it’s going to do that automatically so you don’t have to configure the visual studio code extension basically with it will take this o configuration so highly recommend it even though it’s optional uh and then obviously Vis St your code you might
Choose to develop uh for rust in a different environment this is the environment I’m using I feel very comfortable with it I’m using visual studio code the latest version and using all of these extensions and we will take a sorry we will take a closer look at the Oracle developer tools extension
Okay but I’m also using rust analyzer crates even better toml code Runner codeb Etc so this ones basically give me intelligence intelligence for rust uh give me a pretty you know basically colors you know out completion Etc all right so let’s take a look at why uh at
At the languages right number of of developers per language so this is a combination which is which is basically the main source is a stock overflow annual service you probably completed that one uh you went through that one if you’re a developer okay so this is sent
To basically all developers in in the world and they complet it so if you take a look at the 2022 instance which is old right this is one year old mod you’ll see that rust made it like maybe number 10 with 1.1 million developers okay but things look very different in 2023 so
Why why uh we are focusing on rust on this session for example right now the uh number of developers is about three million for rust so if you compare to you know one point something in 2022 uh you could say that uh in the last few years the rust commun Community
Or the rust developers are doubling right so it’s growing uh like crazy so it’s growing a lot and one of the things that uh we saw in that uh in that um stack Overflow survey is that it’s been the most desired language for the last eight years so eight years in a row
Where people say hey I want to learn rust uh rust is something that I want to take a closer look at right so unfortunately something is I want to but people don’t have time right but I think that there are multiple reasons why you should take that I want you to to for
For real you know try out rust and play with rust and this is an excellent excuse that we have today because we’re going to connect to autonomous database so why Russ because it’s safe it doesn’t have garage garbage collection and it has an ownership system where if uh you
Know some maybe function is using a specific element now nobody else can use it right so you can avoid a whole set of uh you know uh problems with that because you uh things are being being accessed as the way they should and from the places they should be they should be
Accessed from okay so it is fast because it’s compiled it’s not interpreted if you consider JavaScript python Etc they are interpreted languages this is compil every time you do something you will see that every time you bring those dependencies that I mentioned those things are being compiled natively in
Your own machine so it’s like having like a cc++ compiler running in the background uh giving you a binary that it’s uh uh mostly comparable in terms of performance to C++ to give you an idea so it’s really really fast uh now concurrency it has multiple options for concurrency it has you know
A sync awaits like if you did JavaScript uh development you’re very familiar with it uh so it has multiple libraries that you can use while the most popular I think is called Tokyo uh and also has a very robust you know uh package manager manager called called cargo I really
Like cargo it’s a very robust uh it’s kind of transparent because nobody talks about cargo but that means that it works you know it works it’s very robust and you have to you basically worry about you know those dependencies and those uh you know uh bringing those dependencies those projects maintaining those
Projects Etc then we have clippy I’m not sure if you are a Ras developer a lot of you basically answer that you know uh you are uh more more familiar with SQL I saw a lot of SQL and that’s not surprising because SQL is in the top time language every year
Okay so everybody’s doing SQL at some point of or other other point in their lives so uh clippy is basically a very pedantic uh agent that will tell you everything that is wrong about your code so every time you’re trying to build a specific Ras project clippy will show up
There saying you hey uh you you did this but you probably meant that right or hey this is not how you’re supposed to do this maybe this piece of code will help you you know that kind of thing so I like it because it’s not uh a compiler
Error clippy is like an agent and it’s working on your behalf to have you make uh or create the best Ras code possible so some people hate it because you know it’s very pedantic and it’s complaining all the time but I really like it because I learn a lot from clippy
Because they clippy gives you uh you know code variants that you can use Etc and you get that in the same screen where you see the errors you know so clip is integrated you know in that system that is building your rust code so it has Type inference it’s really
Nice you don’t have to explicitly you know call call out the types unless is absolutely necessary in some occasions it is necessary but still the language has strong static types which means that you cannot fool around you know with uh how things are working you need to uh
Define specific types and if you want things to behave differently you also have traits uh to basically Define you know how things uh behave uh and then uh you probably heard about zero cost abstraction zero cost abstraction means that you can have generics you can have
Traits you can have all sort of things that are available in modern languages and that doesn’t have a penalty on the generated code and the comply code so the code is not slower because it’s supporting generic traits etc etc so that’s basically all right enough of
Russ so we want to connect to the autonomous database autonomous database is an Oracle database and there are there are multiple ways in which we can connect to autonomous database so you have uh you have drivers that uh basically connect natively meaning that they are not using any library and maybe
If they are using those libraries they are using them in source code version like for example jdbc that you can see in the in the very left here in the screen so uh but those are basically the most robust and the most Say official uh connect connections like OD DBC jdbc etc
Etc but then the rest of the let’s say drivers in this world or bindings I’m going to use the word driver of binding inter interchangeable here okay so I’m talking about the same thing talking about this uh basically uh bridges that allows us to connect to to the database
Uh there are two types ones that connect directly to the Oracle call interface o oci so this is not the Oracle Cloud infrastructure so this is a different kind of oci Oracle C interface and then we have others that connect to the Oracle database programming interace
Interface for C ODP C okay and we’re going to take a quick look at the differences between these two libraries but uh basically we’re going to take a look at two of these Ras bindings and and you can see them here you know we have uh this one here that is uh using
Directly the Oracle sorry the Oracle uh call interface and that one is called civil this is one of the of the vus are going to take a look at and then we have the rust Oracle or just Oracle in the dependency which is here which connects to the Oracle databas pram interface for
C okay so you might be wondering what’s the difference uh what’s suppose I want to create one of these findings for a new language that that comes up right what is the difference what I should take a closer look at so basically if you take a look here you will see that
The Oracle call interface is a low-level API so it’s more complex provides more control over all aspects uh and it’s uh flexible because it’s very low level so it allows you to uh basically uh you know integrate them into higher level apis so this is these are basically the
Building blocks if we want to use them H and it’s native you know it’s provided by Oracle itself uh it’s a native meod to connect uh it includes all the Oracle specific features and optimizations etc etc so it’s the big brother okay it’s more difficult then uh you have uh the Oracle database
Program interface FC which is basically a wrapper on top of the Oracle Co call interface so it’s a way to make the Oracle call interface easy easier it’s a high level API it’s open source it attracts away a lot of the complexities of oci it’s easier to use for the
Developer so if you are using this uh uh ODI do SLC it’s going to be easier for you to create one of these finding finding uh but you have to keep in mind that this is an uh you know an open source project that has its own uh development
Cycles so there might it might not be like completely in sync with the latest oci version right maybe the latest oci version goes out and then this one the Oracle datab from inter interface see gets updated maybe a bit later okay uh and you might take you might want to
Take a look at the functionality to see you know what what you need in that specific bik all right so let’s move on because we have a lot to cover so uh you have to install the Oracle in instant client so it’s a set of libraries as I
As I mentioned before uh all of these Bindings that I that I just mentioned that rely on on these two uh types of connections the oci and the O ODP they will need the libraries okay and you will see that we need delies for both of the vines that we cover today you’ll
Have to go ahead and down download download them okay so I downloaded the one for Mac OS that you see that you can see in the top right but it came for available for Intel and I have an M1 Mac right so uh we are going to go through
That in a bit but first the Bindings that we cover today are are Ras bindings we are going to cover this one called rust Oracle or just PL Oracle this one is open source it hasn’t been created by by Oracle has been created by Kubo takahiro from from Japan H it’s an open
Source Oracle database driver for us which is based on odic right okay so we saw oci and odic it’s odic uh and it’s the most downloaded Oracle DB binding by by Russ developers about about 2.5k downloads per month okay and it requires the Oracle client installation because the obb libraries
Are there and the bining will use it and they will obviously have to be exposed basically added to the path of library in your system so they are visible so a very common error that you get is like you know I cannot uh I cannot find a
Specific Library when you try to run this that means that your library is not exposed it’s not visible okay and we’ll go through that the second binding is called civille okay or civil depending on how you want you want to pronounce it so this is another open- source driver
By Alex deuk so this one also has not been created by Oracle uh it has less downloads I think I think that kind of 20 times less downloads that than the other binding uh and also seems to have uh no not so many contributors okay uh but it’s still great in terms of
Functionality as we all see and it has a great feature that comes out of the box that the other binding doesn’t have which is support for non-blocking a sync apis so you don’t have to wrap and create your own uh you know a Sy C basically this comes with the library I
Think that’s really really cool okay so this one you oci uh uh as as the underlying Library so basically it took more work to create this one because O is a bit more complex okay all right so first of all we need to install rust all right I think I can
Actually skip this but just in case and we’re going to share the the deck later I wanted to give you all the steps that you need to get up and running so here this is how I installed rust and this gave me a rust up uh rasi which is
Basically the compiler and cargo which is the package manager so uh if we have to uh you know Target specific Intel platform like we will see once we start Rosetta 2 we’ll have to basically run our code specifically for Intel otherwise it will be detected automatically uh so we can add the we
Should that Target uh that as you can see here so you will see that every time I do a build or a run I we t targeting x86 okay and this is because I will be running Rosetta and I need to compile for 86 so keep this in mind but you will
See it like okay now uh if you are on an M1 M2 Mac you will have to install Rosetta how do you install Rosetta and as I mentioned before Rosetta is basically a translation layer that allows you to run Intel Intel binaries right in your Arm based Mac that is interesting and you
Would say hey but this is not this this won’t be fast right because I’m doing this weird you know CPU translation in in in the background Etc ETA so to give you an idea if you have a modern M1 base Mac right now and you’re running Rosetta
You’ll get the performance simits to an Intel base i7 from uh 2020 so you if you had a Mac in 2020 with an Intel base i7 you would get that kind of performance to give you an idea so it’s not so bad you know it’s not the
Best but it’s not so bad so this is how I install ETA and I also just let me go back added an a few things to my uh you know my profile because I every time I run my command prompt I wanted to have this aliases I want to type Intel and
Basically have Rosetta switch to Intel and we will see how I do that when I type Intel and then I want to type arm and I just basically have Rosetta switch back to arm I’m not using arm a lot because when I do Intel and I go into
The Intel mode then I type exit and I go out of the Intel mode and come back to the arm mode so I’m not using arm basically using Intel okay uh now I created this export on PS1 because I want the prompt to turn yellow when I’m
Running on Intel okay so every time running on Intel I want to see yellow because I don’t want to mix things I want to completely understand that I’m in basically in Intel form okay and we’ll see that all right so installing the Oracle instance client for Mac so I
Downloaded that zip file that I showed you before you can Google for Oracle instant client and you will see you know a whole bunch of options if you are on Linux for example you you just Oracle Linux you can use dnf to install it so you don’t even need to unload download
The zip file but the latest one for Mac is this version 198 so I downloaded the zip I uncompress it in my uh basically home folder okay and and I got this uh uh this uh directory called instant client 198 then I created in my home
Folder a lip uh directory or a lip folder uh and I created the symbolic link because this uh the the Bindings that I’ve been trying with Russ were complaining about this Library being missing you know when I was trying to run uh Ras code so I linked uh this uh
Specific library to this lip and then I obviously exported the lip to be in the LI in the library path so take a look at the exports what we’re doing here is saying the Oracle home is this instant client ER I’m going to add the libraries in
This instance client to the library path and I’m going to set up a whole bunch of other Dynamic libraries uh you know uh path okay so you can basically go ahead and copy that if you if you have a Mac or maybe if you have a Linux it will be
Very similar okay all right so now we’re going to create an autonomous database and for that I’m going to use Visual Studio code in a while but basically what we’re going to do is we’re going to create the instance uh via Visual Studio code extension because extension also has
Life cycle management not only basically running sequel or connecting to the database but also allows you to create a database which is really cool uh then we’re going to do lab two I don’t think we’re going to do it uh lab two because I already did it but it’s basically
Taking information from object storage and just dropping uh data creating a few tables with movie data uh so we have something to work with it’s very easy very straightforward is just dropping a file into Data load and uh and and basically uh putting data in a few
Tables you can use your your own data obviously if you have data inside the database we are going to download the wallet because when we are working with the always free um with the always free uh version of autonomous database uh we are uh we use wallet based
Authentication so we download the wallet we put it locally and we use it to authenticate to database and for that we need this export we need to export TNS admin to point to the wallet okay and also once we downloaded the wallet if we go inside the wallet we will find a file
Called sqlnet.ora and we have to update the sqlnet.ora to basically point to the wallet kind of strange because we need to change the wallet itself to point to the wallet but don’t ask me that’s that’s where we need to basically get things up
And run okay uh as if you take a look at the bottom part of this you know box you will see that there’s also a very easy way to create an auton autonomous database from oci if you just go if you install the OIC line okay all right but
What’s autonomous database some of you might not be familiar with autonomous database so we took the converge Oracle database which is good for any wordl any type any type of uh data and uh we took it to the cloud basically we place it in
Oci uh in a in a sub service manner you will see that it’s very easy to actually you know create an oracle databas it’s just maybe two minutes and we are done with provision in an Oracle database right so uh that uh that database is running on top of exra data INF
Infrastructure okay so it is the fastest possible Hardware ever made for or an Oracle database so you’re in the best hands when it comes to what’s really running that Oracle data the best one and and it’s only available within ocii okay but that’s not all we also added
Machine learning on top because we wanted this uh you know database to be self-tuning self-securing self- patching etc etc so that’s autonomous Database The Best of Oracle database the best of cloud and uh the best of machine learning to give you the the database technology for the 21st century so you
Might be asking okay what is Oracle database running by itself what is is it doing by itself we’re talking about automatic tuning automatic scaling automatic provisioning automatic encryption automatic updating automatic configuration actually there are more obviously uh but we are doing every everything for you behind the curtain so
You as a developer can focus on building the application that connects to the database and not uh basically maintaining the database life cycle okay all right so we are as I said before we’re going to provision uh the database using visual studio code so let’s go straight into
That see how we’re doing with time okay I think we’re fine uh okay so what I’m going to do is uh if you take a look at this you will see uh the Oracle developer tools okay so this is the plug-in that you have to install so if you just install
The Oracle developable tools for BS code and you already run the occi CLI setup oci setup config then this will automatically connect to your tency right and you will get this extra icon here which is just has the shape of a of a cylinder like a database okay so basically let’s refresh here
Refresh so basically you will see this you will see default and you will see your tency name here okay and you will see this automatically now you if you if you just uh you know click on this Arrow here you will see that you have the autonomous transaction processing
Autonomous data warehouse and autonomous Jason databases so we have variants you know when you create an autonomous database you can choose to create an autonomous transaction processing instance or an autonomous data warehousing instance or a Json instance so the typical application that is going
To do like you know uh a olab you know transaction processing all the time you’ll have to choose autom transaction processing because that engine is optimized for that a lot of inserts you know a lot of queries etc etc typically I don’t know I don’t know maybe like a
Shopping cart kind of application stuff like that that maybe banking etc etc but then we also have a specially tune version for data warehouses which is the ADW so if you’re going to deal with you know a lot of analytics a lot of you know columnar maybe kind of operations
Etc etc you can go ahead and choose autonomous data warehouses uh okay so what we’re going to do here is going to create an ATP and let’s do create new uh and if you are in the always free tier remember that you can have only two of
Them this has been terminated so I think it’s not going to give me any problem and this one I have because I have all the data for for the demos I think that we can create one now because this one in red has been terminated we have one
And we can have two but this is if you are in the always free tier if you have credits uh you can have more and if you if you’re paying for it you can have as many as you want okay so we’re going to create a serverless version of the
Autonomous database you have two varant severals and dedicated for dedicated you create uh everything from scratch you create your own exad dat infrastructure you create you create your own BM cluster you create your own autonomous container database so you own the whole stack with serverless you don’t have to
Worry about any of the stack the under stack but you basically focus on the database instance and this is what we’re going to do right now so uh right click create new I’m going to call it uh let’s say uh the database names I’m going to
Give it the same the display name I want to say webinar slash okay serverless ver version as I mentioned before 19c which is the current stable version of uh the Oracle database for the autonomous database CPU count I’m going to keep like that I’m going to click on always
Free and a lot of things basically will be selected automatically for me and I’m going to add a password here this is for the admin user okay okay okay secure access from every everywhere uh and uh if we have the OB fre version we cannot enable W wallet L
Connectivity but if you are not in the O free version you can also opt in to use TLS and not use uh wallet based authentication so you have to download the wallet etc etc we are going to do it because we are going with we are working
With the all free version so I’m going to click on create okay database uh creation has started and and now we are waiting for the creation uh if we go to the uh to the console here okay hope you can see my my console right now uh if you click here on autonomous
Database all right you will see that uh it is provisioning and we did it from the from Visual Studio code and that the one that it was in R has been terminated okay and I have one available all right so we created the autonomous database let’s wait until it gets created so we
Can actually connect to it from Visual Studio go okay let’s see database creation has started okay let’s wait uh you should get a confirmation here that says database connection has been created and that’s only two minutes okay that’s only two minutes which is pretty pretty fast
Right so uh in the meantime while we wait let me see in the meantime while we wait let’s code okay so uh there you go this is what I wanted to show you let’s code and the code is all available in my Guist g. github.com haran viscuso from there you will see
The two last entries there is all the code that we’re going to use today okay so if you want to just copy paste you’ll have the code there all right so let’s go back to see this is done it’s not done yet uh let’s go back to visual studio
Code while we wait let’s go back to this section here so you will see that I’m using this uh this other uh you know uh extensions like rust analyzer cunner code L there are option crates there are all options but if you want to copy that you can go
Ahead and copy it so uh I’m here in my rust playground okay so my rust playground basically has two uh two projects let’s start with this one and let’s start with the cargo uh H do thil so this is ADB rust o okay and this is what I’m adding as a dependency I’m
Adding the dependency Oracle so as you can see my rro program when I want to connect to the Oracle database basically needs one uh dependency which is Oracle and if we had the Oracle instant client Library correctly you know configured that’s all we need Okay so let’s go and
Check take a look at the code let’s start with the most simple uh uh basically information that we can get from the database okay and uh as you can see here this is a sample that comes with uh you know the rust Oracle uh there you go the the
Database was created okay so here you can see that database was created and the nice thing is that I’m working working with rust and I’m working with my database everything I’m doing from Visual Studio code which is pretty good okay so uh okay so let’s let’s go back
To this example in a sec because I just want to connect to the database and that’s what I wanted to show you all right so once we created it this this is the one webinar etc etc etc what we’re going to do is uh we’re going to create a connection in the
Database Explorer okay and here I I’ve been having some issues with uh the um with downloading the wallet so this is apparently and supposedly you should be able to download the wallet here provide the password for the wallet here and basically get a connection right away but this just sits there and doesn’t
It’s not downloaded for me so what I’m doing is I’m basically downloading the wallet manually and I’m going to show you where you do that this is the database we just created okay and I go here to database connections and I go to the instance wallet and I click on download instant
Wallet and I create a password you know just sec so this is the password for the wallet all right this is not the password for the administrator of the database it’s different thing here I’m using the same password but just this is a different thing okay and I click on
Download and I place this this ZIP file in my in my computer okay I unip it and I usually like to keep uh this uh wallets in the oci for fer okay so later when I want to connect to to the database and I downloaded the wallet I
Go to the visual studio and I unlick I do not click here on download the credential and I point uh the directory to that wallet and if you take a look at this for example you will see here in oci I basically have wallets okay I
Point the wall to the wallet and I basically connect okay then I say select folder and that’s it and then I click okay and I connect I’m not going to connect because I did not download the the the right wallet right now so basically I’m already working with one
Where I did exactly this step but I wanted to show you how to actually create a connection what once you do okay and you point to the wallet you will get ask for the password okay and when you get asked for the password you are connected and what you will see is
Basically this a connection to the database okay so once you see a connection to the database you uh do this drop down here and you will see tables for example and you will see relational tables okay so let’s see if we can refresh because I think I changed the
Name of one of the relational tables okay there you go so this is a connection now if you have a connections you can obviously query uh data right so for example we could do show data here on a specific table and we’ll get the data okay or or you could do right click
And you can do generate the select SQL uh and you will be able to basically got complet for you but you’ll be able to run any any select SQL now be careful if you click on this uh element here uh this is basically for running code and
You get an error you need to click on this other one the one with a circle okay which is execute SQL and that’s true for anything that you want to run here from from this elements so we are up on running with this now let’s go back to
Rust okay and the main so as you can see I’m using Oracle let me see if go bigger I think this is to Big so we are using the Oracle binding and we using result and we are using version so what we do here is basically we uh
Request the client and this is specifically for the rust Oracle binding we can basically access the client from from the version object and basically show the Oracle client version and that is fetched locally so if you if we remove for example all of these and we
Just run this a connection is not even necessary so that doesn’t mean that it’s working because we’re fetching the local client okay uh but that means that instant client at least means that instant client is correctly H configured because we have been able to fetch the instant client version now we want to
Connect to the uh to the server right so in order to connect to the server uh we are going to do uh you know uh a connection connection connect admin webinar and we are going to use one of the entries in the TNS profile with TS
TS names. Ora and this is inside the wallet you choose one of these uh elements inside the wallet okay and you basically connect and we are going to fetch the server version so I’m going to run that run that now for example and I
And I as I showed you before uh we start from from here and I do Intel and I basically switch into Intel all right and I’m going to do uh cargo run and I need to Target specifically that uh you know uh infrastructure sorry to Target that
Uh CPU type and as you can see we got the server version so this means that we connected to the server so what is it that that we did to actually get this connection provide a proper connection information which is the uh this is the password that I chose for for this
Webinar okay and this is the admin password not the wallet password the profile admin and one of the entries in the TS TS name soraa which is inside the uh wallet okay so uh and then we ask for the connection version all right so let’s do uh an example that it’s a
Little bit more uh more interesting basically where we are actually quering data all right so let me do this I’m going to use the same uh cargo do tol so basically the same dependency and I’m going to paste it here I’m going to do save okay I’m going to explain in a
While but first I want to run it because I want you to see first what the out this all right let me just save save first that be good I think I have an issue here one second oh we are in the S sorry sorry for
That well the outut was the same anyway so don’t worry now we’re going to run okay so as you can see I’m basically getting like you know a different names for the different you know categories of movies and the sales for each category okay so this is what we’re are doing and
This is coming straight from the database so let’s analyze what’s going on here we are using Oracle uh the cargo DOL is exactly the same okay and we are using Oracle uh and we are using the same connection information that I used before but now I’m crafting my SQL here
Crafting my my SQL uh plain SQL okay and I’m creating a statement and I am building uh basically I need to provide the SQL and build a statement so this translates into a tree of that SQL okay and and then to that statement I basically passing uh creating a query
I’m I basically starting a query from that statement and I’m saying this five basically I’m saying you know pass the uh pass the uh the parameter five to the quer because we want to fill this top sales here you know top sales parameter
So then I get I go into a for Loop where I basically get the row column info which is this name and sales that I want to fill in I can get the column info and then I just cycle through the rows and print the you know the name of the genre
And the sales number right so this is basically a four that I’m going through with h in those row Then I then I close the connection and then I do an okay okay so if you take a closer look at the other Library so let’s take a look at the uh civil
Library so this one is R Russ Oracle let’s take a look at the Civil library and let me just fill in the correct information here just one sec okay this this Cil I’m going to show you exactly the same okay uh exactly the same uh functionality let’s take a look at the
Cargo okay and but uh the let me show you the difference in the cargo when I use the Civil Library okay I’m going to save there I need to basically use civil I’m not using Oracle anymore I use civil I pass the version and I basically have
To say that I’m going to use the blocking version because civil has blocking and non-blocking so you specifically need to uh sign signal out that you want to use one or the other so I’m going to say blocking and you will see that the code is actually very
Similar here we rely on an oracle environment and basically we we say Okay use civil as Oracle so things look even more similar because we start using Oracle but it’s actually civil behind the curtains okay connection information uh I’m using Oracle connect and I’m basically passing the same data the the
Username the password and the profile in the TS names Aura which is in the wallet I’m crafting my SQL okay I’m also passing an argument to the query which is in number five and then and then I’m going through a while uh you know
Cycle uh where uh I go row by by row and print things the Civil to my know doesn’t provide uh the way to get the column names so I could not find how to get the column names here you will see that that that’s not available and also
It wasn’t necessary to close a connection as you can see here maybe maybe we should but you know the code just works just fine so let me just go and do that remember that we are still in Ino mode because this is yellow right so I’m going to go back to the other
Project right and now I’m going to run it right and this is connecting to the database the database is in always free tier autonomous database running in the cloud and also getting the same information from the from the same table look at what happens if we exit the Intel mode okay just copy
This oh looks like it’s working see apparently because I’m using the Target right I think that because I’m using the target then it’s targeting uh or maybe maybe running Rosetta behind the curtains like uh automatically so last time I checked I was having issues but anyway if I do Intel come back to
Intel Mo mode with Rosetta and basically everything is set up the good thing about the Rosetta environment is that it keeps the keeps the environment basically keeps me in the same directory etc etc okay so yeah I thought I it was going to fail but basically it
Worked so if you if you have comments on that let me know all right so let’s do one last uh because we are out of time already let’s uh take a quick look at uh how to do H inserts okay because we have seen how to do uh
Queries uh we are going to use just give me one sec we are going to use R rust Oracle not civil uh yes just let me find the right code here looking for the right code just give me a sec I cannot find it just one sec there you go I found
It so we are going to do to use rust Oracle for that let me go here right let me paste it here let me save and this is the last piece of code that we will see uh I’m going to be on Intel I’m going to
Do all okay and I’m going to run it I’m going to show you the the output first and then I’m going to show you the code so we have inserts we insert some rows in a table that we created called T then we updated those items changed all the names to
Where the streets have no name and then we deleted a few R rows okay and I wanted to show you how that works from Ras Oracle and we are done and we can do a couple of questions before the top of the hour all right so let me go back to
Uh the code here all right so let’s go to the top connection same way uh to connect exactly the same way now we craft our SQL but this time instead of being a select you know we craft a drop table SQL and we create a create table
SQL you might be familiar with this because there is a lot of SQL developers in the stock and then instead of using query uh we we use execute we can execute this uh statements about you know creating tables dropping tables inserting Etc with con execute so we just do that
Okay and and and here we deleted the table because you know I’ve been running this example like multiple times so we need to delete the table we deleted the table and we created a table now here we have an empty table right so we have
Some data and we have this as tles you know here defining rust now we want to create an insert statement but how how can we insert three things so we create the insert into statement and we put the values as place folders or parameters okay now here we do create a statement
We build a statement same like like we did with the the SQL H select statement that I showed you before we have to build it okay and once we build it we can actually execute them by passing the parameter so this will execute three times which is the three items that we
Have here in this four this will execute three time times and put the different parameters for each row there and execute the insert okay I’m doing you will see that I’m doing several commits here because uh I had some issues with parel basically the system expecting a
Commit and not doing too many things at the same time uh and then I’m showing with display rows I’m showing the the the the RS it’s basically going doing a for through the rows and showing the routs okay then I do an update uh statement and I execute it directly
Where I execute everything uh in the address I basically put where the have no name and then I delete uh you know a few uh I delete from the table where the ID is equal to three and this is also an execute statement and then that’s it
Basically there we have a bunch of commits and and a close okay so let me go back to the um we we won’t have time to see non-blocking code uh the code is there is in my in my chest okay so if you want to see how to do n blocking which is
Basically async uh you can take a look at the at the code there it’s very simple it’s basically the same but adding some async codes right so uh very quickly if you’re using these uh drivers and this is an example the go driver go drawer you will see that the
Architecture can get very deep like for example you go from from from the go language to the cgo libraries that are the libraries that allows you to use C libraries then you go through ODP o ODP I and then you go to the Oracle code interface so that’s a four level
Architecture right so stuck in multiple rappers might result in a lack of performance so for example here cgo takes 99% of CPU utilization and if you are going to ship an application with this type of you know bindings you also need the Oracle client Library so you have your customer
To install the libraries or they should come with the application and should be installed so you know it’s not super super straightforward what are the Alternatives uh here so so you could use rest apis for example we have something called ORS that basically exposes apis in the Oracle database and you can use
Rest and do HTTP request from go from Russ from whatever you want this is usually very very fast and and uh you could also do something like this for example there are some uh use cases that are doing something like this and this is from a very uh this all comes from a
Very nice blog post by Goran toik by from a company called cintio where he was trying to measure the performance of The Go binding compared to doing something like this okay so you might run spring boot uh with Java and just use jdbc to connect to the Oracle
Database and this usually gave Goran better performance than the actual go binding but the go binding is a very special case because it’s four level architecture and it’s using those uh cgo libraries that basic basically take 99% of the CPU when you do a database call
Which is huge okay all right so I’m done for today let’s hope we can do another session just like this to go deeper into the usage of the rust with the autonomous database there are more things that we can do but I hope that I
Can get you up and running and ready to play you know and do all your testing uh go ahead grab you know the always free tier on on the Oracle database and let’s go to a quick round of questions if time vieta uh okay we are over the hour a bit
But I would propose to take some of the questions if the our customers would like to uh stay with us for a couple of minutes or so so let’s quickly jump and just check the ones that we didn’t touch um Herman because we we did answer some of them okay so
Which one shall we take I I I’ve got a few that I responded to vet if you want me to choose CH choose an easy one okay so there was there was a few people Anonymous so I’m not too sure this was always the same same person but there
Was one uh they had plugins and links and any API libraries so wondering had you used any of them Herman setting this up and if you did could you share them PL and links uh in API libraries was the second that they had anything that you
Added so um I I think it’s probably covered in your notes but I just thought I’d raise it as a yeah I’m not sure if he’s talking about the prerequisites like what type of plugins I’m using Vis Studio code so you can see see them here
Uh I I think that’s what it was about but again Anonymous if it’s not feel free to post back yeah yeah anyway they can use SL you know you can slug me in in the SL okay okay there was uh one by Abes I hope I have’t butcher to D dude
But um uh he’s using powerbi in Tableau I know this this is me potato to you being a ATP dude but he wants to know kind of connect to ATP and it’s very similar like for example some people are using Tableau and some people are using python for example they
Used to be uh if you take a look at this they used to be uh uh python binding called CX Oracle which now has been rebranded to python Oracle DB okay so it’s basically the same thing you need to expose the libraries of the instant client to the proper bindings and then
Connect uh there there should be a a binding for Tableau I think that there should be some kind of binding for Tableau or you can do it from python for example or you can do it from from Ras if you want but basically those uh what
You need to expose is you need to have the instant client and you need to have it in the path for the shared shared libraries or dynamic libraries okay so from python for example you can connect to Tableau and you will have to do an very similar exercise that I show you
Today all right okay all right another one by letter do you want me to keep going or what what do you want to do yeah please do please do okay um uh there was one um I there a whole raft from Anonymous but again I think it’s the same person but
I’m not too that’s always the danger of logging in as anous but anyway uh um there’s a whole stuff on projects uh converting and stuff like that but honestly dude I I don’t think we’ve got time Anonymous if you can join us on slack and follow up with that we can get
Someone to help you on that because there’s a lot going on on some of them right there was one by otus is there a tendency to choose Apex over rust or rust over Apex uh Apex over what over rust oh over rust yeah yeah well uh a Apex is a way
For you to declare the the application rather than coding so the differ the the question should be do you want to code or you want to Define in high level what the application should be doing it’s like a you know different way of working so you define the screens you define
What the application should be doing and the code gets generated for you in Apex now what if you really want to code you should go with Russ because you can do some some actual coding there so it’s a different mindset a different way of working uh remember one one thing
Remember that you guys you folks can access the code uh in g. github.com haramis it’s available there and all the code is there for you to play okay I just wanted to reiterate that uh okay um there’s a lot more on deploying projects but again Anonymous that’s probably way too big uh for
Trying to cover here in a couple of minutes uh and we wouldn’t do your question Justice I AG but how can you use for rafic how can you use it for business application like extension for Oracle application I guess you’re talking about roster uh how to use rust for for for an oracle
Application yeah uh I yeah I I must say that I don’t have experience you know how to create like rust uh extensions or plugins from specific Oracle uh applications we will have to take a closer look at what is allowed in terms of rust in those applications and if you
Just go uh Russ code okay from uh maybe you can create a a plug-in in Russ you’ll have to make sure that you can access the Instant client libraries so that would be the prerequisite you know you’re running this rust environment maybe inside a plugin and Oracle application if those libraries are not
There then you won’t be able to connect using like Oracle Ras Oracle or civil the libr have to be available and If the uh machine is constrained you know I don’t have access to it Etc that might be a problem because you know I might
Not be able to to install the client but fortunately the libraries come with the Oracle database installation so if that machine that is running the Oracle application is running the database the libraries are also there you don’t need the instant client so you have a replacement for the instant client which
Is the data itself and their directories you will find the shared libraries there okay cool um just just sorry they just on the anonymous one just probably clarify we’ve no way of knowing who you are so if you want to Ping us on chat right now you’re if you were asking
Those questions about transiting projects and moving projects and stuff if you post it on chat we can follow up with you on email or you can join us on slack and we we’ll follow up with any questions that you got there yeah one one more thing we are going to share the
Deck and if you take a look at the at the short links on the top right on the slides you’ll be able to access all the resources like the 50 minute tutorial uh the code the blogs that I refer to Etc ET so please grab the deck because it’s
A perfect preference for you to get up on running okay thank you Herman uh and by the way the deck will be shared with you on slack uh in a couple of uh minutes today and if you can’t join slack feel free to email us at contact
Dd6 Dasia and we will share it U with you there um also for today I would only like to use two minutes of your time it’s really important uh to share some some information and then we will uh we will close the call so um the first and um the most
Important um thing that you need to be aware and I see that uh so many of you were not familiar with the cloud coaching program that we usually run so FYI we host events on a weekly basis every Wednesday same hour as today there will be a session in the schedule uh
Always a demo we try to build these Cloud coaching sessions based on your needs so thank you all for joining this call Herman thanks a lot for um um giving us the pleasure to have you back at Cloud coaching we hope to see you soon again we hope you enjoyed the
Session and uh of course we hope to see you uh soon bye-bye and enjoy the rest of the rest of the day byebye take care thank you bye Bye
Video Keywords: Oracle Database
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
Great and inspiring session on OADB for Rust Developer
Rust ❤
Today is fantastic moment because of Database management system development we see more …