Home » All posts
Java - connect to SQL Server using JDBC ODBC in win 64bit
in
database,
java,
programming,
project,
Tips,
tricks
- on 4/20/2012
- No comments
When I do my School Project (Create an Java App connect to an DB), I found it's can't be done in windows 64bit, so I search the Internet and I found my own way to finish it in Windows 64bit. Just follow these step below.
Step 1
Run the 32-bit odbc driver using
WinKey+R, then copy-paste the below command
C:\Windows\SysWOW64\odbcad32.exe
Step 2
Make a dsn named “SQLDB” or whatever name you want to.
Step 3
Create a new project in eclipse.
Step 4
Change the jre to the java installed inside
C:\Program Files (x86)\java
Use this as “JRE System Library”
Step 5
Use the below code to connect to connect to SQL Server (It's a SQL_Connection class)
Step 1
Run the 32-bit odbc driver using
WinKey+R, then copy-paste the below command
C:\Windows\SysWOW64\odbcad32.exe
Step 2
Make a dsn named “SQLDB” or whatever name you want to.
Step 3
Create a new project in eclipse.
Step 4
Change the jre to the java installed inside
C:\Program Files (x86)\java
Use this as “JRE System Library”
Step 5
Use the below code to connect to connect to SQL Server (It's a SQL_Connection class)
DONE!!!!import java.sql.*; public class SQL_Connection { public static Connection GetConnection() { try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection connect=DriverManager.getConnection("jdbc:odbc:SQLDB"); return connect; } catch(Exception ex) { ex.printStackTrace(); return null; } } public static int ExecuteQueryString(String querystring) { try{ Statement st= GetConnection().createStatement(); return st.executeUpdate(querystring); } catch(Exception ex) { ex.printStackTrace(); } return -1; } public static ResultSet getResultSet(String querystring) { try{ Statement st= GetConnection().createStatement(); ResultSet rs= st.executeQuery(querystring); return rs; } catch(Exception ex) { //ex.printStackTrace(); return null; } } public static void Close_Connection(Connection conn) { try {conn.close();} catch(Exception ex) {} } }
How to read emails on mail server ?
in
algorithm,
email,
IMAP,
NET,
POP3,
programming,
Tips
- on 4/15/2012
- No comments
First of all there are multiple protocols to retreive mail:
POP3, IMAP, etc...
I suggest you start by familiarizing yourself with the various components that make up an e-mail system.
This means you will have to learn about these two protocols:
POP3 RFC: http://www.faqs.org/rfcs/rfc1939.html
IMAPv4 RFC: http://james.apache.org/server/rfclist/imap4/rfc2060.txt
Since e-mail communication happens using TCP/IP you will have to learn how to use the classes in the System.Net.Sockets namespace.
Also take a look at the TcpClient class.
Try to understand these concepts first and then I suggest you start out with POP3, this protocol is quite easy. If you have problems then with very specific TcpClient code please update your question or post a new question.
Hope this sets you on the right track.
P/S: I've complete my first program that read emails in Gmail & Download the attachments in selected emails (using VB.NET 2008).
POP3, IMAP, etc...
I suggest you start by familiarizing yourself with the various components that make up an e-mail system.
- Mail Transfer Agent (Protocol: SMTP)
- Mail Delivery Agent (Protocols: POP3, IMAP)
- Mail User Agent (Outlook, Webmail, Thunderbird, your application)
This means you will have to learn about these two protocols:
POP3 RFC: http://www.faqs.org/rfcs/rfc1939.html
IMAPv4 RFC: http://james.apache.org/server/rfclist/imap4/rfc2060.txt
Since e-mail communication happens using TCP/IP you will have to learn how to use the classes in the System.Net.Sockets namespace.
Also take a look at the TcpClient class.
Try to understand these concepts first and then I suggest you start out with POP3, this protocol is quite easy. If you have problems then with very specific TcpClient code please update your question or post a new question.
Hope this sets you on the right track.
P/S: I've complete my first program that read emails in Gmail & Download the attachments in selected emails (using VB.NET 2008).
A lot of horrific scenes after pressing mysterious button
in
browser,
Fun,
relax,
YouTube
- on 4/14/2012
- No comments
To start promoting quality TV channel TNT in Belgium, this television has put a big red button on the square in quiet Flemish towns.
A curious man who had the courage to press the red button and then, a lot of horrific scenes happen makes people shocked ...
A curious man who had the courage to press the red button and then, a lot of horrific scenes happen makes people shocked ...
Sponsors