1. Olivier PAVLIN
  2. SnapDevelop
  3. Tuesday, 3 December 2019 16:41 PM UTC

Hi,

I am following this tutorial and I was abble to publish my web service to Docker.

https://docs.appeon.com/appeon_online_help/snapdevelop2019r2beta/Publishing_a_Project_with_Docker.html

 

But I have a question about database driver, I am using the .Net DataStore and an ODBC driver to connect

services.AddDataContext<SQLAnywhereDataContext>(m => m.UseOdbc(..))

 

But if i use my connection string  "Driver={SQL Anywhere 12};host=192.168.x.x:xxxx;uid=admin;pwd=admin",

 

How does my Linux Docker container knows about SQL Anywhere 12 driver ?

Accepted Answer
Olivier PAVLIN Accepted Answer Pending Moderation
  1. Thursday, 19 December 2019 13:37 PM UTC
  2. SnapDevelop
  3. # Permalink

Ok i managed to make it worked. So my solution for the moment is based on this docker image https://hub.docker.com/r/senscode/sqlanywhere12

Here is the exact solution :

1) pull the sqlanywhere12 image :

(in powershell)
docker pull senscode/sqlanywhere12:latest

2) extract the sqlanywhere12 files from it to your computer (ex : in new folder "unix" on your desktop)

docker cp sqlanywhere12:opt/. "C:\Users\"youraccount"\Desktop\unix\."

3) create a new Dockerfile somewhere (ex : C:\Users\"youraccount"\Desktop\) with this code inside :

FROM microsoft/dotnet:2.1-aspnetcore-runtime
EXPOSE 80
EXPOSE 443

RUN apt-get update
RUN apt-get install unixodbc-dev unixodbc-bin unixodbc -y

ENV LD_LIBRARY_PATH /opt/sqlanywhere12/lib64

4) Build it with docker :

docker build -t base-sqlanywhere12-dotnet:2.1-aspnetcore-runtime -f "C:\Users\"youraccount"\Desktop\Dockerfile" "C:\Users\"youraccount"\Desktop"

5) Copy the sqlanywhere12 files from your machine to this container :

docker cp "C:\Users\"youraccount"\Desktop\unix\." basenet:/opt/

6) Commit this as new image (you need to be logged-in to yourdockerhubaccount)

docker login --username=yourdockerhubaccount
docker commit basenet yourdockerhubaccount/base-sqlanywhere12-dotnet:latest

7) Push to yourdockerhubaccount

docker push yourdockerhubaccount/base-sqlanywhere12-dotnet

8) In your SnapDevelop project replace the first line of your Dockerfile :

FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base

by :

FROM yourdockerhubaccount/base-sqlanywhere12-dotnet:latest AS base

9) You can publish your API and access SQL Anywhere database from docker.

 

 

Comment
  1. Armeen Mazda @Appeon
  2. Thursday, 19 December 2019 15:51 PM UTC
Thanks for sharing!
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.