Section 1 I’ll discussed
how to create odbc connection and write php code to get information from
database to URL.
Part
I: Create an ODBC connection.
Start MSSQL server Management studio.
Select SQL Server Authentication, Login Username and
Password. Click Connect.
Left Side panel you can see Databases you created
already.
Open the Administrative Tools icon in your
Control Panel.
Double-click
on the Data Sources (ODBC) icon inside.
Choose the
System DSN tab and Click
on Add in the System DSN
tab.
Select the
SQL Server Driver. Click Finish.
In the
next screen, give Data Source Name. (This is very important. You should
remember this) and select your sql server.
Select
second radio button. Give Login ID and Password (It should be same as your SQL
server Login ID and Password)
If
you connect with MSSQL server using Windows NT authentication, Select first
radio button. Then you don’t need to give any username or password.
Click Next and choose Database.
Click Next and then Finish.
Then it appears Test Data source window.
If you successfully connect, you will able to see
this prompt.
----------------------------------------------------------------------------------------------------
Part
II: write PHP code to retrieve information from MSSQL Server
Start wamp server. Go to www folder and create new
folder and rename it.create .php file inside that folder and write below code
into it.
The
odbc_connect() function is used to connect to an ODBC data sourceThe function
takes four parameters: the data source name, username, password, and an
optional cursor type.
The
odbc_exec() function is used to execute an SQL statement.
The following example creates a connection to a DSN called “firstsql”, with my username and password.and
also I wrote sql query to select information from Dept table which located in AndroidAppDB database.
Json encode is used to encode data to Jason array.
After that run http://localhost:81/my%20project/first.php.You
will able to see this.
Next section I’ll create android app to get
information from this URL. To be continuing…
Thanks for sharing such informative post
ReplyDeleteWeb Design company in Hubli | web development company in Hubli | web designers in Hubli | IT companies in Hubli | Web Design Companies in Hubli | Software Companies in Hubli
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeleteJava training in Chennai
Java training in Bangalore
I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing.. Believe me I did wrote an post about tutorials for beginners with reference of your blog.
ReplyDeleterpa training in bangalore
best rpa training in bangalore
RPA training in bangalore
rpa course in bangalore
rpa training in chennai
rpa online training
I found your blog while searching for the updates, I am happy to be here. Very useful content and also easily understandable providing..
ReplyDeleteBelieve me I did wrote an post about tutorials for beginners with reference of your blog.
Selenium training in bangalore
Selenium training in Chennai
Selenium training in Bangalore
Selenium training in Pune
Selenium Online training
Really great post, Thank you for sharing This knowledge.Excellently written article, if only all bloggers offered the same level of content as you, the internet would be a much better place. Please keep it up!
ReplyDeleteAWS Training in pune
AWS Online Training
This comment has been removed by the author.
ReplyDeletewhat is azure
ReplyDeleteazure trial account
azure data factory
adf interview questions
azure certification path
azure traffic manager
cloudkeeda
cloudkeeda