• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

netbeans-odbc jar file

 
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers,
I am using netbeans for developing a desktop application.My question is that can i use ms sql instead of MySql?? if yes,then i also need some guidance with the appropriate link from where i can download the required jar file for odbc connection.

I had google searched for it but im still confused!

Thanks
 
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you can use this driver.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Netbeans has nothing to do with it. JDBC drivers are supposed to be plug-replaceable regardless of the environment. At least as long as you don't get yourself all wrapped up in vendor-specific features.

There are actually several SQL Server drivers available, including one from Microsoft. I recommend the same one that Sumedha does, however, since I've run into show-stopping bugs in the Microsoft driver in the past that the jtda driver had no problems with.
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By the way. I just noticed the title of this thread said odbc.

ODBC is not the same thing as JDBC. ODBC provides a general binary API for Windows database access. It's the lowest-common-denominator drivers, since Microsoft has newer stuff around these days, although one thing that swore me off of Microsoft was when they were publishing new - and -mutually incompatible - database APIs almost as fast as they do security patches.

JDBC is the JAVA database connection standard, and while there are several different versions of them, they're backwards compatible with each other. They're also specific to the Java language environment.

ODBC usually has relatively low performance. JDBC is has high enough performance that it has never been necessary to augment or replace it with anything faster.

There is a standard JDBC-ODBC bridge driver that allows JDBC-based Java apps to connect to databases using ODBC drivers. You should avoid using it except as a last resort. Any major database will have native JDBC drivers that work much better, except maybe for FoxPro and MS-Access, and the reason that those 2 databases are less well supported is that they're single-user DBMS's that aren't suitable for enterprise applications. In particular, neither FoxPro nor MS-Access should be used for webserver apps, since their lack of multi-user support means that they're likely to get rapidly corrupted.
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou for the replies.

On reading the suggestions given here,i downloaded jTDS driver template. While trying to setup a new connection,it asks me for the driver name,host,port and other things(Data Input mode is Field Entry)

Is the host name same as the sql server name?? I have entered the default port(1433).

I am getting a connection error...Please help me out!!
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hostname is the network hostname or IP address of the MS SQL server. If the database and web servers are on the same machine, you can use "localhost". Otherwise, use the name that it shows up under on the LAN.

One thing that's different about SQL server is that tcp/ip access to the database is turned off by default. Probably a response to the infamous "SQL Slammer" web attacks of several years back. So you (or the DBA) have to go into the SQL server control panel and enable it. Also, if the SQL server is a separate machine, you may have to open up firewall port 1433 tcp.
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou for your help,but i am still getting an error.

The error says:
Unable to add connection.Cannot establish a connection to jdbc url(Network error

IOException:Connection refused:connect)

I did everything as you said.

I tried using both,localhost as well as the number that shows up under on LAN but both give the

same error!
what should i do??
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Repeating:

Tim Holloway wrote:
One thing that's different about SQL server is that tcp/ip access to the database is turned off by default. Probably a response to the infamous "SQL Slammer" web attacks of several years back. So you (or the DBA) have to go into the SQL server control panel and enable it. Also, if the SQL server is a separate machine, you may have to open up firewall port 1433 tcp.



If you don't explicitly instruct SQL server to listen on tcp/ip port 1433, the app will not be able to connect. This is a MS SQL Server administrative function.
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
as said before,i had done everything instructed by you. I have changed the required settings in the sql server configuration manager,yet i see the same errors.
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's not much more I can say, since I haven't done this for a while and I no longer remember all the details.

However, if the SQL Server is on a different machine, make sure that there are no firewalls blocking access of tcp port 1433 between DB client and DB server.

The SQL Server settings are tricky. I believe that you have to set options carefully or tcp connections will be listened for on a floating port ID instead of always at 1433. You may also have to set access permissions to allow the DB client machine to connect. However this part is stuff that I don't remember very well. All I do remember is that it's a real nuisance to set up.
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:There's not much more I can say, since I haven't done this for a while and I no longer remember all the details.

However, if the SQL Server is on a different machine, make sure that there are no firewalls blocking access of tcp port 1433 between DB client and DB server.

The SQL Server settings are tricky. I believe that you have to set options carefully or tcp connections will be listened for on a floating port ID instead of always at 1433. You may also have to set access permissions to allow the DB client machine to connect. However this part is stuff that I don't remember very well. All I do remember is that it's a real nuisance to set up.



what should the username and password be while specifying a new database connection??
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sumedha rao wrote:

Tim Holloway wrote:There's not much more I can say, since I haven't done this for a while and I no longer remember all the details.

However, if the SQL Server is on a different machine, make sure that there are no firewalls blocking access of tcp port 1433 between DB client and DB server.

The SQL Server settings are tricky. I believe that you have to set options carefully or tcp connections will be listened for on a floating port ID instead of always at 1433. You may also have to set access permissions to allow the DB client machine to connect. However this part is stuff that I don't remember very well. All I do remember is that it's a real nuisance to set up.



what should the username and password be while specifying a new database connection??



You have 2 options. You can use DB username/password connection or you can use Windows username/password connection (NTLM authentication). I recommend DB username/password in most cases. However the DBA does have to setup this information as well as granting access (and maybe ownership) on the database resources that that particular login would have permissions on.
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you suggest me with some other driver?? or can i use jTDS for ms access?
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The driver isn't the problem. The driver is OK. It's the MS SQL server that needs to be configured to permit the driver to connect to it and to specifically listen on port 1433 instead of some random port that it chooses on its own. The random port option is the default, unfortunately.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic