Jump to content

Accessing secure data from the web with Java

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
garrettgjb

garrettgjb

    Newbie

  • Members
  • Pip
  • 6 posts
Hello all.

I'm very new to Desktop Application programming and I just wanted to know what the best way to get data from the web is. On the web, I can just connect to a database and get the proper data. But I'm not sure if this is possible or if that's safe.

Tons of applications do stuff like this where they authenticate your username that you registered on the web. How do they do that?

The only other way I can think of doing it is through a REST API on the server (java application using HTTPS to get and send data).

By the way...Is there any way to change this stupid default icon?
http://gbanker.com/pic.tiff

#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
I think you can just connect to the database using JDBC (java database connectivity).

Quote

By the way...Is there any way to change this stupid default icon?
Do you mean the icon of a JFrame?
frame.setIconImage(image);


#3
garrettgjb

garrettgjb

    Newbie

  • Members
  • Pip
  • 6 posts
Thanks for your help.

Code I used.

 public void test()

    {

        Connection con = null;

        try

        {

            Class.forName("com.mysql.jdbc.Driver");

            con=(Connection) DriverManager.getConnection("jdbc:mysql://ip/table","username", "password");

            Statement statement = (Statement) con.createStatement();

            ResultSet result = statement.executeQuery("select * from articles");

            while(result.next())

            {

                System.out.println("Body: " + result.getString("body"));

            }

        }

        

        catch(Exception e)

        {

            e.printStackTrace();

            System.out.println("Exception: " + e.getMessage());

        }

        finally

        {

            try

            {

                if(con != null)

                {

                    con.close();

                }

            }

            catch(SQLException e){};

	}

    }

Now for the icon. I mean the icon that is in my doc when I start the application. So the application icon. Is that changed with the code above?

#4
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
Changing the icon of a single .jar file isn't possible. There is software that wraps a .jar file into an .exe file and then you can set the icon of the exe file just like any other exe.