Results 1 to 4 of 4
- 05-19-2014, 06:24 PM #1
Member
- Join Date
- Aug 2013
- Posts
- 1
- Rep Power
- 0
how to install and configure sqlserver jdbc driver type 4
Please i really need help on how to install and configure sql server 2012 jdbc driver i have set my enviromental variables, i even set the classpath in the command prompt like this set CLASSPATH =.;C:\Users\T-BAM\Desktop\sqljdbc_4.0\enu\sqljdbc4.jar i tried to unzip it into my Program Files its giving an error message like could not create C:\Program Files\Microsoft SQL Server JDBC Driver\sqljdbc_4.0 - unzip operation cancelled i eventually created a folder in program files Microsoft SQL Server JDBC Driver and set the classpath like this set CLASSPATH =.; C:\Program Files\Microsoft SQL Server JDBC Driver\sqljdbc_4.0\enu\sqljdbc4.jar still not working or is anything wrong with my simple code which goes like this
Please i really need help on how to install and configure sql server 2012 jdbc driver i have set my enviromental variables, i even set the classpath in the command prompt like this set CLASSPATH =.;C:\Users\T-BAM\Desktop\sqljdbc_4.0\enu\sqljdbc4.jar i tried to unzip it into my Program Files its giving an error message like could not create C:\Program Files\Microsoft SQL Server JDBC Driver\sqljdbc_4.0 - unzip operation cancelled i eventually created a folder in program files Microsoft SQL Server JDBC Driver and set the classpath like this set CLASSPATH =.; C:\Program Files\Microsoft SQL Server JDBC Driver\sqljdbc_4.0\enu\sqljdbc4.jar still not working or is anything wrong with my simple code which goes like this
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
String str = "select * from dbo.Patient_registration";
String connectionUrl = "jdbc:sqlserver://T-BAM-PC:1433;databaseName=GeneralHospital;user=sa;passw ord=godhelpme";
Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver");
Connection con = DriverManager.getConnection(connectionUrl);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(str);
System.out.println();
while (rs.next())
{
int id = rs.getInt(1);
String surtname = rs.getString(2);
String firstname = rs.getString(3);
String midlename = rs.getString(4);
String regdate = rs.getString(5);
String collectiondate = rs.getString(6);
String report =rs.getString(7);
String age = rs.getString(8);
String sex = rs.getString(9);
System.out.println(id +"\t" + surtname + "\t" + firstname +"\t" + midlename +"\t" + regdate + "\t" + collectiondate + "\t" + report + "\t" + age + "\t" + sex );
}
}
catch(Exception ex)
{
System.out.println("Error occured");
System.out.println("Error:"+ex);
}// TODO add your handling code here:
}
after clicking the jButton1 it throws an exception : Error occured
Error:java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
I have read various articles to help my self still not working, I will so much appreciate it if anyone can help me solve this problem that is giving me sleepless night
after clicking the jButton1 it throws an exception : Error occured
Error:java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
I have read various articles to help my self still not working, I will so much appreciate it if anyone can help me solve this problem that is giving me sleepless night
- 05-19-2014, 08:01 PM #2
Senior Member
- Join Date
- Feb 2014
- Posts
- 219
- Rep Power
- 5
Re: how to install and configure sqlserver jdbc driver type 4
Cross-post: how to configure sqlserver jdbc driver type 4
- 05-19-2014, 08:41 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,421
- Blog Entries
- 7
- Rep Power
- 26
Re: how to install and configure sqlserver jdbc driver type 4
It's even a double post in this single thread ;-)
kind regards,
JosBuild a wall around Donald Trump; I'll pay for it.
- 05-20-2014, 10:46 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 25
Re: how to install and configure sqlserver jdbc driver type 4
How are you running that code?
Do not set the CLASSPATH environment variable.
You really don't want a global CLASSPATH like that. Besides, it will have no effect on executable jar files (hence my question about how you are running your code).
You do not install a jar file. You simply stick it with your app, usually in a lib directory, and point the runtime classpath at it when you want to run your app. That last part takes me back to my first question...Please do not ask for code as refusal often offends.
** This space for rent **
Similar Threads
-
No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433/
By chandrasekhar.melam in forum New To JavaReplies: 5Last Post: 07-24-2013, 03:19 PM -
Error: java.sql.SQLException: No suitable driver found for jdbc:sqlserver
By mrweb in forum JDBCReplies: 5Last Post: 03-13-2012, 01:51 PM -
Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
By santde in forum JDBCReplies: 0Last Post: 03-03-2012, 01:01 AM -
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]System Exception: Connection
By Ram_TPS in forum JDBCReplies: 1Last Post: 10-16-2008, 02:09 PM -
How to get the type of the loaded JDBC driver.
By shankar in forum JDBCReplies: 1Last Post: 08-08-2007, 02:42 PM
Bookmarks