Sql Web App Mac

Postgres.app is a full-featured PostgreSQL installation packaged as a standard Mac app.It includes everything you need to get started:we’ve even included popular extensions like PostGIS for geo data and plv8 for JavaScript.

Postgres.app has a beautiful user interface and a convenient menu bar item.You never need to touch the command line to use it – but of course we do include all the necessary command line tools and header files for advanced users.

Visual Studio 2019 for Mac. Develop apps and games for iOS, Android and using.NET. Download Visual Studio for Mac. Create and deploy scalable, performant apps using.NET and C# on the Mac.

SQuirreL SQL Client is a graphical Java program that will allow you to view the structure of a JDBC compliant database, browse the data in tables, issue SQL commands etc, see Getting Started and Introduction. The minimum version of Java supported is 1.8.x as of SQuirreL version 3.8.1. Aware IM automatically generates everything: database tables, relationship tables, SQL queries, web forms, GUI widgets, web services etc. While you have the ability to write Javascript and Java plugins, use your own HTML/CSS and add stored procedures, for the most part this is not required.

Postgres.app can install minor updates automatically, so you get bugfixes as soon as possible.

Installing Postgres.app

  • Download ➜ Move to Applications folder ➜ Double Click

    If you don't move Postgres.app to the Applications folder, you will see a warning about an unidentified developer and won't be able to open it.

  • Click 'Initialize' to create a new server

  • Configure your $PATH to use the included command line tools (optional):

Done! You now have a PostgreSQL server running on your Mac with these default settings:

Hostlocalhost
Port5432
Useryour system user name
Databasesame as user
Passwordnone
Connection URLpostgresql://localhost

To connect with psql, double click a database. To connect directly from the command line, type psql. If you’d rather use a graphical client, see below.

NOTE: These instructions assume that you’ve never installed PostgreSQL on your Mac before.If you have previously installed PostgreSQL using homebrew, MacPorts, the EnterpriseDB installer, consider removing other PostgreSQL installations first.We also have instructions for upgrading from older versions of Postgres.app.

Graphical Clients

Postgres.app includes psql, a versatile command line client for PostgreSQL.But it’s not the only option; there are plenty of great graphical clients available for PostgreSQL.Two popular tools are:

pgAdmin 4 is a feature rich open source PostgreSQL client.It has support for almost every feature in PostgreSQL.The only downside is that the cross-plattform UI really doesn’t live up to the expectations of a native Mac app.

Postico on the other hand, is a very modern Mac app.It’s made by the same people that maintain Postgres.app, and we think you’ll like it! We put a lot of effort into making it a joy to use.However, it doesn’t have the extensive feature set of pgAdmin, and it’s a commercial app rather than open source.

Aside from those two options, there are a lot more to choose from! Check the documentation for a list of amazing Mac apps for PostgreSQL.

How to connect

After your PostgreSQL server is up and running, you’ll probably want to connect to it from your application.Here’s how to connect to PostgreSQL from popular programming languages and frameworks:

PHP

To connect from PHP, make sure that it supports PostgreSQL. The version included with macOS doesn't support PostgreSQL. We recommend MAMP for an easy way to install a current version of PHP that works.

You can use PDO (object oriented):

Sql

Or the pg_connect() functions (procedural):

Python

To connect to a PostgreSQL server with Python, please first install the psycopg2 library:

Django

In your settings.py, add an entry to your DATABASES setting:

Flask

When using the Flask-SQLAlchemy extension you can add to your application code:

SQLAlchemy

Ruby

To install the pg gem, make sure you have set up your $PATH correctly (see Command-Line Tools), then execute the following command:

Rails

In config/database.yml, use the following settings:

Sinatra

In config.ru or your application code:

ActiveRecord

Install the activerecord gem and require 'active_record', and establish a database connection:

DataMapper

Install and require the datamapper and do_postgres gems, and create a database connection:

Sequel

Install and require the sequel gem, and create a database connection:

Java
  1. Download and install the PostgreSQL JDBC driver
  2. Connect to the JDBC URL jdbc:postgresql://localhost

For more information see the official PostgreSQL JDBC documentation.

C

libpq is the native C client library for connecting to PostgreSQL. It's really easy to use:

Now compile the file with clang and run it:

Swift

You can just use the C API in Swift! First include libpq in your bridging header:

Then make sure to link with libpq.

On iOS, you'll need to build libpq yourself.

On macOS you can use the system provided libpq (does not support SSL) or use libpq provided by Postgres.app by adding the following build settings:

Other Linker Flags-lpq
Header Search Paths/Applications/Postgres.app/Contents/Versions/latest/include
Library Search Paths/Applications/Postgres.app/Contents/Versions/latest/lib

Now you can use the libpq C library to connect to PostgreSQL:

Support

We have a list of common problems in the troubleshooting section in the documentation.

For general questions concerning PostgreSQL, have a look at the official PostgreSQL documentation.

If you have a question concerning Postgres.app that is not answered by the Postgres.app documentation,you can ask @PostgresApp on Twitter, or open an issue on GitHub.

When reporting bugs, let us know which version of Postgres.app & macOS you are using, and be sure to include detailed error messages, even if your issue seems similar to another one.

License

Postgres.app, PostgreSQL, and its extensions are released under the PostgreSQL License. The released binaries also include OpenSSL (OpenSSL License), PostGIS (GPLv2), and plv8 (3 clause BSD).

Postgres.app is maintained by Jakob Egger. It was originally created by Mattt Thompson.

By: Graham Okely | Updated: 2014-12-26 | Comments (1) | Related: More >Application Development


Problem

You are an experienced SQL Server DBA and you wishto use PHP to provide some front end web pages to help with monitoring andmanagement. How do you setup PHP and SQL Server? What are the steps? Whatneeds to be installed? Can you provide any checklists?

Solution

Here are some tips on building a development environment for PHP and SQL Server.Using mychecklist will help you cover each point.

Step 1: Reboot Server/PC/Laptop

Install all Windows Updates and reboot your server. Backup anything important just in case.

Step 2: Install SQL Server

Get SQL Server up and running on your machine.In my case I used my basic desktop that already had SQL Server 2012 Express running.

Here are SQL Server installation related tips:

Here are SQL Server Express Edition related tips:

Step 3: Install PHP

If you are installing PHP on a Windows desktop system use this guide: Microsoft Web Platform Installer.

'The Microsoft Web Platform Installer (Web PI) is a free tool that makes getting the latest components of the Microsoft Web Platform, including Internet Information Services (IIS), SQL Server Express, .NET Framework and Visual Web Developer easy. The Web PI also makes it easy to install and run the most popular free web applications for blogging, content management and more with the built-in Windows Web Application Gallery.'


The installer works well. Click on the green 'Free Download' button. Then run the wpilauncher.exe application that was downloaded. Click on the Applications button and then search for PHP. Add the PHPversion most relevant to your system. Note that you can install the Microsoft Drivers for PHP at this point, but I explainthe installation more later in this tip. As a DBA I choose NOT to install SQL Server via this Web Platform Installer.

Note the installation folder that PHP uses.

Accept agreement.

A few applications to install.

Install the SQL Server drivers for PHP.

Confirm the applications installed.

At this point reboot your computer and ensure all is working correctly.

Step 4: Internet Information Services (IIS)

The next step is getting Internet Information Services (IIS) running. First see ifthe application is running. Start a browser and type in localhost as the URL and see ifa basic page is displayed. If not, then you need to start IIS. In Windows click onthe Start button and the Run option in Windows then enter 'inetmgr' as documented in thisMicrosoft web site. Click on the start linkas shown below to get IIS up and running. If your operating system does not support this command then searchMicrosoft TechNet.

To test if IIS is running start a browser. Then enter 'localhost' as the URL and refresh the browser. If this error message is displayed then IIS is NOT running.

Microsoft Sql On Mac

A blank browser will mean IIS is running, but no local file was found to display.

Step 5: Configure IIS

Next you need to configure IIS. First we need to turn on FastCGI. 'FastCGI reduces overhead associated with interfacing the web server and CGI programs'.

Click on Start -> Run and type optionalfeatures.exe and click OK. Then expand Internet Information Services -> World Wide Web Services -> Application Development Features -> enable CGI -> click OK and wait until the installation is complete.

Next we need to tell PHP that we have enabled FastCGI. We do that in the php.ini configuration file. When you installed PHP you should have noted the installation folder. Mine is in C:Program FilesPHPv5.3php.ini

Backup *.ini files like this prior to editing them. Simply copy the file and place it in a backup folder first thenedit the original file with your favorite editor.

Search for the section titled [WebPIChanges] and edit or add these settings.

Next we set the PHP handler mapping. What this does is tell the browser to run the PHP.exe command when it encounters a file with an extension of*.php.

Open the dialog box by clicking on Start in Windows then click on Run and type inetmgr and click OK. In the manager double click on Handler Mappings and then click on Add Managed Handler.

Add the details and click OK.

Restart IIS or even your server to ensure all is OK.

Your Handler Mappings should show *.php allocated.

Your FastCGI Settings should show the path to php-cgi.exe. Reboot your machine again.

If you get stuck use this resource -FastCGI Configuration.

Microsoft Sql Server For Mac

*** NOTE *** - For Mac users install or enable Apache and PHP on a MacBook

I decided to use PHP as the front end because I learned PHP at University and PHP could run on my Mac and Windows systems. I choose to configure my Mac after I had PHP running on my Windows machine. If you have a Mac with OS X try thisresource for enabling Apache.

Mac OS X comes bundled with PHP. Here is a guide for enabling PHP on OS X.

Note that the Mac will not actually connect to the SQL Server directly. The Mac can use the PHP pages on your chosen server. The PHP pages on the machine running SQL Server use the SQL Server PHP drivers to access SQL Server. You can develop pages on the Mac, but copy them to the Windows machine when they need to connect to SQL Server. You may ask why then have PHP on the Mac? The answer is that I can develop pages remotely.

Step 6: Confirm PHP runs on each machine

The usual method to confirm PHP is installed and available to you is to 'run' a simple command.The command is echo phpinfo(); Follow these steps to do that:

Step 1

Find your 'DOCUMENT_ROOT'.
The 'DOCUMENT_ROOT' is the folder that holds the files that the web service can see.
Note that the 'DOCUMENT_ROOT' folder is actually an IIS setting.
So start inetmgr again and right click on 'Default Web Site' and choose explore.
Windows Explorer will open up at your 'DOCUMENT_ROOT'.

Step 2

Save thissnip of PHP into a file called phpinfo.php

Step 3

Place that file into your 'DOCUMENT_ROOT' folder.
On my machine that was C:inetpubwwwroot by default. This is the PHP code in that snip of PHP.

The echo means display and the phpinfo() function returns all the data associated with PHP and your machine. Note: It is a PHP file and needs to be located in or below the 'DOCUMENT_ROOT' on my system that is C:inetpubwwwrootIndex.php

IIS and PHP work together to process PHP commands and display the result in your computer browser. For example the result of the command phpinfo() should show something like this:

And so on.... as the result is a lot of data.

Step 7: Configure PHP for the SQL Server drivers

Now we need to tell PHP, via a configuration file, about those SQL Server drivers.
Locate your php.ini file by looking in the phpinfo output page.
Mine is located in C:Program FilesPHPv5.3php.ini
The PHP.ini file is the main PHP configuration file. Be careful with it.
Copy that file into a backup folder to back it up before editing it.
Edit the file using your favorite editor.
Then add these two driver names to it. Under the [ExtensionList] section.

If you get stuck try this blog on SQL Server drivers.

Reboot your machine.

Server

Step 8: Create a SQL Server Login and User for Database Access

Don't use thesa login to access SQL Server from your PHP pages. (Did I need to say that?) Create a specificlogin and user name. In terms of naming conventions, if you are you just getting reportingdata from SQL Server then try a login name like 'Report_Reader'. Or if you plan to read and writeconsider a login name such as 'Data_User_RW'. Make your life easy by using names thatare intuitive. Here is some T-SQL below to create a login called 'Author_RW'.

I generally recommend using themasterdatabase as the default database for your logins rather than the userdefined database just in case you drop your database or it is inaccessible. On start-up SQL Server should have master available and so your login should be able to access the SQL Server instance.

Grant that user read and write access to your database or whatever permissionsare needed. In my example, I will adddata reader permissions to themsdbdatabase to allow the user to readdatabase backupinformation.

Tip: Immediately test that login to access your SQL Server instance viaSQL Server Management Studio.Enter the Server Name, for Authentication choose 'SQL Server Authentication' andenter the user name as well as the password.

Do not proceed until that login is working as expected.

Step 9: Create a PHP page to test the SQL Server connection

Here is a basic connection method for PHP to SQL Server.
Find your 'DOCUMENT_ROOT' as per step 6.

Create a file called Index.php and save that 'DOCUMENT_ROOT' folder.

To connect PHP to SQL Server we need these settings:

Download

At this point if you do not know PHP then try some tutorials or find a good bookat your local library.

Now we use those settings to connect using the command sqlsrv_connect. If the connection fails we will see the errors.

For the initial connection let us check the last backup dates. Note Iconvert the dates as it is simpler to display the dates in PHP that way. I found fields as normal SQL Server DATETIME format did not display by default using PHP.We will use sqlsrv_query to query the database. When using PHP the period '.' is the concatenate command.

Hopefully you can see we have extracted an array out of SQL Server. Then we use the PHP while loop to display the results.

Save all that PHP code above into your 'Index.php' file, here is a samplefile -click here. Unzip and place that file in the 'DOCUMENT_ROOT' as per step 6.

Step 10: Confirm your first PHP page has produced results

Start your browser up and type in localhost/Index.php as the URL.

Congratulations. If you are this far along you are doing well.

If you have no results examine your php file and make sure you have the semi colon at the end of each line in PHP or the whole page fails to load!

Then check the SQL Server logs and see if there is an error there.

Tips

  • PHP single line comments are //
  • PHP multi line comment begin with a /* and end with a */ Use these to debug portions of your code.
Next Steps
  • Design the folder structure for your projects under the document root:
    • Use CommonCode as the main folder for common code, header, footer, etc.
    • Use Configuration as the folder for XML configuration settings or your database connection settings.
    • Create a Backup folder under Configuration for copies of things like php.ini
    • Use CSS as the folder for CSS files.
    • Date display is tricky in PHP and T-SQL. Try a CAST or CONVERT as shown intip 1145.
    • Revisit mychecklist for SQL Server and PHP.
    • Visit Moodle a PHP open source eLearning system.
    • Visit php.net

Last Updated: 2014-12-26



Sql Web App Mac Download

About the author

Mac Os Sql Server

Graham Okely is a contract SQL Server DBA and has been working with database systems since 1984 and has been specializing in SQL Server since 2007.
View all my tips