Using sp_helptext on a encrypted store procedure - tsql

Yesterday I created a store procedure with encryption for an exercise purposes but I forgot to save the query.
Today I was planning to view the tsql code by using
exec sp_helptext 'procedure_name'
But since it is encrypted I can't see the code. I was wondering if there is a way to solve this?

Providing the article in the comment as an answer so that more folks may benefit
This article goes into a lot of details on how to decrypt such objects..
It talks about a basic approach using code to decrypt the code from the system tables as well as using 3rd party tools such as DAC and Optillect (which it seems does not need admin privileges)
NOTE: I am assuming you are using sql-server since you have tagged as tsql

Related

How to connect simple website to RDS PostgreSQL DB

This is possibly a broad question:
I've been teaching myself how to program for the last year. I've learned how to create simple websites using HTML, CSS, and JavaScript. I've also learned how to create simple databases using PostgreSQL. I need help figuring out how to connect (API) the front end and the back end.
A friend suggested I learn how to use AWS RDS so I've already created a PostgreSQL DB instance there (tutorial). I've also connected to my DB using pgAdmin 4 using this tutorial.
What I would like to do is have my front end take in a number as the user's input and "submit" (POST) that value in the DB. Every time the user submits a new value, the new value is saved in the DB and the cumulative values of everything POSTed is returned to the front end for the user to see.
I know this project is a bit asinine but its a start. I can't find any more links on the internet to teach myself how to do this. If you have tips or resources (web links) to help me accomplish this, I would be really grateful.
Side note - I've also been studying python for the last year if that helps.
First, connect to the database like so:
$c1 = new PDO('pgsql:host=THERDSURL;user=THEDBUSERNAME;dbname=THEDATABASENAME;password=THEPASSWORD;connect_timeout=500',null,null);
Then start a new query like so:
$statement=$c1->prepare("select * from mytable");
Then execute it:
$statement->execute();
then loop through the results like so:
while($row=$statement->fetch());
{
var_dump($row)
}
it will vary a little depending on whether you're getting data or inserting data, but begin by learning how to get (select) data. Create a table using a GUI of some kind and learn how to query it programatically.
NOTE: Most people use a library of some kind to make the querying both more powerful and less complicated.. This code is in PHP, but a very similar process is done in many languages.
Note2: do not try to do any of this in javascript that's embedded in html or that's running on a client machine. Connecting to postgres using embeded javascript is not the normal way to go about doing this. Usually people use a language like PHP, Python, Java, etc.. and that's usually running on the server-- and although you can use javascript that runs on the server, I wanted to warn you about this because newer developers might not realize that javascript running on the server vs the browser has completely different capabilities where this is concerned.

Load a PostgreSQL database using cloudconnect

On the side of my Gooddata project, I maintain a small PostgreSQL database that contains a few tables.
I would like to be able to integrate both my ETL processes using the same tool, and it seems to me cloudconnect would be the easiest way, since I already have my whole GoodData ETL in it.
Here are the ways I tried to do it without success:
I tried to have a look in the documentation, and it seems to me that all the functionalities of CloverETL that enabled this (DBOutput, PostGreSQLDataWriter) are not available in Cloudconnect.
I managed to connect to the Agile Datawarehouse Service (Database attached to GoodData), but it seems that only the ADS database is able to understand the request:
COPY MyDataBaseTable (field1,field2) FROM LOCAL '${DATA_TMP_DIR}/CIforADS.csv'
even when I adapt the syntax to PostgreSQL because the dynamic addressing I use here does not seem to work.
Is there any way to proceed that I'm missing? Can anyone think of a workaround?
In general this could be achieved by using of "DBExecute" component, but
I'm not sure if I understand it well - do you want to load data into your own Postgres instance using CloudConnect?

Login Page Using Java Spring, NetBeans, and Derby

Does anyone have recommendations for a good article on how to add a login page to a NetBeans Java Spring Web application using a Java DB (Derby) database? I want to store multiple the passwords for the login in the derby database, which will be accessed when a user attempts to sign in rather than have the passwords hardcoded in the code as most of the examples that I've seen seem to do. I am trying to keep it as simple as possible.
If you're doing this for real, not just for an academic learning exercise, be careful storing passwords.
It's extremely easy to do this incorrectly. Here's a few great resources:
http://codahale.com/how-to-safely-store-a-password/
https://security.stackexchange.com/questions/211/how-to-securely-hash-passwords
http://throwingfire.com/the-history-of-password-security/
In terms of actually storing the data in Derby, passwords (once correctly processed as above) are just data to Derby.

Umbraco: Storing spatial data

I'm researching Umbraco for use as a base in a large CMS project, however the project calls for the SQL Server 2008 database to store spatial data against content.
Being new to Umbraco I'm still reading through the documentation and slowly building up an idea of it's architecture. However so far it doesn't look like Umbraco supports the storage of spatial data.
There only appears to be four database datatype options: date, integer, ntext, nvarchar
Is it possible to store spatial data to the database?
Update: Futher research into how Umbraco works has showed me I was on the wrong track. It seems the way to do this is store the lat/long data in the data inside the usual XML format Umbraco uses.
Then to use the Spatial.net extensions that have been built on top of Lucene.net, rather than use the limited search capabilities Examine exposes.
However this is all still theoretical, I've just not been able to achieve this. If I do before someone answers this question, I'll post my findings here to help others.
You could take a look at how to make user controls (with Visual Studio) in Umbraco.
It is also possible the versatility in Umbraco 'Document Types' is enough for you.
It is possible to extend Umbraco in any sort of way to get the solution you want. I don't know how you want the spatial data to interact with your frontend - so it is difficult to provide a direct solution.
Although there are ways to store spatial data and perform queries against it using Spatial.net, it's not a very elegant solution.
Instead I've created an additional table in SQL Server 2008 with the geometry/geography datatype and a reference to the Umbraco content it's connected with.
I've then got a event hook which updates this whether content is added/updated/deleted.

iPhone: How to encrypt a string

I would like to encrypt a string with AES 256 on the iPhone but have not found much via google. What I am trying to do is post some data to a web site as part of a game I am creating, but I do not want the user to be able to cheat by seeing how it is posted because it is plain text. So I want to post one encrypted string to my php page (ala www.test.com/test.php?encrypted= etc...) and then the php script will decrypt it and do what it needs to if it is valid.
You can just use the CryptoHelper which is adopted by CyrptoExercise Sample Project
A much easier approach here would be to use an HTTPS POST, which would give you similar protections with far less code, though there are still difficulties for solving the problem you're attacking. The kind of solution you're describing generally requires some kind of shared secret, and it's very hard to protect code using a shared secret for long. You may find these posts helpful:
Machine ID for Mac
Store an encryption key in Keychain while application installation process
Obfuscating Cocoa
Still, HTTPS is probably a much better solution than AES here.
Check out this site: http://iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html