Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7844129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:46:47+00:00 2026-06-02T16:46:47+00:00

This code runs OK in a pure Java application: Connection conn = null; Statement

  • 0

This code runs OK in a pure Java application:

    Connection conn = null;
    Statement inst;

    try {

        Class.forName ("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance ();

        conn = DriverManager.getConnection("jdbc:sqlserver://192.168.1.100\\MSSQLSERVER:1433;DatabaseName=Prueba", "sa", "sa1234");
        inst = conn.createStatement();

        inst.executeUpdate("INSERT INTO TIENDAS(NOMBRE) VALUES ('ZZZZZZZ') ");

    } catch (Exception e) {
        e.printStackTrace();
    }
}

But in Android project I get the error ‘Socket closed’.

I’m using Eclipse Helios.

Can somebody help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:46:48+00:00Added an answer on June 2, 2026 at 4:46 pm

    Android isn’t a full implementation of Java so this driver, if it is a type 4 driver, could be using some features in Java that haven’t been ported to Android. That’s first and foremost the concern about using code in Android without knowing if it will actually run on Android.

    Now a more general concern about what you’re doing. Unless you are developing an SQL browser for android I’d be very concerned about what you are doing. In order for your Android client to see the DB means it has to be exposed over the internet. That’s a seriously bad idea. Exposing your DB to the rest of the world means they don’t have to use your app to connect to it. I can fire up any old SQL browser and start guessing passwords, hacking around, trying default accounts. So if you haven’t locked down your DB it’s not a question of if someone will hack it, but when.

    You shouldn’t be directly accessing a remotely accessible DB from Android without going through an APP server like Tomcat, Jetty, etc. Rule of thumb: If you find yourself opening up your DB ports on the firewall to everyone to get your solution to work. You are definitely doing it wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code runs on my local RoR/Windows 7 (64-bit): sql = ActiveRecord::Base.connection() last_pk =
This code runs perfectly on Java but when I run this on Android platform,
This code runs fine but the for statement by the meant to read back
I have a python script the runs this code: strpath = sudo svnadmin create
This code compiles, and runs successfully locally, but not on another server. Both machines
Please check this code out it compiles and runs absolutely fine.. The question is
This piece of code compiles and runs as expected on GCC 3.x and 4.x:
I am using std::unique_ptr in this piece of code which compiles and runs as
I have this small piece of code that basically takes a list and runs
So I have a program which runs. This is part of the code: FileName

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.