skip to Main Content

I am developing a .Net application that requires a ODBC connection to an external vendor’s MySQL database. The issue is that while doing development I cannot access this ODBC connection from my development machine. I have access to a remote server that can connect to the database. Is there a way to create a connection string on machine A (my dev machine) that can use the ODBC connection from machine B? I really want to avoid having to use this remote server for my actual development.

2

Answers


  1. why not connecting to local sql server,or use entity framwork

    public class BlogDataContext : DbContext
    {
        static readonly string connectionString = "Server=localhost; User ID=root; Password=pass; Database=blog";
    
        public DbSet<Author> Authors { get; set; }
        public DbSet<Post> Posts { get; set; }
    
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString));
        }
    }
    
    public class Post
    {
        public int PostId { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
        public Author Author { get; set; }
    }
    
    public class Author
    {
        public int AuthorId { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }
    
        public List<Post> Posts { get; set; }
    }
    
    Login or Signup to reply.
  2. Generally speaking, if you have 3 machines A,B,C

    A has no access to C which it needs
    B has access to C
    A has access to B

    you can set up a reverse-proxy server on B which will act as a mediator between A and C.

    Now, in your scenario you can set up the reverse-proxy on your so called "remote server" and redirect the MYSQL traffic. Then set up the ODBC connection on your local machine to the "remote server" as if you were connecting to the MYSQL directly.

    Depending on the possible limitations of your environments you are dealing with, this may or may not got smoothly, but that is the general idea.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search