• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

No suitable driver found for JDBC

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am using microsoft sql server2008 i download Microsoft SQL Server JDBC Driver 3.0 and i set the class path as C:\Program Files\Microsoft SQL Server JDBC Driver 3.0\sqljdbc_3.0\enu\sqljdbc4.jar; and my program is


While compiling time no error but running time iam getting no suitable driver found for “jdbc:sqlserver:SQL1:sqlexpress;” +
“database=MyDatabase;” +
“user=sa;” +
“password=Admin123″;
please solve my issue.

Thanks in advance.
 
Sheriff
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your connection String is invalid. It should be in the form jdbc:sqlserver://<HOST>:<PORT>;databaseName=<DATABASE> or jdbc:sqlserver://<HOST>\<INSTANCE>;databaseName=<DATABASE>, possibly followed by more parameters separated by semi-colons. The :<PORT> or \<INSTANCE> part can be omitted if you want to connect to the default instance on the default port (1433).
For you, assuming that you're using SQL Server Express and the instance name is SQLExpress, the connecting String becomes jdbc:sqlserver:/SQL1\SQLExpress;databaseName=MyDatabase. I wouldn't add the user name and password to the connection String; use the overloaded DriverManager.getConnection(connectionUrl, username, password) method for that.
 
Rob Spoor
Sheriff
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, and please KeepItDown, also in subject lines. I've replaced the all-uppercase letters in your subject line.
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much my driver problem solved but still some errors.

while running time java Example
com.microsoft.sqlserver.jdbc.SQLserverConnection <init> SEVERE : Java Runtime Environment<JRE> version 106 is not supported by this driver. Use the sqljdbc4.jar class library,which provides support for JDBC 4.0. Java Runtime Environment <JRE> version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.


Please solve my issue.

Thanks in advance.

 
Rob Spoor
Sheriff
Posts: 22850
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the error message gives the answer already - upgrade from the JDBC 3.0 driver to the JDBC 4.0 driver.
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Now i have downloaded jdbc 4.0 and i set the class path also now there is no error but i while running time i got the line com.microsoft.sqlserver.jdbc.SQLServerDriver

c:\desktop>javac Example.java
c:\desktop> java Example
com.microsoft.sqlserver.jdbc.SQLServerDriver
c:\desktop>

My program code is


Iam using sql server 2008 and my server name is SQL1 ,

I have created the database name as MyDatabase and my table name is MyTable.

My table having 3columns name no emp_no. i wants to see my table details.

please guide to solve my problem.

Thanks in advance.
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you setting the classpath? I generally advise not to use the CLASSPATH variable, but the "-cp" switch. In that case, you'd enter something like:

java -cp theJdbcDriver.jar:. Example
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have set the class path through -cp and set CLASSPATH also still iam getting same problem it showing only com.microsoft.sqlserver.jdbc.SQLServerDriver please check my code because iam new to development filed please help me to solve this problem.


Thanks in advance.
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What, exactly, are you typing to run the program? In which directory are you, and where are the class file and the jar file?
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just running in command prompt only
to compile javac Example.java
run java Example
iam having my java file in desktop, my class file also created in desktop and jar file is in C:\Program Files\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\sqljdbc4.jar
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try something like

java -cp "C:\Program Files\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\sqljdbc4.jar;." Example
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried by using your advice, I solved that error but iam getting new error


for that i have gave my server name in the code as


Now one more error is coming that is


I checked my port number is 1433 and TCP/IP is enable and the firewall is in off.

Please help me how i can solve this problem.

Thanks in advance.
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This should give you a clue: "to the host SQL1database=MyDatabase". You're missing a semicolon.
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Really Thanks a lot. from morning on words iam struggle a lot i got the result. really so thanks a lot.

reply
    Bookmark Topic Watch Topic
  • New Topic