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 7878725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:44:22+00:00 2026-06-03T03:44:22+00:00

I am trying to execute a sql query in java 6: import java.sql.Connection; import

  • 0

I am trying to execute a sql query in java 6:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;


/**
 *
 * @author ramy
 */
public class JavaTest 
{

    public static void main(String[] args) 
    {
        try
        {
            String url="jdbc:msql://127.0.0.1:1521;DatabaseName=test";
            Connection ct=DriverManager.getConnection(url,"","");
            Statement st=ct.createStatement();
            ResultSet result;
            result=st.executeQuery("select * from utente");
            while(result.next())
            {
                String temp=result.getString("Num_tessera");
                System.out.println(temp);
            }
            ct.close();
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

I have installed mysql 5.5 cluster on Mac Os X, in the url I have just written my local IP (localhost), and the database name is test.
Why doesn’t it find the database? Do I have to install some driver? I already have the database installed and “utente” is an existing table.

  • 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-03T03:44:24+00:00Added an answer on June 3, 2026 at 3:44 am

    I suspect the problem is your JDBC URL:

    "jdbc:msql://..."
    

    Did you mean

    "jdbc:mysql://..."
    

    by any chance?

    (And yes, you’ll also need the MySQL driver in your classpath. It’s not something you need to install, but the jar file will need to be available.)

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

Sidebar

Related Questions

this is my first question. I'm trying to execute a SQL query in django
I'm getting a timeout error when trying to execute a LINQ (-to-SQL) query System.Data.SqlClient.SqlException:
I'm trying to debug a SQL statement generated with sqlite3 python module... c.execute(SELECT *
I am trying to execute a sql query which will create a new table
So, I am trying to execute an SQL statement stored in a shell script
I'm trying to transfer an SQL query into java from my workbench. I wrote
I am trying to execute the following SQL query using MS SQL Server Management
I'm trying to execute this SQL command in the VS Query Builder: INSERT INTO
Im trying to execute a SQL query that will rename the columns of a
I am trying to execute this SQL query prior to restoring a .BAK file

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.