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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:36:48+00:00 2026-05-16T02:36:48+00:00

I ve installed MySQL (last update). I need to code, that ll create &

  • 0

I ve installed MySQL (last update).
I need to code, that ll create & establish a connection with SQL DB
& manage the DB(using SELECT, INSERT, CREATE).

I did everything but, I am not able to create connection. I’ve also installed the MySQL/J connector, I just extracted the .zip pack in a folder & added the folder path in Variables).

Can anyone tell me wat is meant by URL in the below line?

Connection connection = DriverManager.getConnection(url, username, password);

I ve tried this:

String url = "jdbc:odbc:sqlserver://localhost:3306/myfirstdb";
Connection con = DriverManager.getConnection(url, "root", "1234");

But it’s not working. I am unable able to understand the term ‘URL’.
Can anyone explain, the meaning of ‘url’ and wat should be done to connect to a SQL server from Java.


Update:

This is the Full code. It still cannot connect.

import java.sql.*;

public class TestDriver {

public static void main(String[] args) {
try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");//This s wat actually i did for connection
    System.out.println("Driver Loaded Succesfully");
}
catch (Exception e){
    System.out.println("Unable to Load Driver!!!");
}

try {
    Class.forName(com.mysql.jdbc.Driver");  // initialise the driver
    String url ="jdbc:mysql://localhost:3306/myfirstdb";
    Connection con = DriverManager.getConnection(url, "root", "1234");
    System.out.println("connection Established");
    }
    catch(Exception e) {
                System.out.println("Couldnt get connection");
    }
    }
}

Can you tell me wat is the purpose of MySQL Connector/J?

  • 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-05-16T02:36:48+00:00Added an answer on May 16, 2026 at 2:36 am

    In the question you seem to be using a MySQL jdbc driver with a SQL Server jdbc URL. This won’t work.

    If you are using a MySQL database:

    Class.forName("com.mysql.jdbc.Driver");  // initialise the driver
    
    String url ="jdbc:mysql://localhost:3306/myfirstdb";
    

    If you are using a SQL Server database you are going to need a completely different jdbc driver. jTDS is open source and a good option. Include the jtds.jar file in your classpath and use something like:

    Class.forName("net.sourceforge.jtds.jdbc.Driver");  // initialise the driver
    
    String url = "jdbc:jtds:sqlserver://localhost:1433/myfirstdb";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 510k
  • Answers 510k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It's something to do with the order in which you… May 16, 2026 at 4:54 pm
  • Editorial Team
    Editorial Team added an answer The old std::basic_string does have one too: basic_string(const basic_string& s,… May 16, 2026 at 4:54 pm
  • Editorial Team
    Editorial Team added an answer wikipedia gives many possible meanings for the word (by itself… May 16, 2026 at 4:54 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I work on a Joomla web site, installed on a MySQL database and running
I have created a crystal report using MySql 5.1, using XML (Dataset save as
When I run: $ python manage.py syncdb I get the following output: Creating table
The last two times I've used MacPorts to install mysql5 +server , the plist
I have some text stored in MySQL database like this Tom gave Sarah £5
Prescript: The amazing etherpad was recently open sourced. Get it here: http://code.google.com/p/etherpad . This
This is the settings.py file for python. I set mysql up via macports (mysql5
I am having a problem installing the Python MySQL connector (MySQL-python-1.2.3c1) on my Mac
I currently have replication setup on MySQL 4.1 (master, named radius) to MySQL 5.0
In a recent project, I have to maintain some PHP code. I set up

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.