Free SQL Server ☁️
Create a Free Cloud Database & Connect to Visual Studio
Beginner Friendly
20 min read
Bonus Lesson
Get Your FREE Cloud Database! 🎯
In this lesson, you'll learn how to create a FREE SQL Server database in the cloud using Aiven and connect it to Visual Studio. No credit card required!
Why Aiven?
- ✅ 100% FREE - No credit card needed
- ✅ Cloud-based - Access from anywhere
- ✅ 5GB storage - Enough for learning
- ✅ Works with SSMS - Same tool you already learned
- ✅ Connects to Visual Studio - Build real apps!
💡 Why This Matters: You don't need to install SQL Server locally!
A cloud database works from anywhere and is perfect for learning.
What is Aiven?
In Simple Words: Aiven is a cloud platform that gives you
free databases. Think of it like renting a database server in the cloud
for FREE instead of installing it on your computer.
✅ What You Get For Free
- 📊 5 GB storage space
- 🔗 Public IP - Access from anywhere
- 🛡️ SSL Security - Your data is safe
- 📈 Monitoring - See how your database performs
- 💾 Backups - Automatic backups included
- 🌐 24/7 Availability - Always online
💻 Who Uses Aiven?
- 🎓 Students - Learning SQL
- 👨💻 Developers - Testing apps
- 🏢 Startups - Building MVPs
- 📱 Mobile Apps - Backend databases
- 🌐 Web Apps - Production databases
💡 Pro Tip: Aiven is used by thousands of
developers worldwide because it's free and reliable!
😂 Fun Joke: Why did the developer choose Aiven?
Because they wanted to have their data in the cloud... without paying for rain! 😅
Step-by-Step: Create Your Free Database
STEP 1 Create a Free Aiven Account
- Go to aiven.io (opens in new tab)
- Click "Start Free" or "Sign Up"
- Choose "Sign up with Google" or enter your email
- Create a password
- Check your email and verify your account
✅ Done! You now have a free Aiven account.
No credit card required for the free tier!
No credit card required for the free tier!
STEP 2 Create Your Database
- In the Aiven dashboard, click "Create Service"
- Select "Microsoft SQL Server" as the service type
- Choose the "Startup" plan (it's FREE!)
- Pick a cloud provider and region (choose one near you)
- Give your database a name (like "MyFirstDB")
- Click "Create Service"
⏱️ Wait a moment... It takes 2-3 minutes for your database to be ready.
Grab a coffee! ☕
STEP 3 Get Your Connection Details
- When the service is ready, click on it
- Go to the "Connection Information" tab
-
You'll see:
- Host: Like "your-database.aivencloud.com"
- Port: Usually 5432
- Database Name: "defaultdb"
- Username: "avnadmin"
- Password: (the one you set)
- Click "Download CA Certificate" for security
⚠️ IMPORTANT: Save your connection details somewhere safe!
You'll need them to connect from SSMS and Visual Studio.
STEP 4 Connect from SSMS
- Open SSMS (SQL Server Management Studio)
- In the Server Name field, enter your Host from Aiven
- Select "SQL Server Authentication"
- Enter Username and Password from Aiven
- Click Connect
/* Connection Example */
Server: my-database.aivencloud.com
Port: 5432
Authentication: SQL Server Authentication
Username: avnadmin
Password: YourPassword
🎉 Connected! You can now run SQL queries on your cloud database!
Connect to Visual Studio
Why Connect to Visual Studio? You'll use this database in your C# apps!
📝 Connection String
This is the magic string that connects your C# app to the database:
// Your Connection String
"Server=my-database.aivencloud.com,5432;" +
"Database=defaultdb;" +
"User Id=avnadmin;" +
"Password=YourPassword;" +
"TrustServerCertificate=True;" +
"Encrypt=True;"
📌 Keep this string - you'll use it in every C# project!
🎯 Step-by-Step
- Open your C# project in Visual Studio
- Go to Tools → Connect to Database
- Select Microsoft SQL Server
- Paste your connection string
- Test the connection
- ✅ Connected!
🎉 You're ready! You can now use this database in your C# apps!
💡 Pro Tip: Store your connection string in
appsettings.json
or App.config so you can change it easily!
Let's Practice! 🎮
Your Challenge: Set up your free Aiven database and connect from SSMS!
Your Mission:
-
Create Aiven Account
- Go to aiven.io
- Sign up for free
-
Create Database
- Choose Microsoft SQL Server
- Select Startup plan (FREE)
- Name it "MyFirstCloudDB"
-
Get Connection Details
- Copy Host, Port, Username
- Save your password
-
Connect from SSMS
- Open SSMS
- Enter connection details
- Connect successfully
-
Run a Test Query
- Write
SELECT @VERSION; - Press F5 to run it
- See your cloud database version!
- Write
💡 Test Queries to Try:
-- Test 1: Check version
SELECT @VERSION;
-- Test 2: Create a table
CREATE TABLE TestTable (
Id INT IDENTITY(1,1) PRIMARY KEY,
Name NVARCHAR(50)
);
-- Test 3: Insert data
INSERT INTO TestTable (Name)
VALUES ('Alice'), ('Bob');
-- Test 4: View data
SELECT * FROM TestTable;
// ===== CONNECT TO AIVEN FROM C# =====
// Full working example for your C# application
using System;
using System.Data;
using Microsoft.Data.SqlClient;
public class CloudDatabaseExample
{
// Your Aiven connection string
private static string connectionString =
"Server=your-database.aivencloud.com,5432;" +
"Database=defaultdb;" +
"User Id=avnadmin;" +
"Password=YourPassword;" +
"TrustServerCertificate=True;" +
"Encrypt=True;";
public static void Main()
{
// 1️⃣ Connect to the database
using (var conn = new SqlConnection(connectionString))
{
conn.Open();
Console.WriteLine("✅ Connected to Aiven cloud database!");
// 2️⃣ Run a query
string query = "SELECT @VERSION";
using (var cmd = new SqlCommand(query, conn))
{
string version = cmd.ExecuteScalar().ToString();
Console.WriteLine($"📌 SQL Server Version: {version}");
}
}
}
// 3️⃣ Example: Get data from a table
public static void GetStudents()
{
using (var conn = new SqlConnection(connectionString))
{
conn.Open();
string query = "SELECT * FROM Students";
using (var cmd = new SqlCommand(query, conn))
{
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine($"Name: {reader["Name"]}");
}
}
}
}
}
}
✅ Complete C# Code!
You can now use your free cloud database in C#!
🎉 What You Learned Today!
Aiven
Free cloud databaseCreate Database
5GB free storageSSMS Connection
Connect from anywhereVisual Studio
Build C# appsConnection String
Your magic keySSL Security
Your data is safeReady!
For real C# projects!🎯 You now have a FREE cloud database ready for your C# applications!